The code is written in Vue 2 and when the component is mounted it sets the date of the variables of from and to.
from is initialized with month's first date while to with the current date. The code was working fine a week ago and is still working fine on my machine which runs Linux. But on clients PC which run windows 11 it is giving
The specified value "2/17/2023" does not conform to the required format, "yyyy-MM-dd"
because of this on date has to be selected manually.
I've tried setting date with toISOString() method
var date = new Date();
var firstDay = new Date(date.getFullYear(), date.getMonth(), 1);
// this.from = firstDay.toLocaleDateString('en-CA');
var from = firstDay.toISOString().substring(0, 10)
console.log(from)
I've also checked for specific date format with regex and if true converted it to converted it to asked format and also changed the date format of client PC to yyyy-MM-dd but still not working.
In early 2023, the major browsers (Safari so far excepted) have picked up bug 16399 introduced during 2022 into the Unicode Common Locale Data Repository. The bug has set en-CA
numeric date format to American date format instead of the Canadian standard YYYY-MM-DD format.
A workaround until unicode and the browsers are fixed is to use "fr-CA" date format instead, for numeric dates.