My JavaScript code is set up to show the current date in en-CA
format.
date = new Date();
console.log(date.toLocaleDateString('en-CA'));
In the past, dates in the en-CA
locale were displayed as yyyy-MM-dd
(2023-02-24). However, suddenly today these dates are being shown as M/d/yyyy
(2/24/2023) without any changes made to the code. I have tested this on two different computers using Chrome, Firefox, and Edge on Windows 10 & 11.
I am puzzled as to why the en-CA
locale changed the date formatting to display as M/d/yyyy
instead of yyyy-MM-dd
. What could be the reason for this sudden change?