New issue
Advanced search Search tips

Issue 838800 link

Starred by 2 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug



Sign in to add a comment

Problme with getISOString on Date object created without leading zero

Reported by david.bl...@gmail.com, May 2 2018

Issue description

UserAgent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0

Steps to reproduce the problem:
var date = new Date('2018-5-03'); console.log(date.toDateString()); console.log(date.toLocaleDateString()); console.log(date.toISOString());

VM479:1 Thu May 03 2018
VM479:1 3.5.2018
VM479:1 2018-05-02T22:00:00.000Z
undefined

var date = new Date('2018-05-03'); console.log(date.toDateString()); console.log(date.toLocaleDateString()); console.log(date.toISOString());

VM480:1 Thu May 03 2018
VM480:1 3.5.2018
VM480:1 2018-05-03T00:00:00.000Z

var date = new Date('2018-10-03'); console.log(date.toDateString()); console.log(date.toISOString()); 

VM634:1 Wed Oct 03 2018
VM634:1 2018-10-03T00:00:00.000Z

What is the expected behavior?
like var date = new Date('2018-05-03'); date.toISOString();
var date = new Date('2018-5-03'); date.toISOString();

should return
2018-05-03T00:00:00.000Z

What went wrong?
var date = new Date('2018-5-03'); date.toISOString();
2018-05-02T22:00:00.000Z

Month without a leading zero were interpreted as an time shift offset -2h which represents an unexpected behavior especially because it only can have an effect of 9 months

Did this work before? N/A 

Chrome version: 64.0.3282.167  Channel: n/a
OS Version: 16.04 LTS
Flash Version: 	28.0.0.126
 

Comment 1 by e...@chromium.org, May 2 2018

Components: -Blink Blink>JavaScript>API
Labels: Needs-Milestone
Components: -Blink>JavaScript>API Blink>JavaScript>Internationalization
Status: Available (was: Unconfirmed)

Sign in to add a comment