You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is not a bug. Each time you call .add(), you're updating the value of now to be the result of that addition. E.g. when i=2, you're adding 2 days to the previous result, which was Sunday. That's why the new result is Tuesday.
If you don't want to change the value of now, then you should create a copy with .clone() before changing the value with .add(...). In your example you'd want to do this on every loop iteration: now.clone().add(i, "days")
We're planning to change this behavior in 3.0 later this year. The tracking issue for that change is #1754.
this image explains it
http://i.imgur.com/pBWzdBZ.png
The text was updated successfully, but these errors were encountered: