Commit 915f729a authored by Frank Tang's avatar Frank Tang Committed by Commit Bot

Add regression tests for 4 calendar bugs

These bugs was fixed by ICU68

Bug: v8:10526, v8:10527, v8:10528, v8:10529
Change-Id: I8d0dcb52d849f742e0a29314ac8a148370f60a1a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2527086Reviewed-by: 's avatarShu-yu Guo <syg@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71062}
parent ffaac6bb
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Test date format in islamic-umalqura calendar of date prior to
// -195366-07-23
let dateOK = new Date (Date.UTC(-195366, 6, 23));
let dateKO = new Date (Date.UTC(-195366, 6, 22));
let dateDisplay = new Intl.DateTimeFormat (
'en-GB-u-ca-islamic-umalqura',
{ timeZone : 'UTC', year : 'numeric', month :'long',
day : 'numeric', weekday : 'long' });
assertEquals("Wed, 23 Jul -195366 00:00:00 GMT",
dateOK.toUTCString(), "dateOK.toUTCString()");
assertEquals("Tue, 22 Jul -195366 00:00:00 GMT",
dateKO.toUTCString(), "dateKO.toUTCString()");
assertEquals("Wednesday 17 Dhuʻl-Hijjah -202003",
dateDisplay.format(dateOK), "dateDisplay.format(dateOK)");
assertEquals("Tuesday 16 Dhuʻl-Hijjah -202003",
dateDisplay.format(dateKO), "dateDisplay.format(dateKO)");
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Test date format in Islamic and Islamic-rgsa calendars of dates prior
// to 0622-07-18
let dateOK = new Date (Date.UTC(622, 6, 18));
let dateKO = new Date (Date.UTC(622, 6, 17));
let dateDisplay = new Intl.DateTimeFormat (
'en-GB-u-ca-islamic',
{ timeZone : 'UTC', year : 'numeric', month :'long',
day : 'numeric', weekday : 'long' });
let dateDisplay2 = new Intl.DateTimeFormat (
'en-GB-u-ca-islamic-rgsa',
{ timeZone : 'UTC', year : 'numeric', month :'long',
day : 'numeric', weekday : 'long' });
assertEquals("Thu, 18 Jul 0622 00:00:00 GMT",
dateOK.toUTCString(), "dateOK.toUTCString()");
assertEquals("Wed, 17 Jul 0622 00:00:00 GMT",
dateKO.toUTCString(), "dateKO.toUTCString()");
assertEquals("Thursday, Muharram 1, 1 AH",
dateDisplay.format(dateOK), "dateDisplay.format(dateOK)");
assertEquals("Wednesday, Dhuʻl-Hijjah 30, 0 AH",
dateDisplay.format(dateKO), "dateDisplay.format(dateKO)");
assertEquals("Thursday 1 Muharram 1",
dateDisplay2.format(dateOK), "dateDisplay.format(dateOK)");
assertEquals("Wednesday 30 Dhuʻl-Hijjah 0",
dateDisplay2.format(dateKO), "dateDisplay.format(dateKO)");
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Test date format in Hebrew calendar of dates prior to -003760-09-07
let dateOK = new Date (Date.UTC(-3760, 8, 7));
let dateKO = new Date (Date.UTC(-3760, 8, 6));
let dateDisplay = new Intl.DateTimeFormat (
'en-GB-u-ca-hebrew',
{ timeZone : 'UTC', year : 'numeric', month :'long',
day : 'numeric', weekday : 'long' });
assertEquals("Mon, 07 Sep -3760 00:00:00 GMT",
dateOK.toUTCString(), "dateOK.toUTCString()");
assertEquals("Sun, 06 Sep -3760 00:00:00 GMT",
dateKO.toUTCString(), "dateKO.toUTCString()");
assertEquals("Monday, 1 Tishri 1",
dateDisplay.format(dateOK), "dateDisplay.format(dateOK)");
assertEquals("Sunday, 29 Elul 0",
dateDisplay.format(dateKO), "dateDisplay.format(dateKO)");
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Test date format in Indian calendar of date prior to 0001-01-01
let dateOK = new Date (Date.UTC(0, 0, 1));
dateOK.setFullYear(1);
let dateKO = new Date (Date.UTC(0, 11, 31));
dateKO.setFullYear(0);
let dateDisplay = new Intl.DateTimeFormat (
'en-GB-u-ca-indian',
{ timeZone : 'UTC', year : 'numeric', month :'long',
day : 'numeric', weekday : 'long' });
assertEquals("Mon, 31 Dec 0001 23:52:58 GMT",
dateOK.toUTCString(), "dateOK.toUTCString()");
assertEquals("Sat, 30 Dec 0000 23:52:58 GMT",
dateKO.toUTCString(), "dateKO.toUTCString()");
assertEquals("Monday 10 Pausa -77",
dateDisplay.format(dateOK), "dateDisplay.format(dateOK)");
assertEquals("Saturday 9 Pausa -78",
dateDisplay.format(dateKO), "dateDisplay.format(dateKO)");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment