v8/test/intl/regress-10529.js
Frank Tang 915f729afb 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/+/2527086
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71062}
2020-11-09 23:50:24 +00:00

22 lines
932 B
JavaScript

// 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)");