I got a strange issue with Wix DatePicker control. Please follow the code below;
const date = $w("#datePicker2").value;
const options = {
day: "numeric",
month: "short",
year: "numeric"
};
var birthDate = new Date(date.toLocaleDateString("en-US", options));
console.log(birthDate.getDate());
console.log(1+birthDate.getMonth());
console.log(birthDate.getFullYear());
I am forced to use 1+ for a month for a correct value and strangely the getDate() returns a value for the date starting from 02-Jan-1982 on wards. Any date chosen before 02-Jan-1982 is one date less from the chosen date.
For e.g.
when i select 01-Jan-1982 then console log is;
31
12
1981
when i select 02-Jan-1982 then console log is;
02
01
1982
The DatePicker control requires a 360 testing from 1900 or the control is unreliable at this time. I can be wrong, please check advise.