Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ar-iq meridiem function implementation is wrong #1727

Closed
akamfoad opened this issue Dec 1, 2021 · 1 comment · Fixed by #1954
Closed

ar-iq meridiem function implementation is wrong #1727

akamfoad opened this issue Dec 1, 2021 · 1 comment · Fixed by #1954
Labels

Comments

@akamfoad
Copy link
Contributor

akamfoad commented Dec 1, 2021

Describe the bug
All Arabic languages has meridiem function implemented incorrectly, the library provides the hours in 24 format and it must be mapped as below:

Hours English meridiem Arabic meridiem
0-11 AM ص
12-23 PM م

References:

Default Implementation is:

dayjs/src/index.js

Lines 271 to 274 in 5a108ff

const meridiemFunc = meridiem || ((hour, minute, isLowercase) => {
const m = (hour < 12 ? 'AM' : 'PM')
return isLowercase ? m.toLowerCase() : m
})

Arabic implementation

meridiem: hour => (hour > 12 ? 'ص' : 'م'),

meridiem: hour => (hour > 12 ? 'ص' : 'م'),

meridiem: hour => (hour > 12 ? 'ص' : 'م'),

meridiem: hour => (hour > 12 ? 'ص' : 'م'),

meridiem: hour => (hour > 12 ? 'ص' : 'م'),

meridiem: hour => (hour > 12 ? 'ص' : 'م'),

meridiem: hour => (hour > 12 ? 'ص' : 'م'),

So the logic should be

 meridiem: hour => (hour < 12 ? 'ص' : 'م'), 

Current Behaviour

An Example:

import "dayjs/locale/ar-iq"

dayjs().format("h A")      // 2 PM
dayjs().locale("ar-iq").format("h A")      // 2 ص

Expected behavior
Correct localized meridiem string as ص before 12 and م after 12.

An Example:

import "dayjs/locale/ar-iq"

dayjs().format("h A")      // 2 PM
dayjs().locale("ar-iq").format("h A")      // 2 م

Information

  • Day.js Version: v1.10.0.7
  • OS: Irrelevant
  • Browser Irrelevant
  • Time zone: Irrelevant
@iamkun
Copy link
Owner

iamkun commented Jul 19, 2022

🎉 This issue has been resolved in version 1.11.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants