I try to iterate every day after a month, but the for loop loops (in infinite mode):
var today = new Date();
var numberOfDaysInMonth = new Date( today.getFullYear(), lastMonth, 0 ).getDate();
...
for ( var date = new Date( today.getFullYear(), lastMonth, 1 ); date.getDate() <= numberOfDaysInMonth; date.setDate( date.getDate()+1 ) ) {
...
All parts of the for-loop arguments work as expected. If I replaced "<=" with only "<", on condition that the loop also works, but of course stops too early.
Does anyone have any ideas what could bring this cycle to infinity? I dont know...
source
share