/
index.d.ts
103 lines (60 loc) · 2.25 KB
/
index.d.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
export = dayjs;
declare function dayjs (date?: dayjs.DateType, option?: dayjs.OptionType): dayjs.Dayjs
declare namespace dayjs {
export type DateType = string | number | Date | Dayjs
/** @deprecated Renamed to DateType. */
export type ConfigType = DateType
export type OptionType = { locale?: string, format?: string } | string
type UnitTypeShort = 'd' | 'M' | 'y' | 'h' | 'm' | 's' | 'ms'
export type UnitType = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'month' | 'quarter' | 'year' | 'date' | UnitTypeShort;
type OpUnitTypeShort = 'w'
export type OpUnitType = UnitType | "week" | OpUnitTypeShort;
interface DayjsObject {
years: number
months: number
date: number
hours: number
minutes: number
seconds: number
milliseconds: number
}
class Dayjs {
constructor (date?: DateType)
clone(): Dayjs
isValid(): boolean
year(): number
month(): number
date(): number
day(): number
hour(): number
minute(): number
second(): number
millisecond(): number
set(unit: UnitType, value: number): Dayjs
add(value: number, unit: OpUnitType): Dayjs
subtract(value: number, unit: OpUnitType): Dayjs
startOf(unit: OpUnitType): Dayjs
endOf(unit: OpUnitType): Dayjs
format(template?: string): string
diff(date: DateType, unit: OpUnitType, float?: boolean): number
valueOf(): number
unix(): number
daysInMonth(): number
toDate(): Date
toArray(): number[]
toJSON(): string
toISOString(): string
toObject(): DayjsObject
toString(): string
isBefore(date: DateType, unit?: OpUnitType): boolean
isSame(date: DateType, unit?: OpUnitType): boolean
isAfter(date: DateType, unit?: OpUnitType): boolean
isLeapYear(): boolean
locale(preset: string | { name: string, [key: string]: any }, object?: { [key: string]: any }): Dayjs
}
export type PluginFunc = (option: any, c: typeof Dayjs, d: typeof dayjs) => void
export function extend(plugin: PluginFunc, option?: any): Dayjs
export function locale(preset: string | { name: string, [key: string]: any }, object?: { [key: string]: any }, isLocal?: boolean): string
export function isDayjs(d: any): d is Dayjs
export function unix(t: number): Dayjs
}