summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Date/time-zones-historic.js
blob: e5649153b351338b98bf391efd3962da38826113 (plain)
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
// |reftest| skip-if(winWidget||!this.hasOwnProperty("Intl")) -- Windows doesn't accept IANA names for the TZ env variable; Requires ICU time zone support

// bug 487897
inTimeZone("Europe/London", () => {
    let dt1 = new Date(1970, Month.January, 1, 0, 0, 0, 0);
    assertDateTime(dt1, "Thu Jan 01 1970 00:00:00 GMT+0100 (Greenwich Mean Time)");
    assertEq(dt1.getHours(), 0);

    let dt2 = new Date(1915, Month.January, 1);
    assertDateTime(dt2, "Fri Jan 01 1915 00:00:00 GMT+0000 (Greenwich Mean Time)");

    let dt3 = new Date(1970, Month.January, 1);
    assertDateTime(dt3, "Thu Jan 01 1970 00:00:00 GMT+0100 (Greenwich Mean Time)");
});

// bug 637244
inTimeZone("Asia/Novosibirsk", () => {
    let dt1 = new Date("1942-03-01T00:00:00");
    assertDateTime(dt1, "Sun Mar 01 1942 00:00:00 GMT+0700 (Novosibirsk Standard Time)");
    dt1.setMonth(Month.April);
    assertDateTime(dt1, "Wed Apr 01 1942 00:00:00 GMT+0700 (Novosibirsk Standard Time)");

    let dt2 = new Date(2010, Month.October, 31);
    assertDateTime(dt2, "Sun Oct 31 2010 00:00:00 GMT+0700 (Novosibirsk Summer Time)");
    dt2.setMonth(Month.November);
    assertDateTime(dt2, "Wed Dec 01 2010 00:00:00 GMT+0600 (Novosibirsk Standard Time)");

    let dt3 = new Date(1942, Month.April, 1);
    assertDateTime(dt3, "Wed Apr 01 1942 00:00:00 GMT+0700 (Novosibirsk Standard Time)");

    function getNumberOfDaysInMonth(year, month) {
        switch (month) {
          case Month.January:
          case Month.March:
          case Month.May:
          case Month.July:
          case Month.August:
          case Month.October:
          case Month.December:
            return 31;
          case Month.April:
          case Month.June:
          case Month.September:
          case Month.November:
            return 30;
          case Month.February:
            if (year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0))
                return 29;
            return 28;
        }
        throw new Error(`Illegal month value: ${month}`);
    }

    for (let year = 1900; year <= 2142; ++year) {
        for (let month = Month.January; month <= Month.December; ++month) {
            const numDays = getNumberOfDaysInMonth(year, month);
            for (let day = 1; day <= numDays; ++day) {
                let date = new Date(year, month, day);
                assertEq(date.getMonth(), month);
            }
        }
    }

    let dt4 = new Date(1984, Month.April, 1);
    assertDateTime(dt4, "Sun Apr 01 1984 01:00:00 GMT+0800 (Novosibirsk Summer Time)");

    let dt5 = new Date(1984, Month.March, 1);
    assertDateTime(dt5, "Thu Mar 01 1984 00:00:00 GMT+0700 (Novosibirsk Standard Time)");

    let dt6 = new Date(1984, Month.April, 1);
    assertEq(dt6.toUTCString(), "Sat, 31 Mar 1984 17:00:00 GMT");
    assertEq(dt6.getTime(), 449600400000);
});
inTimeZone("Europe/Tallinn", () => {
    let dt = new Date(2040, Month.March, 31, 20);

    for (let {datetime, date, hours} of [
        {datetime: "Sat Mar 31 2040 20:00:00", date: 31, hours: 20},
        {datetime: "Sat Mar 31 2040 22:00:00", date: 31, hours: 22},
        {datetime: "Sun Apr 01 2040 00:00:00", date: 1, hours: 0},
        {datetime: "Sun Apr 01 2040 02:00:00", date: 1, hours: 2},
        {datetime: "Sun Apr 01 2040 04:00:00", date: 1, hours: 4},
        {datetime: "Sun Apr 01 2040 06:00:00", date: 1, hours: 6},
        {datetime: "Sun Apr 01 2040 08:00:00", date: 1, hours: 8},
    ]) {
        assertDateTime(dt, `${datetime} GMT+0300 (Eastern European Summer Time)`);
        assertEq(dt.getDate(), date);
        assertEq(dt.getHours(), hours);
        assertEq(dt.getTimezoneOffset(), -180);

        dt.setHours(dt.getHours() + 2);
    }
});
inTimeZone("Europe/Riga", () => {
    let dt1 = new Date(2016, Month.March, 27, 2, 59);
    assertDateTime(dt1, "Sun Mar 27 2016 02:59:00 GMT+0200 (Eastern European Standard Time)");

    let dt2 = new Date(2016, Month.March, 27, 3, 0);
    assertDateTime(dt2, "Sun Mar 27 2016 04:00:00 GMT+0300 (Eastern European Summer Time)");
});

