fix(locale): correct meridiem boundary in all Arabic locales#3029
Open
mahmoodhamdi wants to merge 1 commit intoiamkun:devfrom
Open
fix(locale): correct meridiem boundary in all Arabic locales#3029mahmoodhamdi wants to merge 1 commit intoiamkun:devfrom
mahmoodhamdi wants to merge 1 commit intoiamkun:devfrom
Conversation
All Arabic locales used `hour > 12` for the meridiem function, which incorrectly classified noon (hour 12) as AM (ص) instead of PM (م). Changed to `hour >= 12` to match the core default behavior and other locale implementations (ja, ko, br, ku). Affected locales: ar, ar-sa, ar-ma, ar-dz, ar-iq, ar-kw, ar-ly, ar-tn
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
Fixed the meridiem (AM/PM) boundary condition in all 8 Arabic locale files (
ar,ar-sa,ar-ma,ar-dz,ar-iq,ar-kw,ar-ly,ar-tn).Why
I use day.js with Arabic locale in my projects and noticed that at exactly 12:00 noon, the meridiem returns ص (AM) instead of م (PM).
The issue is that all Arabic locales use
hour > 12instead ofhour >= 12:This is inconsistent with:
src/index.jswhich useshour < 12(meaning>= 12is PM)ja,ko,br,kuwhich all usehour < 12In the 24-hour system, hour 12 is noon and should be PM (مساءً), not AM (صباحاً).
Changes
src/locale/ar.js—> 12→>= 12src/locale/ar-sa.js—> 12→>= 12src/locale/ar-ma.js—> 12→>= 12src/locale/ar-dz.js—> 12→>= 12src/locale/ar-iq.js—> 12→>= 12src/locale/ar-kw.js—> 12→>= 12src/locale/ar-ly.js—> 12→>= 12src/locale/ar-tn.js—> 12→>= 12test/locale/ar.test.js— fixed meridiem test assertion to match corrected behaviorTesting
npm run lintpasses with no errors