diff --git a/src/locale/uk.js b/src/locale/uk.js index 4cfa84d8b..27bfacf1f 100644 --- a/src/locale/uk.js +++ b/src/locale/uk.js @@ -16,6 +16,8 @@ function relativeTimeWithPlural(number, withoutSuffix, key) { } if (key === 'm') { return withoutSuffix ? 'хвилина' : 'хвилину' + } else if (key === 'h') { + return withoutSuffix ? 'година' : 'годину' } return `${number} ${plural(format[key], +number)}` @@ -35,7 +37,7 @@ const locale = { s: 'декілька секунд', m: relativeTimeWithPlural, mm: relativeTimeWithPlural, - h: 'годину', + h: relativeTimeWithPlural, hh: relativeTimeWithPlural, d: 'день', dd: relativeTimeWithPlural, diff --git a/test/plugin/relativeTime.test.js b/test/plugin/relativeTime.test.js index 11b1d5d55..84e3c439d 100644 --- a/test/plugin/relativeTime.test.js +++ b/test/plugin/relativeTime.test.js @@ -4,6 +4,7 @@ import dayjs from '../../src' import relativeTime from '../../src/plugin/relativeTime' import utc from '../../src/plugin/utc' import '../../src/locale/ru' +import '../../src/locale/uk' dayjs.extend(relativeTime) @@ -84,7 +85,7 @@ it('Time to X', () => { expect(dayjs().to(dayjs().subtract(3, 'year'))).toBe(moment().to(moment().subtract(3, 'year'))) }) -it('Locale Fonction', () => { +it('Locale Function', () => { // e.g. in ru locale, m: x minute require additional processing // and provides as a function instead of a string const str0 = '2020-01-06 15:53:00' @@ -115,3 +116,11 @@ it('Time from now with UTC', () => { expect(dutc.fromNow()).toBe(mutc.fromNow()) }) + +it('Uk locale hour', () => { + const str0 = '2020-03-18 19:15:00' + const str = '2020-03-18 20:15:00' + const result = dayjs(str0).locale('uk').to(str) + + expect(result).toEqual(moment(str0).locale('uk').to(str)) +})