skip to Main Content

JavaScript parsing year 1 as 2000

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 Year 2000? This works just fine: > new Date(Date.parse('0001-01-01T00:00:00Z')) 0001-01-01T00:00:00.000Z I…

VIEW QUESTION
Back To Top
Search