I'm experiencing this issue in both Node.js v16.20.2 and in a browser console:
> new Date(Date.parse('0001-01-01'))0001-01-01T00:00:00.000Z
Ok i expected this. Now consider this:
> new Date(Date.parse('0001-01-01 00:00:00'))2000-12-31T23:00:00.000Z
Euhm, year 2000??
This works just fine:
> new Date(Date.parse('0001-01-01T00:00:00Z'))2000-12-31T23:00:00.000Z
EDIT: I'm looking for an explanation of why this behavior happens. I'm not looking for a fix, i know how to fix it.