
Originally Posted by
12345c
If it was so, JS would allow a mistake in the summer (in 1 hour)
It will:
Code:
var D = new Date(2005, 9, 29, 12), /* Sat., 29 Oct. 2005 12:00 */
Dp = new Date(+D + 864e5); /* Sun., 30 Oct. 2005 11:00 */
D.setDate(D.getDate() + 1); /* Sun., 30 Oct. 2005 12:00 */
As you can see, there is a difference between the resulting times. Whilst the millisecond addition will advance the Date object by twenty-four hours, the next civil days is actually in twenty-five hours time due to the DST transition.
When people consider 'tomorrow' or a 'week from now', they are thinking in civil days not precisely twenty-four or 168 hours.
Mike
Bookmarks