// bug 704486
inTimeZone("Europe/Zagreb", () => {
    let dt = new Date(Date.UTC(1942, Month.June, 11, 22, 0, 0, 0));
    assertDateTime(dt, "Fri Jun 12 1942 00:00:00 GMT+0200 (Central European Summer Time)");
    assertEq(dt.getFullYear(), 1942);
    assertEq(dt.getMonth(), Month.June);
    assertEq(dt.getDate(), 12);
    assertEq(dt.getHours(), 0);
    assertEq(dt.getMinutes(), 0);
    assertEq(dt.getSeconds(), 0);
    assertEq(dt.getMilliseconds(), 0);
    assertEq(dt.getTimezoneOffset(), -120);
});

// bug 935909
inTimeZone("Europe/London", () => {
    let dt1 = new Date(1954, Month.January, 1);
    assertDateTime(dt1, "Fri Jan 01 1954 00:00:00 GMT+0000 (Greenwich Mean Time)");

    let dt2 = new Date(1965, Month.January, 1);
    assertDateTime(dt2, "Fri Jan 01 1965 00:00:00 GMT+0000 (Greenwich Mean Time)");

    let dt3 = new Date(1970, Month.January, 1);
    assertDateTime(dt3, "Thu Jan 01 1970 00:00:00 GMT+0100 (Greenwich Mean Time)");

    let dt4 = new Date(-504921600000);
    assertDateTime(dt4, "Fri Jan 01 1954 00:00:00 GMT+0000 (Greenwich Mean Time)");

    let dt5 = new Date(1974, Month.January, 1);
    assertDateTime(dt5, "Tue Jan 01 1974 00:00:00 GMT+0000 (Greenwich Mean Time)");
});
inTimeZone("Europe/Dublin", () => {
    let dt = new Date(0, Month.January, 1, 0, 0, 0, 0);
    dt.setFullYear(1970);
    assertEq(dt.getFullYear(), 1970);
});

// bug 937261
inTimeZone("Europe/Lisbon", () => {
    let dt = new Date(0, Month.January, 1, 0, 0, 0, 0);
    assertDateTime(dt, "Mon Jan 01 1900 00:00:00 GMT-0036 (Western European Standard Time)");

    dt.setFullYear(2015);
    assertDateTime(dt, "Thu Jan 01 2015 00:00:00 GMT+0000 (Western European Standard Time)");

    dt.setMonth(Month.November);
    assertDateTime(dt, "Sun Nov 01 2015 00:00:00 GMT+0000 (Western European Standard Time)");
});
inTimeZone("Europe/London", () => {
    let dt = new Date(0, Month.January, 1, 0, 0, 0, 0);
    assertDateTime(dt, "Mon Jan 01 1900 00:00:00 GMT+0000 (Greenwich Mean Time)");

    dt.setFullYear(2015);
    assertDateTime(dt, "Thu Jan 01 2015 00:00:00 GMT+0000 (Greenwich Mean Time)");

    dt.setMonth(Month.November);
    assertDateTime(dt, "Sun Nov 01 2015 00:00:00 GMT+0000 (Greenwich Mean Time)");
});

