Browse Source

deps: backport bff3074 from V8 upstream

Original commit message:

    Allow ICU to normalize time zones

    There's at least one case of a time zone alias: Asia/Kathmandu aliases
    Asia/Katmandu. ICU seems to normalize to the (deprecated) latter choice.
    V8 internationalization choked on this change; this patch interprets
    ICU's output more precisely and allows it.

    BUG=chromium:487322
    R=jungshik,adamk
    LOG=Y

    Review URL: https://codereview.chromium.org/1509273007

    Cr-Commit-Position: refs/heads/master@{#32769}

PR-URL: https://github.com/nodejs/node/pull/15562
V8-icu-patch-4.x
Myles Borins 8 years ago
parent
commit
fa82d73d83
No known key found for this signature in database GPG Key ID: 933B01F40B5CA946
  1. 2
      deps/v8/include/v8-version.h
  2. 2
      deps/v8/src/i18n.js
  3. 13
      deps/v8/test/mjsunit/regress/regress-487322.js

2
deps/v8/include/v8-version.h

@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 4
#define V8_MINOR_VERSION 5
#define V8_BUILD_NUMBER 103
#define V8_PATCH_LEVEL 51
#define V8_PATCH_LEVEL 52
// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)

2
deps/v8/src/i18n.js

@ -1562,7 +1562,7 @@ function initializeDateTimeFormat(dateFormat, locales, options) {
var formatter = %CreateDateTimeFormat(
requestedLocale, {skeleton: ldmlString, timeZone: tz}, resolved);
if (!IS_UNDEFINED(tz) && tz !== resolved.timeZone) {
if (resolved.timeZone === "Etc/Unknown") {
throw MakeRangeError(kUnsupportedTimeZone, tz);
}

13
deps/v8/test/mjsunit/regress/regress-487322.js

@ -0,0 +1,13 @@
// Copyright 2015 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.
// Normalizes Kat{h,}mandu (chromium:487322)
df = new Intl.DateTimeFormat('en-US', {'timeZone': 'Asia/Katmandu'})
assertEquals('Asia/Katmandu', df.resolvedOptions().timeZone);
df = new Intl.DateTimeFormat('en-US', {'timeZone': 'Asia/Kathmandu'})
assertEquals('Asia/Katmandu', df.resolvedOptions().timeZone);
// Throws for unsupported time zones.
assertThrows(() => Intl.DateTimeFormat(undefined, {timeZone: 'Aurope/Paris'}));
Loading…
Cancel
Save