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
const start = moment("2018-03-26");
const end = moment("2018-03-24");
const range = moment.range(start, end);
for(let day of range.by("day"))
{
console.log(day);
}
We have a PR open (targeting 5.0.0 release) which can be pushed into the upcoming 4.0.0 release that fixes this issue.
#201
This will automatically 'fix' your range so that the start is before the end moment.
If it is absolutely necessary for a backwards range, the user's application logic can be simply modified to remember if a range is backwards or forwards. The operations on a range should apply the same way regardless of time direction.
A fix for now would be to pre-sort that start < end before creating the range.
The following code doesn't behave as expected:
outputs
I would expect it to output
The text was updated successfully, but these errors were encountered: