-
Notifications
You must be signed in to change notification settings - Fork 836
/
Copy pathmoment-timezone-tests.ts
103 lines (79 loc) · 3.39 KB
/
moment-timezone-tests.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
import moment = require('../index');
const june = moment('2014-06-01T12:00:00Z');
june.tz('America/Los_Angeles').format('ha z');
const a = moment.tz('2013-11-18 11:55', 'America/Toronto');
const b = moment.tz('May 12th 2014 8PM', 'MMM Do YYYY hA', 'America/Toronto');
const c = moment.tz(1403454068850, 'America/Toronto');
const d = moment.tz('May 12th 2014 8PM', 'MMM Do YYYY hA', true, 'America/Toronto');
a.tz();
const num = 1367337600000;
const arr = [2013, 5, 1];
const str = '2013-12-01';
const date = new Date(2013, 4, 1);
const mo = moment([2013, 4, 1]);
const obj = { year : 2013, month : 5, day : 1 };
const format = 'YYYY-MM-DD';
const formats = ['YYYY-MM-DD', 'YYYY/MM/DD'];
const formatsIncludingSpecial = ['YYYY-MM-DD', moment.ISO_8601];
const language = 'en';
moment.tz();
moment.tz('America/Los_Angeles');
moment.tz('America/Los_Angeles').tz('Asia/Tomsk', true);
moment.tz(num, 'America/Los_Angeles');
moment.tz(arr, 'America/Los_Angeles');
moment.tz(str, 'America/Los_Angeles');
moment.tz(str, format, 'America/Los_Angeles');
moment.tz(str, format, true, 'America/Los_Angeles');
moment.tz(str, format, language, 'America/Los_Angeles');
moment.tz(str, format, language, true, 'America/Los_Angeles');
moment.tz(str, formats, 'America/Los_Angeles');
moment.tz(str, formats, true, 'America/Los_Angeles');
moment.tz(str, formats, language, 'America/Los_Angeles');
moment.tz(str, formats, language, true, 'America/Los_Angeles');
moment.tz(str, moment.ISO_8601, 'America/Los_Angeles');
moment.tz(str, moment.ISO_8601, true, 'America/Los_Angeles');
moment.tz(str, moment.ISO_8601, language, 'America/Los_Angeles');
moment.tz(str, moment.ISO_8601, language, true, 'America/Los_Angeles');
moment.tz(str, formatsIncludingSpecial, 'America/Los_Angeles');
moment.tz(str, formatsIncludingSpecial, true, 'America/Los_Angeles');
moment.tz(str, formatsIncludingSpecial, language, 'America/Los_Angeles');
moment.tz(str, formatsIncludingSpecial, language, true, 'America/Los_Angeles');
moment.tz(date, 'America/Los_Angeles');
moment.tz(mo, 'America/Los_Angeles');
moment.tz(obj, 'America/Los_Angeles');
const zone1: moment.MomentZone | null = moment.tz.zone('America/Los_Angeles');
if (zone1 != null) {
zone1.abbr(1403465838805);
zone1.utcOffset(1403465838805);
}
const zone2: moment.MomentZone | null = moment.tz.zone('America/New_York');
if (zone2 != null) {
zone2.parse(Date.UTC(2012, 2, 19, 8, 30)); // 240
}
moment.tz.add('America/Los_Angeles|PST PDT|80 70|0101|1Lzm0 1zb0 Op0');
moment.tz.add([
'America/Los_Angeles|PST PDT|80 70|0101|1Lzm0 1zb0 Op0',
'America/New_York|EST EDT|50 40|0101|1Lz50 1zb0 Op0'
]);
moment.tz.link('America/Los_Angeles|US/Pacific');
moment.tz.link([
'America/Los_Angeles|US/Pacific',
'America/New_York|US/Eastern'
]);
moment.tz.load({
zones : [],
links : [],
version : '2014e'
});
moment.tz.names();
moment.tz.setDefault('America/Los_Angeles');
moment.tz.setDefault();
moment.tz.guess();
moment.tz.guess(true);
const zoneAbbr: string = moment.tz('America/Los_Angeles').zoneAbbr();
const zoneName: string = moment.tz('America/Los_Angeles').zoneName();
const zoneType: string | undefined = moment.tz('2013-11-18 11:55').tz();
const zones1: string[] = moment.tz.zonesForCountry('US');
const zones2: moment.MomentZoneOffset[] = moment.tz.zonesForCountry('CN', true);
const zones3: string[] = moment.tz.zonesForCountry('GB', false);
const countries: string[] = moment.tz.countries();