// bug 1079720
inTimeZone("Europe/Moscow", () => {
    let dt1 = new Date(2014, Month.January, 1);
    assertDateTime(dt1, "Wed Jan 01 2014 00:00:00 GMT+0400 (Moscow Standard Time)");
    assertEq(dt1.toISOString(), "2013-12-31T20:00:00.000Z");
    assertEq(dt1.getHours(), 0);

    let dt2 = new Date(2013, Month.January, 1);
    assertDateTime(dt2, "Tue Jan 01 2013 00:00:00 GMT+0400 (Moscow Standard Time)");

    let dt3 = new Date(new Date(2014, Month.December, 1).setMonth(Month.January));
    assertDateTime(dt3, "Wed Jan 01 2014 00:00:00 GMT+0400 (Moscow Standard Time)");
    assertEq(dt3.getFullYear(), 2014);

    let dt4 = new Date(2040, Month.April, 1);
    assertDateTime(dt4, "Sun Apr 01 2040 00:00:00 GMT+0300 (Moscow Standard Time)");

    let dt5 = new Date(2043, Month.April, 1);
    assertDateTime(dt5, "Wed Apr 01 2043 00:00:00 GMT+0300 (Moscow Standard Time)");

    let dt6 = new Date(2054, Month.April, 1);
    assertDateTime(dt6, "Wed Apr 01 2054 00:00:00 GMT+0300 (Moscow Standard Time)");

    let dt7 = new Date(2065, Month.April, 1);
    assertDateTime(dt7, "Wed Apr 01 2065 00:00:00 GMT+0300 (Moscow Standard Time)");

    let dt8 = new Date(2068, Month.April, 1);
    assertDateTime(dt8, "Sun Apr 01 2068 00:00:00 GMT+0300 (Moscow Standard Time)");

    let dt9 = new Date(2071, Month.April, 1);
    assertDateTime(dt9, "Wed Apr 01 2071 00:00:00 GMT+0300 (Moscow Standard Time)");

    let dt10 = new Date(2082, Month.April, 1);
    assertDateTime(dt10, "Wed Apr 01 2082 00:00:00 GMT+0300 (Moscow Standard Time)");

    let dt11 = new Date(2093, Month.April, 1);
    assertDateTime(dt11, "Wed Apr 01 2093 00:00:00 GMT+0300 (Moscow Standard Time)");

    let dt12 = new Date(2096, Month.April, 1);
    assertDateTime(dt12, "Sun Apr 01 2096 00:00:00 GMT+0300 (Moscow Standard Time)");

    let dt13 = new Date(2099, Month.April, 1);
    assertDateTime(dt13, "Wed Apr 01 2099 00:00:00 GMT+0300 (Moscow Standard Time)");
});

// bug 1107837
inTimeZone("Europe/Moscow", () => {
    let dt1 = new Date(2015, Month.January, 4);
    assertDateTime(dt1, "Sun Jan 04 2015 00:00:00 GMT+0300 (Moscow Standard Time)");

    let dt2 = new Date(2015, Month.January, 5);
    assertDateTime(dt2, "Mon Jan 05 2015 00:00:00 GMT+0300 (Moscow Standard Time)");

    let dt3 = new Date(2015, Month.January, 6);
    assertDateTime(dt3, "Tue Jan 06 2015 00:00:00 GMT+0300 (Moscow Standard Time)");

    let dt4 = new Date(2015, Month.January, 7);
    assertDateTime(dt4, "Wed Jan 07 2015 00:00:00 GMT+0300 (Moscow Standard Time)");

    let dt5 = new Date(2015, Month.January, 8);
    assertDateTime(dt5, "Thu Jan 08 2015 00:00:00 GMT+0300 (Moscow Standard Time)");

    let dt6 = new Date(2015, Month.January, 9);
    assertDateTime(dt6, "Fri Jan 09 2015 00:00:00 GMT+0300 (Moscow Standard Time)");
});

