1
- // Type definitions for moment-timezone.js 0.5
1
+ // Type definitions for moment-timezone.js
2
2
// Project: http://momentjs.com/timezone/
3
3
// Definitions by: Michel Salib <https://github.com/michelsalib>
4
4
// Alan Brazil Lins <https://github.com/alanblins>
5
5
// Agustin Carrasco <https://github.com/asermax>
6
6
// Borys Kupar <https://github.com/borys-kupar>
7
7
// Anthony Rainer <https://github.com/pristinesource>
8
- // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
9
- // Migrated here from DefinitelyTyped in release [email protected]
8
+ // Original source: https://github.com/DefinitelyTyped/DefinitelyTyped
9
+ // Migrated here from DefinitelyTyped in release [email protected] ,
10
+ // then maintained by the Moment team
10
11
11
12
import moment = require( 'moment' ) ;
12
13
13
14
declare module 'moment' {
15
+ /** Parsed / unpacked zone data. */
16
+ interface UnpackedZone {
17
+ name : string ;
18
+ abbrs : string [ ] ;
19
+ untils : number [ ] ;
20
+ offsets : number [ ] ;
21
+ population ?: number ;
22
+ }
23
+
14
24
interface MomentZone {
15
25
name : string ;
16
26
abbrs : string [ ] ;
@@ -19,9 +29,13 @@ declare module 'moment' {
19
29
population : number ;
20
30
21
31
abbr ( timestamp : number ) : string ;
32
+ /**
33
+ * @deprecated use `.utcOffset()`
34
+ */
22
35
offset ( timestamp : number ) : number ;
23
36
utcOffset ( timestamp : number ) : number ;
24
37
parse ( timestamp : number ) : number ;
38
+ countries ( ) : string [ ] ;
25
39
}
26
40
27
41
interface MomentZoneOffset {
@@ -43,15 +57,21 @@ declare module 'moment' {
43
57
( date : moment . Moment , timezone : string ) : moment . Moment ;
44
58
( date : any , timezone : string ) : moment . Moment ;
45
59
60
+ version : string ;
61
+ dataVersion : string ;
62
+ moveInvalidForward : boolean ;
63
+ moveAmbiguousForward : boolean ;
64
+
46
65
zone ( timezone : string ) : MomentZone | null ;
66
+ Zone ( packedZoneString ?: string ) : MomentZone ;
47
67
48
68
add ( packedZoneString : string ) : void ;
49
69
add ( packedZoneString : string [ ] ) : void ;
50
70
51
71
link ( packedLinkString : string ) : void ;
52
72
link ( packedLinkString : string [ ] ) : void ;
53
73
54
- load ( data : { version : string ; links : string [ ] ; zones : string [ ] } ) : void ;
74
+ load ( data : { version : string ; links : string [ ] ; zones : string [ ] ; countries ?: string [ ] } ) : void ;
55
75
56
76
names ( ) : string [ ] ;
57
77
zonesForCountry < T extends true > ( country : string , with_offset : T ) : T extends true ? MomentZoneOffset [ ] : never ;
@@ -60,8 +80,10 @@ declare module 'moment' {
60
80
countries ( ) : string [ ] ;
61
81
guess ( ignoreCache ?: boolean ) : string ;
62
82
63
- setDefault ( timezone ?: string ) : Moment ;
64
- dataVersion : string ;
83
+ setDefault ( timezone ?: string ) : typeof moment ;
84
+
85
+ unpack ( packedZoneString : string ) : UnpackedZone ;
86
+ unpackBase60 ( packedString : string ) : number ;
65
87
}
66
88
67
89
interface Moment {
0 commit comments