I'm incrementing one day (24*60*60) to a particular date in javascript until it is greater than today' date in order to achieve a process runs every 24 hours. but because of the EST/EDT shift, the schedule reduces by 1 hour. how to fix this..?
var now = new Date();
var next = some past date ;
var incr = 24 * 60 * 60 * 1000 ;
while (next < now) {
next = new Date (next.valueOf() + incr);
}
return next ;
say for example, i keep past date as '01-Sep-2015 00:00:00'. when the date moves to Nov 2nd 2015, due to 1 hour time shift on 1st Nov 2015, the next value sets as '01-Nov-2015 23:00:00' . The reason why it was incremented with value is because the requirement wants it to be flexible to increase by any number of hours. Say, the process may need to run every 6 hours, then we will change the increment to 6 * 60 * 60 * 1000
please help.