New issue
Advanced search Search tips

Issue 920608 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner:
Closed: Jan 11
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

Input[type="date"] returns wrong date via valueAsDate property. It is off by one day. For example: 2018-02-01 will be 2018-01-31 when accessed via valueAsDate property.

Reported by aaronkl...@gmail.com, Jan 10

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36

Steps to reproduce the problem:
1. Create input with type="date" set value="2018-02-01"
2. console.log(input.valueAsDate.toLocaleString())
3. returns wrong date of 2018-01-31 instead of 2018-02-01

What is the expected behavior?
valueAsDate should return the proper date that matches the input value.

What went wrong?
input.valueAsDate returns the wrong date. The date is off by one.

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 71.0.3578.98  Channel: stable
OS Version: 10.0
Flash Version:
 
DateBug.zip
785 bytes Download
I just would like to note, that it seems the latest version of FireFox and Edge are affected by this as well - on the latest version of Windows 10.
Labels: Needs-Triage-M71
Components: -Blink>Forms Blink>Forms>Date
Owner: tkent@chromium.org
Status: WontFix (was: Unconfirmed)
According to the HTML standard, valueAsDate returns a Date instance for 00:00 UTC of the value's date.  So if your local timezone is later than UTC, toLocaleString() shows the previous date by default.  You can show the expected date by adding { timeZone:'UTC' } argument to toLocaleString().

Sign in to add a comment