-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDayjs.ts
36 lines (34 loc) · 1.02 KB
/
Dayjs.ts
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
import dayjs from 'dayjs';
// @ts-ignore
import 'dayjs/locale/pt';
import calendar from 'dayjs/plugin/calendar';
import customParseFormat from 'dayjs/plugin/customParseFormat';
import duration from 'dayjs/plugin/duration';
import isSameOrAfter from 'dayjs/plugin/isSameOrAfter';
import isSameOrBefore from 'dayjs/plugin/isSameOrBefore';
import relativeTime from 'dayjs/plugin/relativeTime';
import timezone from 'dayjs/plugin/timezone';
import updateLocale from 'dayjs/plugin/updateLocale';
import utc from 'dayjs/plugin/utc';
import weekday from 'dayjs/plugin/weekday';
dayjs.extend(updateLocale);
dayjs.updateLocale('pt', {
weekStart: 1,
calendar: {
sameDay: '[hoje]',
nextDay: '[amanhã]',
nextWeek: 'dddd',
sameElse: 'DD/MM/YYYY',
},
});
dayjs.locale('pt');
dayjs.extend(calendar);
dayjs.extend(duration);
dayjs.extend(isSameOrAfter);
dayjs.extend(isSameOrBefore);
dayjs.extend(relativeTime);
dayjs.extend(timezone);
dayjs.extend(utc);
dayjs.extend(weekday);
dayjs.extend(customParseFormat);
export const Dayjs = dayjs;