fix(locale): correct Khmer meridiem boundary and add meridiem to ILocale type#3030
Open
mahmoodhamdi wants to merge 1 commit into
Open
fix(locale): correct Khmer meridiem boundary and add meridiem to ILocale type#3030mahmoodhamdi wants to merge 1 commit into
mahmoodhamdi wants to merge 1 commit into
Conversation
…ale type The Khmer (km) locale used `hour > 12` for the meridiem function, which incorrectly classified noon (hour 12) as morning instead of afternoon. Changed to `hour >= 12` to match the core default behavior. Also added the missing optional `meridiem` property to the ILocale TypeScript interface in types/locale/types.d.ts, since many locales implement it but it was not reflected in the type definition.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
km) locale meridiem function boundary conditionmeridiemproperty to the TypeScriptILocaleinterfaceWhy
While investigating locale meridiem implementations across the codebase, I found that the Khmer locale uses
hour > 12instead ofhour >= 12. This causes noon (hour 12) to be incorrectly classified as morning (ព្រឹក) instead of afternoon (ល្ងាច).The core default meridiem in
src/index.jsuseshour < 12(meaning>= 12is PM), and other locales likeja,ko,br,kufollow the same correct pattern.Additionally, the
ILocaleTypeScript interface intypes/locale/types.d.tswas missing themeridiemproperty, even though it is implemented by many locales and used by the core formatting logic with the signature(hour, minute, isLowerCase) => string.Changes
src/locale/km.js—hour > 12→hour >= 12types/locale/types.d.ts— added optionalmeridiemproperty toILocaletest/locale/km.test.js— new test file for Khmer locale meridiem (includes hour 12 boundary test)Testing
npm run lintpasses with no errors