// bug 1122571
inTimeZone("Europe/Berlin", () => {
    const locale = "en-001";
    const opts = {timeZoneName: "long", hour12: false};

    let dt1 = new Date(1950, Month.March, 28);
    assertDateTime(dt1, "Tue Mar 28 1950 00:00:00 GMT+0100 (Central European Standard Time)");
    assertEq(dt1.toLocaleString(locale, opts), "28/03/1950, 00:00:00 GMT+01:00");

    let dt2 = new Date(1950, Month.July, 1);
    assertDateTime(dt2, "Sat Jul 01 1950 00:00:00 GMT+0100 (Central European Standard Time)");
    assertEq(dt2.toLocaleString(locale, opts), "01/07/1950, 00:00:00 GMT+01:00");

    let dt3 = new Date(1960, Month.March, 27);
    assertDateTime(dt3, "Sun Mar 27 1960 00:00:00 GMT+0100 (Central European Standard Time)");
    assertEq(dt3.toLocaleString(locale, opts), "27/03/1960, 00:00:00 GMT+01:00");

    let dt4 = new Date(1960, Month.March, 28);
    assertDateTime(dt4, "Mon Mar 28 1960 00:00:00 GMT+0100 (Central European Standard Time)");
    assertEq(dt4.toLocaleString(locale, opts), "28/03/1960, 00:00:00 GMT+01:00");

    let dt5 = new Date(1960, Month.March, 29);
    assertDateTime(dt5, "Tue Mar 29 1960 00:00:00 GMT+0100 (Central European Standard Time)");
    assertEq(dt5.toLocaleString(locale, opts), "29/03/1960, 00:00:00 GMT+01:00");

    let dt6 = new Date(1960, Month.July, 1);
    assertDateTime(dt6, "Fri Jul 01 1960 00:00:00 GMT+0100 (Central European Standard Time)");
    assertEq(dt6.toLocaleString(locale, opts), "01/07/1960, 00:00:00 GMT+01:00");

    let dt7 = new Date(1961, Month.July, 1);
    assertDateTime(dt7, "Sat Jul 01 1961 00:00:00 GMT+0100 (Central European Standard Time)");
    assertEq(dt7.toLocaleString(locale, opts), "01/07/1961, 00:00:00 GMT+01:00");

    let dt8 = new Date(1970, Month.March, 1);
    assertDateTime(dt8, "Sun Mar 01 1970 00:00:00 GMT+0100 (Central European Standard Time)");
    assertEq(dt8.toLocaleString(locale, opts), "01/03/1970, 00:00:00 Central European Standard Time");

    let dt9 = new Date(1970, Month.March, 27);
    assertDateTime(dt9, "Fri Mar 27 1970 00:00:00 GMT+0100 (Central European Standard Time)");
    assertEq(dt9.toLocaleString(locale, opts), "27/03/1970, 00:00:00 Central European Standard Time");

    let dt10 = new Date(1970, Month.March, 28);
    assertDateTime(dt10, "Sat Mar 28 1970 00:00:00 GMT+0100 (Central European Standard Time)");
    assertEq(dt10.toLocaleString(locale, opts), "28/03/1970, 00:00:00 Central European Standard Time");

    let dt11 = new Date(1970, Month.July, 1);
    assertDateTime(dt11, "Wed Jul 01 1970 00:00:00 GMT+0100 (Central European Standard Time)");
    assertEq(dt11.toLocaleString(locale, opts), "01/07/1970, 00:00:00 Central European Standard Time");
});

// bug 1143398
inTimeZone("Australia/Adelaide", () => {
    let dt = new Date(621000);
    assertDateTime(dt, "Thu Jan 01 1970 09:40:21 GMT+0930 (Australian Central Standard Time)");
    assertEq(dt.getUTCFullYear(), 1970);

    dt.setMilliseconds(dt.getMilliseconds());
    dt.setSeconds(dt.getSeconds());

    assertDateTime(dt, "Thu Jan 01 1970 09:40:21 GMT+0930 (Australian Central Standard Time)");
    assertEq(dt.getUTCFullYear(), 1970);
});
inTimeZone("America/Denver", () => {
    let dt = new Date(1446361200000);
    assertDateTime(dt, "Sun Nov 01 2015 01:00:00 GMT-0600 (Mountain Daylight Time)");

    assertEq(dt.getTime(), 1446361200000);
    dt.setMilliseconds(0);
    assertEq(dt.getTime(), 1446361200000);
});

// bug 1233809
inTimeZone("America/New_York", () => {
    let dt = new Date(1980, Month.March, 10);
    assertDateTime(dt, "Mon Mar 10 1980 00:00:00 GMT-0500 (Eastern Standard Time)");
});

