Commit fb63e5cf authored by Frank Tang's avatar Frank Tang Committed by Commit Bot

[Intl] Fix output of hour:'2-digit', hour12: true

Bug: chromium:527926
Change-Id: I783ba59c6e4b117163e058032fb04283e1f43c46
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1529260Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60379}
parent cdda5dea
...@@ -896,7 +896,8 @@ std::unique_ptr<icu::SimpleDateFormat> CreateICUDateFormat( ...@@ -896,7 +896,8 @@ std::unique_ptr<icu::SimpleDateFormat> CreateICUDateFormat(
// has to be discussed. Revisit once the spec is clarified/revised. // has to be discussed. Revisit once the spec is clarified/revised.
icu::UnicodeString pattern; icu::UnicodeString pattern;
UErrorCode status = U_ZERO_ERROR; UErrorCode status = U_ZERO_ERROR;
pattern = generator.getBestPattern(skeleton, status); pattern = generator.getBestPattern(skeleton, UDATPG_MATCH_HOUR_FIELD_LENGTH,
status);
CHECK(U_SUCCESS(status)); CHECK(U_SUCCESS(status));
// Make formatter from skeleton. Calendar and numbering system are added // Make formatter from skeleton. Calendar and numbering system are added
......
// 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.
let date = new Date(2015, 8, 1, 3, 0, 0);
var fmt = new Intl.DateTimeFormat('ru', {hour:'2-digit', minute: '2-digit'})
assertEquals("03:00", fmt.format(date));
fmt = new Intl.DateTimeFormat(
'en', {hour:'2-digit', minute: '2-digit', hour12: false});
assertEquals("03:00", fmt.format(date));
fmt = new Intl.DateTimeFormat(
'ru', {hour:'2-digit', minute: '2-digit', hour12: false});
assertEquals("03:00", fmt.format(date));
fmt = new Intl.DateTimeFormat(
'ru', {hour:'2-digit', minute: '2-digit', hour12: true});
assertEquals("03:00 AM", fmt.format(date));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment