930143666c
See https://github.com/tc39/proposal-intl-datetime-style Design Doc: https://goo.gl/v7n7zV Bug: v8:8702 Change-Id: If45a901e369003ded6c0c690a65f0429800d5ecc Reviewed-on: https://chromium-review.googlesource.com/c/1417372 Commit-Queue: Frank Tang <ftang@chromium.org> Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org> Reviewed-by: Jakob Kummerow <jkummerow@chromium.org> Cr-Commit-Position: refs/heads/master@{#59264}
34 lines
1003 B
JavaScript
34 lines
1003 B
JavaScript
// Copyright 2019 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.
|
|
|
|
// Flags: --harmony-intl-datetime-style
|
|
|
|
var validStyle = ["full", "long", "medium", "short", undefined];
|
|
var invalidStyle = ["narrow", "numeric"];
|
|
|
|
validStyle.forEach(function(dateStyle) {
|
|
validStyle.forEach(function(timeStyle) {
|
|
assertDoesNotThrow(() =>
|
|
new Intl.DateTimeFormat("en", {dateStyle, timeStyle}));
|
|
});
|
|
|
|
invalidStyle.forEach(function(timeStyle) {
|
|
assertThrows(() =>
|
|
new Intl.DateTimeFormat("en", {dateStyle, timeStyle}), RangeError);
|
|
});
|
|
}
|
|
);
|
|
|
|
invalidStyle.forEach(function(dateStyle) {
|
|
validStyle.forEach(function(timeStyle) {
|
|
assertThrows(() =>
|
|
new Intl.DateTimeFormat("en", {dateStyle, timeStyle}), RangeError);
|
|
});
|
|
invalidStyle.forEach(function(timeStyle) {
|
|
assertThrows(() =>
|
|
new Intl.DateTimeFormat("en", {dateStyle, timeStyle}), RangeError);
|
|
});
|
|
}
|
|
);
|