You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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]
The text was updated successfully, but these errors were encountered:
mohammed-bahumaish
changed the title
all Arabic locale: meridiem is reversed
Arabic locales: Meridiem is reversed
Jun 13, 2022
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
The text was updated successfully, but these errors were encountered: