1
1
export = dayjs ;
2
- declare function dayjs ( config ?: dayjs . ConfigType , option ?: dayjs . OptionType ) : dayjs . Dayjs
2
+ declare function dayjs ( date ?: dayjs . DateType , option ?: dayjs . OptionType ) : dayjs . Dayjs
3
3
4
4
declare namespace dayjs {
5
- export type ConfigType = string | number | Date | Dayjs
5
+ export type DateType = string | number | Date | Dayjs
6
6
7
- export type OptionType = { locale : string }
7
+ /** @deprecated Renamed to DateType. */
8
+ export type ConfigType = DateType
9
+
10
+ export type OptionType = { locale ?: string , format ?: string } | string
8
11
9
12
type UnitTypeShort = 'd' | 'M' | 'y' | 'h' | 'm' | 's' | 'ms'
10
13
export type UnitType = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'month' | 'quarter' | 'year' | 'date' | UnitTypeShort ;
@@ -23,7 +26,7 @@ declare namespace dayjs {
23
26
}
24
27
25
28
class Dayjs {
26
- constructor ( config ?: ConfigType )
29
+ constructor ( date ?: DateType )
27
30
28
31
clone ( ) : Dayjs
29
32
@@ -57,7 +60,7 @@ declare namespace dayjs {
57
60
58
61
format ( template ?: string ) : string
59
62
60
- diff ( dayjs : ConfigType , unit : OpUnitType , float ?: boolean ) : number
63
+ diff ( date : DateType , unit : OpUnitType , float ?: boolean ) : number
61
64
62
65
valueOf ( ) : number
63
66
@@ -77,24 +80,24 @@ declare namespace dayjs {
77
80
78
81
toString ( ) : string
79
82
80
- isBefore ( dayjs : ConfigType , unit ?: OpUnitType ) : boolean
83
+ isBefore ( date : DateType , unit ?: OpUnitType ) : boolean
81
84
82
- isSame ( dayjs : ConfigType , unit ?: OpUnitType ) : boolean
85
+ isSame ( date : DateType , unit ?: OpUnitType ) : boolean
83
86
84
- isAfter ( dayjs : ConfigType , unit ?: OpUnitType ) : boolean
87
+ isAfter ( date : DateType , unit ?: OpUnitType ) : boolean
85
88
86
89
isLeapYear ( ) : boolean
87
90
88
- locale ( arg1 : any , arg2 ?: any ) : Dayjs
91
+ locale ( preset : string | { name : string , [ key : string ] : any } , object ?: { [ key : string ] : any } ) : Dayjs
89
92
}
90
93
91
- export type PluginFunc = ( option : ConfigType , d1 : Dayjs , d2 : Dayjs ) => void
94
+ export type PluginFunc = ( option : any , c : typeof Dayjs , d : typeof dayjs ) => void
92
95
93
- export function extend ( plugin : PluginFunc , option ?: ConfigType ) : Dayjs
96
+ export function extend ( plugin : PluginFunc , option ?: any ) : Dayjs
94
97
95
- export function locale ( arg1 : any , arg2 ?: any ) : string
98
+ export function locale ( preset : string | { name : string , [ key : string ] : any } , object ?: { [ key : string ] : any } , isLocal ?: boolean ) : string
96
99
97
100
export function isDayjs ( d : any ) : d is Dayjs
98
-
101
+
99
102
export function unix ( t : number ) : Dayjs
100
103
}
0 commit comments