Commit 53de7345 authored by PhistucK's avatar PhistucK Committed by Commit Bot

[Intl] Rename dayperiod to dayPeriod

Previously, DateTimeFormat.prototype.formatToParts returned an object
with the property key 'dayperiod' which is incorrect as per the spec.
This patch updates the property key to say 'dayPeriod', making this spec
compliant.

R=cira@chromium.org

Bug: chromium:865351
Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
Change-Id: I37f50797387bc69d5e29d7c2911bc5cc0fad37ac
Reviewed-on: https://chromium-review.googlesource.com/1145304Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: PhistucK <phistuck@gmail.com>
Cr-Commit-Position: refs/heads/master@{#55922}
parent 0390eef8
......@@ -132,6 +132,7 @@ Peter Rybin <peter.rybin@gmail.com>
Peter Varga <pvarga@inf.u-szeged.hu>
Peter Wong <peter.wm.wong@gmail.com>
Paul Lind <plind44@gmail.com>
PhistucK <phistuck@gmail.com>
Qingyan Li <qingyan.liqy@alibaba-inc.com>
Qiuyi Zhang <qiuyi.zqy@alibaba-inc.com>
Rafal Krypa <rafal@krypa.net>
......
......@@ -56,7 +56,7 @@
V(Date_string, "Date") \
V(date_to_string, "[object Date]") \
V(day_string, "day") \
V(dayperiod_string, "dayperiod") \
V(dayPeriod_string, "dayPeriod") \
V(decimal_string, "decimal") \
V(default_string, "default") \
V(defineProperty_string, "defineProperty") \
......
......@@ -906,7 +906,7 @@ Handle<String> IcuDateFieldIdToDateType(int32_t field_id, Isolate* isolate) {
case UDAT_STANDALONE_DAY_FIELD:
return isolate->factory()->weekday_string();
case UDAT_AM_PM_FIELD:
return isolate->factory()->dayperiod_string();
return isolate->factory()->dayPeriod_string();
case UDAT_TIMEZONE_FIELD:
case UDAT_TIMEZONE_RFC_FIELD:
case UDAT_TIMEZONE_GENERIC_FIELD:
......
......@@ -5,14 +5,16 @@
var d = new Date(2016, 11, 15, 14, 10, 34);
var df = Intl.DateTimeFormat("ja",
{hour: 'numeric', minute: 'numeric', second: 'numeric', year: 'numeric',
month: 'numeric', day: 'numeric', timeZoneName: 'short', era: 'short'});
month: 'numeric', day: 'numeric', timeZoneName: 'short', era: 'short',
hour12: true});
var formattedParts = df.formatToParts(d);
var formattedReconstructedFromParts = formattedParts.map((part) => part.value)
.reduce((accumulated, part) => accumulated + part);
assertEquals(df.format(d), formattedReconstructedFromParts);
// 西暦2016年11月15日 14:10:34 GMT-7
// 西暦2016年11月15日 午後02:10:34 GMT-7
assertEquals(["era", "year", "literal", "month", "literal", "day", "literal",
"hour", "literal", "minute", "literal", "second", "literal",
"timeZoneName"], formattedParts.map((part) => part.type));
"dayPeriod", "hour", "literal", "minute", "literal", "second",
"literal", "timeZoneName"
], formattedParts.map((part) => part.type));
......@@ -608,9 +608,6 @@
'language/expressions/async-generator/generator-created-after-decl-inst': [FAIL],
'language/statements/async-generator/generator-created-after-decl-inst': [FAIL],
# https://bugs.chromium.org/p/chromium/issues/detail?id=865351
'intl402/DateTimeFormat/prototype/formatToParts/main': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=8099
'intl402/NumberFormat/prototype/format/format-negative-numbers': [FAIL],
......
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