New issue
Advanced search Search tips

Issue 840062 link

Starred by 4 users

Issue metadata

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



Sign in to add a comment

Date/time formatting ignores system locale

Reported by matthijs...@gmail.com, May 5 2018

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36

Example URL:

Steps to reproduce the problem:
Any form that uses an input[type="date"] or input[type="time"] element, and any javascript that uses one of the Date.prototype.toLocale*String

What is the expected behavior?
The date/time should be formatted according to my system locale, or alternatively Chrome should offer some way to customize it.

This blog post claims the format is "obtained from the operating system's setting": https://developers.google.com/web/updates/2012/08/Quick-FAQs-on-input-type-date-in-Google-Chrome

The date/time formatting strings returned by nl_langinfo() on my system are:
nl_langinfo(D_FMT) = "%Y-%m-%d"
nl_langinfo(T_FMT) = "%H:%M:%S"

Current date and time formatted by strftime:
~$ date +'%x, %X'
2018-05-05, 04:35:18
~$ date +'%c'
Sat 05 May 2018 04:35:19 CEST

What went wrong?
Chrome uses american date/time formatting instead of the system locale format:
> (new Date).toLocaleDateString()
< "5/5/2018"
> (new Date).toLocaleTimeString()
< "4:26:26 AM"

Does it occur on multiple sites: Yes

Is it a problem with a plugin? No 

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 65.0.3325.181  Channel: stable
OS Version: Debian sid
Flash Version:
 
Labels: Needs-Milestone

Comment 2 by bokan@chromium.org, May 7 2018

Components: -Blink Blink>JavaScript>Internationalization

Comment 3 by bokan@chromium.org, May 7 2018

Cc: bokan@chromium.org
Status: Available (was: Unconfirmed)

Sign in to add a comment