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

add meridiem function to ku locale #1725

Merged
merged 1 commit into from
Mar 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/locale/ku.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const locale = {
LLL: 'D MMMM YYYY HH:mm',
LLLL: 'dddd, D MMMM YYYY HH:mm'
},
meridiem: hour => (hour < 12 ? 'پ.ن' : 'د.ن'),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, should we keep the same with momentjs as https://github.com/moment/moment/blob/e96809208c9d1b1bbe22d605e76985770024de42/locale/ku.js#L76

meridiem: function (hour, minute, isLower) {
            if (hour < 12) {
                return 'به‌یانی';
            } else {
                return 'ئێواره‌';
            }
        },

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @iamkun

Not sure if this was a question.

The rationale behind using پ.ن instead of بەیانی is that, it's short version of it, just as AM.
Usually it's a preferred way of using those post-fixes with time in Kurdish language, not sure if we use بەیانی and ئێوارە whatsoever.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alright, thanks for this explanation

relativeTime: {
future: 'له‌ %s',
past: '%s',
Expand Down
20 changes: 20 additions & 0 deletions test/locale/ku.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import MockDate from 'mockdate'
import dayjs from '../../src'
import '../../src/locale/ku'

beforeEach(() => {
MockDate.set(new Date())
})

afterEach(() => {
MockDate.reset()
})

it('Format meridiem correctly', () => {
for (let i = 0; i <= 23; i += 1) {
const dayjsKu = dayjs()
.startOf('day')
.add(i, 'hour')
expect(dayjsKu.locale('ku').format('h A')).toBe(`${i % 12 || 12} ${i < 12 ? 'پ.ن' : 'د.ن'}`)
}
})