Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript date, is this my error or did I find a bug?

I have a section of simple Javascript in my application that has a link "Add Day", which adds 1 day to a date. It always works perfectly, except when the date gets to be 11/07/2010, and then the link suddenly will not work any longer. Its really wierd, because it only hangs up on the specific date of 11/07/2010.

How to reproduce error:

  1. Navigate to the page here
  2. On any date field, click "Today", or just set the date to today.
  3. Click "Add Day" until you get to 11/07/2010
  4. Now clicking "Add Day" does not work anymore!
like image 454
davidjhp Avatar asked Nov 05 '10 20:11

davidjhp


1 Answers

The problem is that you're adding the 24 hours to the date to add one day; Daylight Savings Time has thwarted you because 24 hours after 00:00 on November 7th will be 23:00 (for the second time) on November 7th.

like image 83
Adam Maras Avatar answered Sep 22 '22 08:09

Adam Maras