deno.land / x / dayjs@v1.11.5 / test / locale / et.test.js

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import moment from 'moment'import MockDate from 'mockdate'import dayjs from '../../src'import relativeTime from '../../src/plugin/relativeTime'import '../../src/locale/et'
dayjs.extend(relativeTime)
beforeEach(() => { MockDate.set(new Date())})
afterEach(() => { MockDate.reset()})
it('RelativeTime: Time from X', () => { const T = [ [44.4, 'second'], // a few seconds [89.5, 'second'], // a minute [43, 'minute'], // 44 minutes [21, 'hour'], // 21 hours [25, 'day'], // 25 days [10, 'month'], // 2 month [18, 'month'] // 2 years ]
T.forEach((t) => { dayjs.locale('et') moment.locale('et') expect(dayjs().from(dayjs().add(t[0], t[1]))) .toBe(moment().from(moment().add(t[0], t[1]))) expect(dayjs().from(dayjs().subtract(t[0], t[1]))) .toBe(moment().from(moment().subtract(t[0], t[1]))) expect(dayjs().from(dayjs().add(t[0], t[1]), true)) .toBe(moment().from(moment().add(t[0], t[1]), true)) })})
dayjs

Version Info

Tagged at
a year ago