diff --git a/src/locale/uk.js b/src/locale/uk.js index fdc9aa656..528327d5d 100644 --- a/src/locale/uk.js +++ b/src/locale/uk.js @@ -61,6 +61,16 @@ const locale = { yy: relativeTimeWithPlural }, ordinal: n => n, + meridiem: (hour) => { + if (hour < 4) { + return 'ночі' + } else if (hour < 12) { + return 'ранку' + } else if (hour < 17) { + return 'дня' + } + return 'вечора' + }, formats: { LT: 'HH:mm', LTS: 'HH:mm:ss', diff --git a/test/locale/uk.test.js b/test/locale/uk.test.js index 55b4b35de..fc509af8c 100644 --- a/test/locale/uk.test.js +++ b/test/locale/uk.test.js @@ -57,3 +57,10 @@ it('hour', () => { const result2 = dayjs(str).locale('uk').to(str0, true) expect(result2).toEqual('година') // different from moment.js }) + +it('Meridiem', () => { + expect(dayjs('2026-01-01 03:00:00').locale('uk').format('A')).toEqual('ночі') + expect(dayjs('2026-01-01 11:00:00').locale('uk').format('A')).toEqual('ранку') + expect(dayjs('2026-01-01 16:00:00').locale('uk').format('A')).toEqual('дня') + expect(dayjs('2026-01-01 20:00:00').locale('uk').format('A')).toEqual('вечора') +})