Skip to content

Commit

Permalink
deps: backport bff3074 from V8 upstream
Browse files Browse the repository at this point in the history
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: #15562
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Steven R Loomis <srloomis@us.ibm.com>
  • Loading branch information
MylesBorins committed Oct 25, 2017
1 parent e064ae6 commit 43d1ac3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion deps/v8/include/v8-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.)
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
13 changes: 13 additions & 0 deletions deps/v8/test/mjsunit/regress/regress-487322.js
Original file line number Diff line number Diff line change
@@ -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'}));

0 comments on commit 43d1ac3

Please sign in to comment.