Closed Bug 1820377 Opened 2 years ago Closed 2 years ago

Method toLocaleDateString("en-CA") of class Date returns incorrect format

Categories

(Core :: JavaScript: Standard Library, defect)

Firefox 110
x86_64
All
defect

Tracking

()

RESOLVED DUPLICATE of bug 1818103

People

(Reporter: brelocare, Unassigned)

Details

Overview:
When using the en-CA locale in Firefox and calling the method toLocaleDateString() (or when directly passing the locale to the method), the string returned by the method is a date formatted as mm/dd/YYYY which is least common for this locale. The more common format is YYYY-MM-DD (as it has been in previous versions of Firefox, and preferred by the Canadian government), or the slightly less common DD-MM-YYYY.

Build ID:
20230214051806

Additional Builds and Platforms:
The following tested on Linux with different Firefox versions downloaded from https://ftp.mozilla.org/pub/firefox/releases/[VERSION]/linux-x86_64/en-CA/

  • Does NOT occur on: 90.0, 105.0, 106.0, 107.0, 108.0, 109.0, 109.0.1, 109.0b6, 109.0b8, 109.0b9 (Build ID: 20230105190654)
  • DOES occur on: 110.0.1 (Build ID: 20230227191043), 111.0b8 (Build ID: 20230302185836), 112.0a1 (Build ID: 20230304095224) (Nightly)

Steps to consistently reproduce:

  • Open the console in Web Developer Tools and instantiate a new Date
    let myDate = new Date()
  • Call the method toLocaleDateString and pass the Canadian English locale string
    myDate.toLocaleDateString("en-CA")

Expected result:
The returned string should be a date formatted as YYYY-MM-DD

Actual result:
The returned string is a date formatted as mm/dd/YYYY

Additional Details:
This seems to be directly caused by this CLDR issue.

Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Duplicate of bug: 1818103
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.