[Intl] Fix special case timezone

Antarctica/DumontDUrville has special casing.

Bug: chromium:928068
Change-Id: I8aea2fafc2c14d6fbfee8a95910df7e8d7d1ff37
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1507329
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60108}
This commit is contained in:
Frank Tang 2019-03-06 21:55:22 -08:00 committed by Commit Bot
parent 6b0896abf7
commit 2cf79d12e8
2 changed files with 16 additions and 0 deletions

View File

@ -269,6 +269,7 @@ char LocaleIndependentAsciiToLower(char ch) {
// or ho_cHi_minH -> Ho_Chi_Minh. It is locale-agnostic and only // or ho_cHi_minH -> Ho_Chi_Minh. It is locale-agnostic and only
// deals with ASCII only characters. // deals with ASCII only characters.
// 'of', 'au' and 'es' are special-cased and lowercased. // 'of', 'au' and 'es' are special-cased and lowercased.
// Also "Antarctica/DumontDUrville" is special case.
// ICU's timezone parsing is case sensitive, but ECMAScript is case insensitive // ICU's timezone parsing is case sensitive, but ECMAScript is case insensitive
std::string ToTitleCaseTimezoneLocation(Isolate* isolate, std::string ToTitleCaseTimezoneLocation(Isolate* isolate,
const std::string& input) { const std::string& input) {
@ -296,6 +297,10 @@ std::string ToTitleCaseTimezoneLocation(Isolate* isolate,
return std::string(); return std::string();
} }
} }
// Special case
if (title_cased == "Antarctica/Dumontdurville") {
return "Antarctica/DumontDUrville";
}
return title_cased; return title_cased;
} }

View File

@ -0,0 +1,11 @@
// 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.
assertDoesNotThrow(
()=>(new Date().toLocaleString(
"en-US", {timeZone: "Antarctica/DumontDUrville"})));
assertDoesNotThrow(
()=>(new Date().toLocaleString(
"en-US", {timeZone: "antarctica/dumontdurville"})));