diff --git a/test/intl/regress-10526.js b/test/intl/regress-10526.js new file mode 100644 index 0000000000..4e6c79bdf0 --- /dev/null +++ b/test/intl/regress-10526.js @@ -0,0 +1,21 @@ +// 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 +// On Android, islamic-umalqura calendar is only available on ar and fa locales. +let dateOK = new Date (Date.UTC(-195366, 6, 23)); +let dateKO = new Date (Date.UTC(-195366, 6, 22)); +let dateDisplay = new Intl.DateTimeFormat ( + 'ar-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("الأربعاء، 17 ذو الحجة ‎-202003 هـ", + dateDisplay.format(dateOK), "dateDisplay.format(dateOK)"); +assertEquals("الثلاثاء، 16 ذو الحجة ‎-202003 هـ", + dateDisplay.format(dateKO), "dateDisplay.format(dateKO)"); diff --git a/test/intl/regress-10527.js b/test/intl/regress-10527.js new file mode 100644 index 0000000000..f01131b756 --- /dev/null +++ b/test/intl/regress-10527.js @@ -0,0 +1,30 @@ +// 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 +// On Android, islamic and islamic-rgsac calendar are only available on ar +// and fa locales. +let dateOK = new Date (Date.UTC(622, 6, 18)); +let dateKO = new Date (Date.UTC(622, 6, 17)); +let dateDisplay = new Intl.DateTimeFormat ( + 'ar-u-ca-islamic', + { timeZone : 'UTC', year : 'numeric', month :'long', + day : 'numeric', weekday : 'long' }); +let dateDisplay2 = new Intl.DateTimeFormat ( + 'ar-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("الخميس، 1 محرم 1 هـ", + dateDisplay.format(dateOK), "dateDisplay.format(dateOK)"); +assertEquals("الأربعاء، 30 ذو الحجة 0 هـ", + dateDisplay.format(dateKO), "dateDisplay.format(dateKO)"); +assertEquals("الخميس، 1 محرم 1 هـ", + dateDisplay2.format(dateOK), "dateDisplay.format(dateOK)"); +assertEquals("الأربعاء، 30 ذو الحجة 0 هـ", + dateDisplay2.format(dateKO), "dateDisplay.format(dateKO)"); diff --git a/test/intl/regress-10528.js b/test/intl/regress-10528.js new file mode 100644 index 0000000000..59194b0a7c --- /dev/null +++ b/test/intl/regress-10528.js @@ -0,0 +1,20 @@ +// 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 +// On Android, hebrew calendar is only available on he locale. +let dateOK = new Date (Date.UTC(-3760, 8, 7)); +let dateKO = new Date (Date.UTC(-3760, 8, 6)); +let dateDisplay = new Intl.DateTimeFormat ( + 'he-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("יום שני, 1 בתשרי 1", + dateDisplay.format(dateOK), "dateDisplay.format(dateOK)"); +assertEquals("יום ראשון, 29 באלול 0", + dateDisplay.format(dateKO), "dateDisplay.format(dateKO)"); diff --git a/test/intl/regress-10529.js b/test/intl/regress-10529.js new file mode 100644 index 0000000000..5cb0fbd5bf --- /dev/null +++ b/test/intl/regress-10529.js @@ -0,0 +1,20 @@ +// 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 +// On Android, indian calendar is only available on hi locale. +let dateOK = new Date ("0001-12-31T23:52:58.000Z"); +let dateKO = new Date ("0000-12-30T23:52:58.000Z"); +let dateDisplay = new Intl.DateTimeFormat ( + 'hi-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("शक -77 पौष 10, सोमवार", + dateDisplay.format(dateOK), "dateDisplay.format(dateOK)"); +assertEquals("शक -78 पौष 9, शनिवार", + dateDisplay.format(dateKO), "dateDisplay.format(dateKO)");