[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/1145304
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: PhistucK <phistuck@gmail.com>
Cr-Commit-Position: refs/heads/master@{#55922}
This commit is contained in:
PhistucK 2018-09-12 16:54:30 +00:00 committed by Commit Bot
parent 0390eef826
commit 53de7345bd
5 changed files with 9 additions and 9 deletions

View File

@ -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>

View File

@ -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") \

View File

@ -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:

View File

@ -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));

View File

@ -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],