I am a bit stumped as to why, given the same date, but in a different format Javascript alters the time by one hour.
new Date("1969-12-22")
Date Mon Dec 22 1969 01:00:00 GMT+0100 (Greenwich Mean Time)
new Date("1969/12/22")
Date Mon Dec 22 1969 00:00:00 GMT+0100 (Greenwich Mean Time)
Notice the time in the first example is one hour ahead of the time in the second, but the date is exactly the same, just in a different format.
The problem this gives me is that I am unable to use .getTime()
to compare timestamps for equality.
Does anyone know why the extra hour?