// bug 1254041
inTimeZone("Asia/Ho_Chi_Minh", () => {
    let dt1 = new Date(Date.UTC(1969, Month.December, 31, 23, 0));
    assertDateTime(dt1, "Thu Jan 01 1970 07:00:00 GMT+0800 (Indochina Time)");
    assertEq(dt1.getTime(), -3600000);

    dt1.setMinutes(dt1.getMinutes() + 30);
    assertDateTime(dt1, "Thu Jan 01 1970 07:30:00 GMT+0800 (Indochina Time)");
    assertEq(dt1.getTime(), -1800000);

    dt1.setMinutes(dt1.getMinutes() + 30);
    assertDateTime(dt1, "Thu Jan 01 1970 08:00:00 GMT+0800 (Indochina Time)");
    assertEq(dt1.getTime(), 0);

    dt1.setMinutes(dt1.getMinutes() + 30);
    assertDateTime(dt1, "Thu Jan 01 1970 08:30:00 GMT+0800 (Indochina Time)");
    assertEq(dt1.getTime(), 1800000);

    dt1.setMinutes(dt1.getMinutes() + 30);
    assertDateTime(dt1, "Thu Jan 01 1970 09:00:00 GMT+0800 (Indochina Time)");
    assertEq(dt1.getTime(), 3600000);

    let dt2 = new Date(-1);
    assertEq(dt2.getTime(), -1);

    dt2.setMilliseconds(dt2.getMilliseconds() + 1);
    assertEq(dt2.getTime(), 0);

    dt2.setTime(1);
    assertEq(dt2.getTime(), 1);

    dt2.setMilliseconds(dt2.getMilliseconds() - 1);
    assertEq(dt2.getTime(), 0);

    dt2.setMilliseconds(dt2.getMilliseconds() - 1);
    assertEq(dt2.getTime(), -1);

    dt2.setMilliseconds(dt2.getMilliseconds() + 1);
    assertEq(dt2.getTime(), 0);

    dt2.setMilliseconds(dt2.getMilliseconds() + 3600000);
    assertEq(dt2.getTime(), 3600000);

    dt2.setMilliseconds(dt2.getMilliseconds() + (3600000 * 2 - 1));
    assertEq(dt2.getTime(), 3600000 * 3 - 1);

    dt2.setMilliseconds(dt2.getMilliseconds() + 1);
    assertEq(dt2.getTime(), 3600000 * 3);

    dt2.setMilliseconds(dt2.getMilliseconds() + (3600000 * 2));
    assertEq(dt2.getTime(), 3600000 * 5);

    let dt3 = new Date(0);
    assertDateTime(dt3, "Thu Jan 01 1970 08:00:00 GMT+0800 (Indochina Time)");

    let dt4 = new Date(-1);
    assertDateTime(dt4, "Thu Jan 01 1970 07:59:59 GMT+0800 (Indochina Time)");
});

// bug 1300197
inTimeZone("Europe/Dublin", () => {
    let dt = new Date(1910, Month.January, 1);
    assertDateTime(dt, "Sat Jan 01 1910 00:00:00 GMT-0025 (Greenwich Mean Time)");
});

// bug 1304774
inTimeZone("Europe/Zurich", () => {
    let dt = new Date(1986, Month.April, 4, 0, 0, 0, 0);
    assertDateTime(dt, "Fri Apr 04 1986 00:00:00 GMT+0200 (Central European Summer Time)");
    assertEq(dt.getTimezoneOffset(), -120);
});

// bug 1330307
inTimeZone("Europe/Moscow", () => {
    let dt = new Date(2012, Month.May, 14, 12, 13, 14);
    assertDateTime(dt, "Mon May 14 2012 12:13:14 GMT+0400 (Moscow Standard Time)");

    let dtf = new Intl.DateTimeFormat("en-US", {hour: "numeric", minute: "numeric"});
    assertEq(dtf.format(dt), "12:13 PM");
});
inTimeZone("Asia/Baku", () => {
    let dt = new Date(2012, Month.May, 14, 12, 13, 14);
    assertDateTime(dt, "Mon May 14 2012 12:13:14 GMT+0500 (Azerbaijan Summer Time)");

    let dtf = new Intl.DateTimeFormat("en-US", {hour: "numeric", minute: "numeric"});
    assertEq(dtf.format(dt), "12:13 PM");
});
inTimeZone("Asia/Tbilisi", () => {
    let dt = new Date(2012, Month.May, 14, 12, 13, 14);
    assertDateTime(dt, "Mon May 14 2012 12:13:14 GMT+0400 (Georgia Standard Time)");

    let dtf = new Intl.DateTimeFormat("en-US", {hour: "numeric", minute: "numeric"});
    assertEq(dtf.format(dt), "12:13 PM");
});

