Skip to content

fix(locale): correct meridiem boundary in all Arabic locales#3029

Open
mahmoodhamdi wants to merge 1 commit intoiamkun:devfrom
mahmoodhamdi:fix/arabic-meridiem-boundary
Open

fix(locale): correct meridiem boundary in all Arabic locales#3029
mahmoodhamdi wants to merge 1 commit intoiamkun:devfrom
mahmoodhamdi:fix/arabic-meridiem-boundary

Conversation

@mahmoodhamdi
Copy link
Copy Markdown

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 > 12 instead of hour >= 12:

// Before (incorrect): hour 12 → ص (AM) ❌
meridiem: hour => (hour > 12 ? 'م' : 'ص')

// After (correct): hour 12 → م (PM) ✅
meridiem: hour => (hour >= 12 ? 'م' : 'ص')

This is inconsistent with:

  • The core default meridiem in src/index.js which uses hour < 12 (meaning >= 12 is PM)
  • Other locales like ja, ko, br, ku which all use hour < 12

In the 24-hour system, hour 12 is noon and should be PM (مساءً), not AM (صباحاً).

Changes

  • src/locale/ar.js> 12>= 12
  • src/locale/ar-sa.js> 12>= 12
  • src/locale/ar-ma.js> 12>= 12
  • src/locale/ar-dz.js> 12>= 12
  • src/locale/ar-iq.js> 12>= 12
  • src/locale/ar-kw.js> 12>= 12
  • src/locale/ar-ly.js> 12>= 12
  • src/locale/ar-tn.js> 12>= 12
  • test/locale/ar.test.js — fixed meridiem test assertion to match corrected behavior

Testing

  • All 93 test suites pass (773 tests)
  • npm run lint passes with no errors

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
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