|
|
@ -2,9 +2,48 @@ |
|
|
|
import * as dayjs from 'dayjs'; |
|
|
|
import * as advancedFormat from 'dayjs/plugin/advancedFormat'; |
|
|
|
import * as relativeTime from 'dayjs/plugin/relativeTime'; |
|
|
|
import * as updateLocale from 'dayjs/plugin/updateLocale'; |
|
|
|
|
|
|
|
dayjs.extend(advancedFormat); |
|
|
|
dayjs.extend(relativeTime); |
|
|
|
dayjs.extend(relativeTime, { |
|
|
|
thresholds: [ |
|
|
|
{ l: 's', r: 44, d: 'second' }, |
|
|
|
{ l: 'm', r: 89 }, |
|
|
|
{ l: 'mm', r: 44, d: 'minute' }, |
|
|
|
{ l: 'h', r: 89 }, |
|
|
|
{ l: 'hh', r: 21, d: 'hour' }, |
|
|
|
{ l: 'd', r: 35 }, |
|
|
|
{ l: 'dd', r: 6, d: 'day' }, |
|
|
|
{ l: 'w', r: 7 }, |
|
|
|
{ l: 'ww', r: 3, d: 'week' }, |
|
|
|
{ l: 'M', r: 4 }, |
|
|
|
{ l: 'MM', r: 10, d: 'month' }, |
|
|
|
{ l: 'y', r: 17 }, |
|
|
|
{ l: 'yy', d: 'year' }, |
|
|
|
], |
|
|
|
}); |
|
|
|
dayjs.extend(updateLocale); |
|
|
|
|
|
|
|
dayjs.updateLocale('en', { |
|
|
|
relativeTime: { |
|
|
|
future: 'in %s', |
|
|
|
past: '%s ago', |
|
|
|
s: 'a few seconds', |
|
|
|
m: 'a minute', |
|
|
|
mm: '%d minutes', |
|
|
|
h: 'an hour', |
|
|
|
hh: '%d hours', |
|
|
|
d: 'a day', |
|
|
|
dd: '%d days', |
|
|
|
w: 'a week', |
|
|
|
ww: '%d weeks', |
|
|
|
M: 'a month', |
|
|
|
MM: '%d months', |
|
|
|
y: 'a year', |
|
|
|
yy: '%d years', |
|
|
|
}, |
|
|
|
}); |
|
|
|
|
|
|
|
export const MillisecondsPerMinute = 60000; // 60 * 1000
|
|
|
|
export const MillisecondsPerHour = 3600000; // 60 * 60 * 1000
|
|
|
|