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

Arabic locales: Meridiem is reversed #1941

Closed
mohammed-bahumaish opened this issue Jun 13, 2022 · 1 comment · Fixed by #1954
Closed

Arabic locales: Meridiem is reversed #1941

mohammed-bahumaish opened this issue Jun 13, 2022 · 1 comment · Fixed by #1954
Labels

Comments

@mohammed-bahumaish
Copy link

Describe the bug
while working on a project where I use Dayjs in, I have noticed that all meridiem uses Arabic locales are reversed.
I have looked into the source code in Github and found
meridiem: hour => (hour > 12 ? 'ص' : 'م'),
which at first look it looks fine! but Arabic letters has a weird behavior when written in one line with English letters, it tends to flip around. because Arabic write from right to left.
Although it looks like it should return "م" when hours are more than 12, but it returns "ص" which is reversed!.

Expected behavior
returning 'م' when hour>12 is true
returning 'ص' when hour>12 is false
but what is happening is the reverse since Arabic letters read from write to left

Fix
Using if else instead of ternary operator, because ternary operator tend to flip the output when used with Arabic (becase its read from right to left)

I'm ready to make a pull request if you agree, let me know what you think. thanks.

Information

  • Day.js Version latest
  • OS: windows 11
  • Browser [chrome latest]
@mohammed-bahumaish mohammed-bahumaish changed the title all Arabic locale: meridiem is reversed Arabic locales: Meridiem is reversed Jun 13, 2022
@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