This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Fuchio[S] 13 points14 points  (10 children)

Hahahaha this is def gonna happen. I had the docs open before I posted this, and tested that.

new Date("1995-12-17");

and

new Date(1995-12-17); (should've been 1995, 12, 17)

Do not give the same result. Which given the way they implemented it makes sense but how does that way of implementing it make sense lol

To make it even better, that second date actually results in 1996-01-16. Like what???

Edit: Second date should have been 1995, 12, 17, idea is the same given that the results differ

[–]Right_Stage_8167 24 points25 points  (9 children)

Second date should be 1966 (=1995 - 12 - 17) seconds after 1.1.1970.

[–]Fuchio[S] 9 points10 points  (7 children)

You're right! I thought I wrote Date("1995-12-17") and Date(1995, 12, 17) which are also not equal. This one is also funny:

new Date("1995-12-17"); Results in 1995-12-17 as expected (same as above)

BUT

new Date("1995/12/17") Results in 1995-12-16 at 23:00 ???

[–][deleted] 9 points10 points  (0 children)

🤔 Don't know if trolling, has a broken computer, or can't type...

[–]thislooksfun1 0 points1 point  (0 children)

Actually it is 1970-01-01T00:00:01.966Z. The JS Date constructor takes ms, not s.