Paying with new Date().toISOString()
, I observe an inconsistency in parsing of the same date in different string formats: 2020-01-01
and 2020/01/01
:
const opt1 = new Date("2020-01-01").toISOString();
document.write(`"2020-01-01": <b>${opt1}</b>`);
document.write("<br />");
const opt2 = new Date("2020/01/01").toISOString();
document.write(`"2020/01/01": <b>${opt2}</b>`);
I'm just curious, why 2020-01-01
and 2020/01/01
are parsed differently?