New issue
Advanced search Search tips

Issue 865351 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Sep 14
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac
Pri: 2
Type: Bug



Sign in to add a comment

Intl.DateTimeFormat.prototype.formatToParts() return wrong type for 'dayPeriod'

Reported by han.guo...@gmail.com, Jul 19

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36

Steps to reproduce the problem:
var format = new Intl.DateTimeFormat('en-US', {hour:'numeric', minute:'numeric', second:'numeric', timeZoneName: "long" });
console.log(format.formatToParts(new Date()));

What is the expected behavior?
the return type of 'dayPeriod' should be 'dayPeriod' rather than 'dayperiod'.

Reference:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat and https://tc39.github.io/ecma402/#sec-Intl.DateTimeFormat.prototype.formatToParts

What went wrong?
On chrome, the one of types in result of Intl.DateTimeFormat.prototype.formatToParts() is 'dayperiod', but it should be 'dayPeriod', the upper case 'P'.

In my test, this issue is on Chrome from stable(67.0.3396.99) to Canary(69.0.3495.0). But it is the correct value on Firefox(61.0b14) and Safari(11.1.2).

Did this work before? No 

Does this work in other browsers? Yes

Chrome version: 67.0.3396.99  Channel: stable
OS Version: OS X 10.13.6
Flash Version:
 
Components: Blink>JavaScript
Labels: Needs-Triage-M67
Cc: susan.boorgula@chromium.org
Labels: Triaged-ET M-69 Target-69 FoundIn-69 OS-Linux OS-Windows
Status: Untriaged (was: Unconfirmed)
han.guokai@ Thanks for the issue.

Able to reproduce this issue on Windows 10, Mac OS 10.13.3 and Ubuntu 17.10 on the reported version 67.0.3396.99 and the latest Canary 69.0.3496 as per the original comment.
Attached is the screen shot for reference.

This is a Non-Regression issue as this behavior is observed from M-60 chrome builds.
Hence marking this as Untriaged for further updates from Dev.

Thanks..
865351-M60.png
148 KB View Download
For some reason, there is not test for the legal "type" values...
I am trying to add one -
https://github.com/tc39/test262/pull/1645
If it is not accepted due to Contributor License Agreement issues, anyone may feel free to take the code without any credit and add a test.
Components: -Blink>JavaScript Blink>JavaScript>Internationalization
Status: Available (was: Untriaged)
Project Member

Comment 7 by bugdroid1@chromium.org, Sep 14

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/53de7345bd7eabafdb65d875fea8eebbc28e9701

commit 53de7345bd7eabafdb65d875fea8eebbc28e9701
Author: PhistucK <phistuck@gmail.com>
Date: Fri Sep 14 17:04:03 2018

[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}
[modify] https://crrev.com/53de7345bd7eabafdb65d875fea8eebbc28e9701/AUTHORS
[modify] https://crrev.com/53de7345bd7eabafdb65d875fea8eebbc28e9701/src/heap-symbols.h
[modify] https://crrev.com/53de7345bd7eabafdb65d875fea8eebbc28e9701/src/objects/js-date-time-format.cc
[modify] https://crrev.com/53de7345bd7eabafdb65d875fea8eebbc28e9701/test/intl/date-format/date-format-to-parts.js
[modify] https://crrev.com/53de7345bd7eabafdb65d875fea8eebbc28e9701/test/test262/test262.status

Labels: -M-69 M-71 OS-Android OS-Chrome
Owner: phistuck@chromium.org
Status: Fixed (was: Available)
Unless this is reverted, this fix will be released in the upcoming Chrome 71 (around December).

Workaround - for now, check for both of the strings (dayPeriod and dayperiod).

Sign in to add a comment