1 | export as namespace dateFormat;
|
2 |
|
3 | /**
|
4 | * @param date Defaults to the current date/time.
|
5 | * @param mask Defaults to `masks.default`.
|
6 | * @returns A formatted version of the given date.
|
7 | */
|
8 | export default function dateFormat(date?: Date | string | number, mask?: string, utc?: boolean, gmt?: boolean): string;
|
9 | export default function dateFormat(mask?: string, utc?: boolean, gmt?: boolean): string;
|
10 |
|
11 | /**
|
12 | * Get proper timezone abbreviation or timezone offset.
|
13 | *
|
14 | * This will fall back to `GMT+xxxx` if it does not recognize the
|
15 | * timezone within the `timezone` RegEx above. Currently only common
|
16 | * American and Australian timezone abbreviations are supported.
|
17 | */
|
18 | export function formatTimezone(date: string | Date): string;
|
19 |
|
20 | /**
|
21 | * Predefined Formats
|
22 | */
|
23 | export let masks: DateFormatMasks;
|
24 |
|
25 | /**
|
26 | * Internationalization strings
|
27 | *
|
28 | * @example
|
29 | * import { i18n } from 'dateformat';
|
30 | *
|
31 | * i18n.dayNames = [
|
32 | * 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat',
|
33 | * 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'
|
34 | * ];
|
35 | * i18n.monthNames = [
|
36 | * 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',
|
37 | * 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'
|
38 | * ];
|
39 | * i18n.timeNames = [
|
40 | * 'a', 'p', 'am', 'pm', 'A', 'P', 'AM', 'PM'
|
41 | * ];
|
42 | */
|
43 | export let i18n: DateFormatI18n;
|
44 |
|
45 | export interface DateFormatMasks {
|
46 | /**
|
47 | * @default "ddd mmm dd yyyy HH:MM:ss"
|
48 | */
|
49 | default: string;
|
50 | /**
|
51 | * @default "m/d/yy"
|
52 | */
|
53 | shortDate: string;
|
54 | /**
|
55 | * @default "mm/dd/yyyy"
|
56 | */
|
57 | paddedShortDate: string;
|
58 | /**
|
59 | * @default "mmm d, yyyy"
|
60 | */
|
61 | mediumDate: string;
|
62 | /**
|
63 | * @default "mmmm d, yyyy"
|
64 | */
|
65 | longDate: string;
|
66 | /**
|
67 | * @default "dddd, mmmm d, yyyy"
|
68 | */
|
69 | fullDate: string;
|
70 | /**
|
71 | * @default "h:MM TT"
|
72 | */
|
73 | shortTime: string;
|
74 | /**
|
75 | * @default "h:MM:ss TT"
|
76 | */
|
77 | mediumTime: string;
|
78 | /**
|
79 | * @default "h:MM:ss TT Z"
|
80 | */
|
81 | longTime: string;
|
82 | /**
|
83 | * @default "yyyy-mm-dd"
|
84 | */
|
85 | isoDate: string;
|
86 | /**
|
87 | * @default "HH:MM:ss"
|
88 | */
|
89 | isoTime: string;
|
90 | /**
|
91 | * @default "yyyy-mm-dd'T'HH:MM:sso"
|
92 | */
|
93 | isoDateTime: string;
|
94 | /**
|
95 | * @default "UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"
|
96 | */
|
97 | isoUtcDateTime: string;
|
98 | /**
|
99 | * @default "ddd, dd mmm yyyy HH:MM:ss Z"
|
100 | */
|
101 | expiresHeaderFormat: string;
|
102 | [key: string]: string;
|
103 | }
|
104 |
|
105 | export interface DateFormatI18n {
|
106 | dayNames: string[];
|
107 | monthNames: string[];
|
108 | timeNames: string[];
|
109 | }
|