// bug 1335818
inTimeZone("Asia/Jerusalem", () => {
    let dt1 = new Date(2013, Month.March, 22, 1, 0, 0, 0);
    assertDateTime(dt1, "Fri Mar 22 2013 01:00:00 GMT+0200 (Israel Standard Time)");

    let dt2 = new Date(2013, Month.March, 22, 2, 0, 0, 0);
    assertDateTime(dt2, "Fri Mar 22 2013 02:00:00 GMT+0200 (Israel Standard Time)");

    let dt3 = new Date(2013, Month.March, 22, 3, 0, 0, 0);
    assertDateTime(dt3, "Fri Mar 22 2013 03:00:00 GMT+0200 (Israel Standard Time)");

    let dt4 = new Date(2013, Month.March, 29, 1, 0, 0, 0);
    assertDateTime(dt4, "Fri Mar 29 2013 01:00:00 GMT+0200 (Israel Standard Time)");

    let dt5 = new Date(2013, Month.March, 29, 2, 0, 0, 0);
    assertDateTime(dt5, "Fri Mar 29 2013 03:00:00 GMT+0300 (Israel Daylight Time)");

    let dt6 = new Date(2013, Month.March, 29, 3, 0, 0, 0);
    assertDateTime(dt6, "Fri Mar 29 2013 03:00:00 GMT+0300 (Israel Daylight Time)");
});

// bug 1342853
inTimeZone("America/Sao_Paulo", () => {
    let dt1 = new Date(2017, Month.October, 14, 12, 0, 0);
    assertDateTime(dt1, "Sat Oct 14 2017 12:00:00 GMT-0300 (Brasilia Standard Time)");
    assertEq(dt1.getTimezoneOffset(), 180);

    let dt2 = new Date(2017, Month.October, 15, 12, 0, 0);
    assertDateTime(dt2, "Sun Oct 15 2017 12:00:00 GMT-0200 (Brasilia Summer Time)");
    assertEq(dt2.getTimezoneOffset(), 120);

    let dt3 = new Date(2018, Month.February, 17, 12, 0, 0);
    assertDateTime(dt3, "Sat Feb 17 2018 12:00:00 GMT-0200 (Brasilia Summer Time)");
    assertEq(dt3.getTimezoneOffset(), 120);

    let dt4 = new Date(2018, Month.February, 18, 12, 0, 0);
    assertDateTime(dt4, "Sun Feb 18 2018 12:00:00 GMT-0300 (Brasilia Standard Time)");
    assertEq(dt4.getTimezoneOffset(), 180);

    let dt5 = new Date(2018, Month.November, 3, 12, 0, 0);
    assertDateTime(dt5, "Sat Nov 03 2018 12:00:00 GMT-0300 (Brasilia Standard Time)");
    assertEq(dt5.getTimezoneOffset(), 180);

    let dt6 = new Date(2018, Month.November, 4, 12, 0, 0);
    assertDateTime(dt6, "Sun Nov 04 2018 12:00:00 GMT-0200 (Brasilia Summer Time)");
    assertEq(dt6.getTimezoneOffset(), 120);

    let dt7 = new Date(2019, Month.February, 16, 12, 0, 0);
    assertDateTime(dt7, "Sat Feb 16 2019 12:00:00 GMT-0200 (Brasilia Summer Time)");
    assertEq(dt7.getTimezoneOffset(), 120);

    let dt8 = new Date(2019, Month.February, 17, 12, 0, 0);
    assertDateTime(dt8, "Sun Feb 17 2019 12:00:00 GMT-0300 (Brasilia Standard Time)");
    assertEq(dt8.getTimezoneOffset(), 180);
});

// bug 1365192
inTimeZone("America/Asuncion", () => {
    let dt = new Date(2018, Month.March, 31);
    assertDateTime(dt, "Sat Mar 31 2018 00:00:00 GMT-0400 (Paraguay Standard Time)");
    assertEq(dt.getTimezoneOffset(), 240);
});

