New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 794170 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner:
Closed: Jan 3
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug



Sign in to add a comment

Wrong begavior Intl.DateTimeFormat.prototype.format function

Reported by a.v.kaza...@gmail.com, Dec 12 2017

Issue description

Chrome Version       : 63.0.3239.84 (8f51ed0e633e109109762a3deb18a50e8c138819-refs/branch-heads/3239@{#643})
URLs (if applicable) : https://jsfiddle.net/f82aw0ea/1/
Other browsers tested:
     Safari: unknown
    Firefox: FAIL
       Edge: unknown

What steps will reproduce the problem?
1) Open developer console, and type next commands
2) let date = new Date();
3) date.setHours(1,2,3,4);
4) console.log(Intl.DateTimeFormat('en-US', {hour12: false, hour: 'numeric'}).format(date)); // Expect: "1" Actual: "01"
5) console.log(Intl.DateTimeFormat('en-US', {hour12: true, hour: '2-digit'}).format(date)); // Expect: "01 AM" Actual: "1 AM"
6) console.log(Intl.DateTimeFormat('en-US', {minute: '2-digit'}).format(date)); // Expect: "02" Actual: "2"
7) console.log(Intl.DateTimeFormat('en-US', {second: '2-digit'}).format(date)); // Expect: "02" Actual: "2"

What is the expected result?
For step #4 expecting output "1"
For step #5 expecting output "01 AM"
For step #5 expecting output "02"
For step #5 expecting output "02"

What happens instead?
For step #4 actual value output is "01"
For step #5 actual value output is "1 AM"
For step #5 actual value output is "2"
For step #5 actual value output is "2"

Implementation of that algorithm required flow described in http://www.ecma-international.org/ecma-402/1.0/#sec-12.3.2
 

Comment 1 by subhm...@gmail.com, Dec 12 2017

Dj subhmkor
Sorry. The correct description is:

Chrome Version       : 63.0.3239.84 (8f51ed0e633e109109762a3deb18a50e8c138819-refs/branch-heads/3239@{#643})
URLs (if applicable) : https://jsfiddle.net/f82aw0ea/1/
Other browsers tested:
     Safari: unknown
    Firefox: FAIL
       Edge: unknown

What steps will reproduce the problem?
1) Open developer console, and type next commands
2) let date = new Date();
3) date.setHours(1,2,3,4);
4) console.log(Intl.DateTimeFormat('en-US', {hour12: false, hour: 'numeric'}).format(date)); // Expect: "1" Actual: "01"
5) console.log(Intl.DateTimeFormat('en-US', {hour12: true, hour: '2-digit'}).format(date)); // Expect: "01 AM" Actual: "1 AM"
6) console.log(Intl.DateTimeFormat('en-US', {minute: '2-digit'}).format(date)); // Expect: "02" Actual: "2"
7) console.log(Intl.DateTimeFormat('en-US', {second: '2-digit'}).format(date)); // Expect: "03" Actual: "3"

What is the expected result?
For step #4 expecting output "1"
For step #5 expecting output "01 AM"
For step #6 expecting output "02"
For step #7 expecting output "03"

What happens instead?
For step #4 actual value output is "01"
For step #5 actual value output is "1 AM"
For step #6 actual value output is "2"
For step #7 actual value output is "3"

Implementation of that algorithm required flow described in http://www.ecma-international.org/ecma-402/1.0/#sec-12.3.2
Components: Blink>JavaScript>Internationalization
Labels: Needs-Triage-M63
Cc: sc00335...@techmahindra.com
Labels: -Pri-3 M-65 Triaged-ET OS-Linux OS-Mac OS-Windows Pri-2
Status: Untriaged (was: Unconfirmed)
Able to reproduce this issue on reported version 63.0.3239.84 and on latest canary 65.0.3292.0 using Windows 10, Mac 10.13.1 and Ubuntu 14.04 with steps mentioned in comment#0.

This issue is seen from M50[50.0.2661.0]. Hence considering this issue as Non-Regression and marking as Untriaged.

NOTE:Same behaviour is seen in Firefox as well.
Status: Available (was: Untriaged)
Project Member

Comment 7 by sheriffbot@chromium.org, Jan 2

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Owner: ftang@chromium.org
Status: Assigned (was: Untriaged)
Spidermonkey and JSC agree with V8 but Chakra has a different result.

➜  eshost -ts _test.js                                                                                                              
                                                                                                                                                              
┌────────────────┬───────┐                                                                                                                                    
│ JavaScriptCore │ 01    │                                                                                                                                    
│ SpiderMonkey   │ 1 AM  │                                                                                                                                    
│ V8             │ 2     │                                                                                                                                    
│                │ 3     │                                                                                                                                    
├────────────────┼───────┤                                                                                                                                    
│ Chakra         │ 01    │                                                                                                                                    
│                │ 01 AM │                                                                                                                                    
│                │ 02    │                                                                                                                                    
│                │ 03    │                                                                                                                                    
└────────────────┴───────┘                                                                                                                                    

Frank, can you confirm if our answer is correct?
Status: Started (was: Assigned)
Status: WontFix (was: Started)
These behavior are conducted as in the "BasicFormatMatcher operation". 
WaI
In that case value, "2-digits" for formatting value does not make sense. Because for "formatMatcher" with values "basic" and "best fit" have the same values.

Mine expecting with value "2-digits": looks like two digits, instead of one. Please, correct me, if I'm wrong.
> In that case value, "2-digits" for formatting value does not make sense. Because for "formatMatcher" with values "basic" and "best fit" have the same values.

The spec allows "best fit" to be implementation defined as long as it's as good as the "basic" option. IIRC, V8 just uses BasicFormatMatcher as its BestFitFormatMatcher.



Sign in to add a comment