New Date on Edge

I have an issue with this date but not quite sure why this is happening.

const a = something.toLocaleString(); // 2024/04/04, 3:17:07 p.m.
const b = a.replace(/-/g,"/"); // 2024/04/04, 3:17:07 p.m.
const x = new Date(b); // Invalid Date 

Why does this work in Chrome but not in Edge or Firefox

See ‘Date time string format’ here:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#date_time_string_format

1 Like