// bug 1385643
inTimeZone("Europe/Warsaw", () => {
    let shortMonths = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
    let dtf = new Intl.DateTimeFormat("en-US", {month: "short"});

    for (let year = 1900; year <= 2100; ++year) {
        for (let month = Month.January; month <= Month.December; ++month) {
            let date = new Date(year, month, 1);
            assertEq(dtf.format(date), shortMonths[month]);
        }
    }
});

// bug 1401696
inTimeZone("Europe/Berlin", () => {
    let dt = new Date(1970, Month.January, 1, 0, 0, 0);
    assertDateTime(dt, "Thu Jan 01 1970 00:00:00 GMT+0100 (Central European Standard Time)");
});

// bug 1459842
inTimeZone("Europe/Moscow", () => {
    let dt1 = new Date(1004, Month.April, 1, 2, 0, 0);
    assertDateTime(dt1, "Sun Apr 01 1004 02:00:00 GMT+0230 (Moscow Standard Time)");
    assertEq(dt1.getHours(), 2);

    let dt2 = new Date(1004, Month.April, 1, 1, 0, 0);
    assertDateTime(dt2, "Sun Apr 01 1004 01:00:00 GMT+0230 (Moscow Standard Time)");
    assertEq(dt2.getHours(), 1);

    let dt3 = new Date(1004, Month.April, 1, 0, 0, 0);
    assertDateTime(dt3, "Sun Apr 01 1004 00:00:00 GMT+0230 (Moscow Standard Time)");
    assertEq(dt3.getHours(), 0);

    let dt4 = new Date(1004, Month.March, 1, 2, 0, 0);
    assertDateTime(dt4, "Thu Mar 01 1004 02:00:00 GMT+0230 (Moscow Standard Time)");
    assertEq(dt4.getHours(), 2);

    let dt5 = new Date(1004, Month.March, 1, 1, 0, 0);
    assertDateTime(dt5, "Thu Mar 01 1004 01:00:00 GMT+0230 (Moscow Standard Time)");
    assertEq(dt5.getHours(), 1);

    let dt6 = new Date(1004, Month.March, 1, 0, 0, 0);
    assertDateTime(dt6, "Thu Mar 01 1004 00:00:00 GMT+0230 (Moscow Standard Time)");
    assertEq(dt6.getHours(), 0);

});

// bug 1799638
inTimeZone("Asia/Tokyo", () => {
  let dt1 = new Date(1948, Month.May, 1, 23, 59, 59);
  assertDateTime(dt1, "Sat May 01 1948 23:59:59 GMT+0900 (Japan Standard Time)");
  assertEq(dt1.getTimezoneOffset(), -540);

  let dt2 = new Date(1948, Month.May, 1, 24, 0, 0);
  assertDateTime(dt2, "Sun May 02 1948 01:00:00 GMT+1000 (Japan Daylight Time)");
  assertEq(dt2.getTimezoneOffset(), -600);

  let dt3 = new Date(1948, Month.May, 1, 23, 59, 59, 1);
  assertDateTime(dt3, "Sat May 01 1948 23:59:59 GMT+0900 (Japan Standard Time)");
  assertEq(dt3.getTimezoneOffset(), -540);
});
inTimeZone("America/New_York", () => {
  let dt1 = new Date(1966, Month.April, 24, 1, 59, 59);
  assertDateTime(dt1, "Sun Apr 24 1966 01:59:59 GMT-0500 (Eastern Standard Time)");
  assertEq(dt1.getTimezoneOffset(), 300);

  let dt2 = new Date(1966, Month.April, 24, 2, 0, 0);
  assertDateTime(dt2, "Sun Apr 24 1966 03:00:00 GMT-0400 (Eastern Daylight Time)");
  assertEq(dt2.getTimezoneOffset(), 240);

  let dt3 = new Date(1966, Month.April, 24, 1, 59, 59, 1);
  assertDateTime(dt3, "Sun Apr 24 1966 01:59:59 GMT-0500 (Eastern Standard Time)");
  assertEq(dt3.getTimezoneOffset(), 300);
});

if (typeof reportCompare === "function")
    reportCompare(true, true);