Skip to content

fix(locale): correct Khmer meridiem boundary and add meridiem to ILocale type#3030

Open
mahmoodhamdi wants to merge 1 commit into
iamkun:devfrom
mahmoodhamdi:fix/km-meridiem-and-locale-types
Open

fix(locale): correct Khmer meridiem boundary and add meridiem to ILocale type#3030
mahmoodhamdi wants to merge 1 commit into
iamkun:devfrom
mahmoodhamdi:fix/km-meridiem-and-locale-types

Conversation

@mahmoodhamdi
Copy link
Copy Markdown

What

  1. Fixed the Khmer (km) locale meridiem function boundary condition
  2. Added the missing meridiem property to the TypeScript ILocale interface
  3. Added test coverage for the Khmer locale meridiem

Why

While investigating locale meridiem implementations across the codebase, I found that the Khmer locale uses hour > 12 instead of hour >= 12. This causes noon (hour 12) to be incorrectly classified as morning (ព្រឹក) instead of afternoon (ល្ងាច).

The core default meridiem in src/index.js uses hour < 12 (meaning >= 12 is PM), and other locales like ja, ko, br, ku follow the same correct pattern.

Additionally, the ILocale TypeScript interface in types/locale/types.d.ts was missing the meridiem property, 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.jshour > 12hour >= 12
  • types/locale/types.d.ts — added optional meridiem property to ILocale
  • test/locale/km.test.js — new test file for Khmer locale meridiem (includes hour 12 boundary test)

Testing

  • All 94 test suites pass (774 tests)
  • npm run lint passes with no errors

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant