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
It would be nice to be able to pass any 2 dates to range() and call some method that will direct the dates so earlier date is start and later date is end no matter which order they were passed in to the range() function.
optionally direct() method might could take a parameter and if it's falsy or negative the range should be directed from later moment do earlier (Math.sign(b.diff(a)))
The text was updated successfully, but these errors were encountered:
We're looking at compiling all the breaking changes into the next major release (4.0.0) and I expect this feature will make a good candidate.
We thought the simplest approach was to make the constructor always perform this behaviour. I can't think of any reasons why you would ever want a reverse-time range? Even if a case does exist, it makes sense to keep the library working for forward ranges as the user can easily add their own application logic to keep track of it.
Now if interval is passed then it's implicitly directed: https://github.com/gf3/moment-range/blob/72e31df65da59e39dbde540c500d8d7da4f82995/lib/moment-range.js#L321-L323
but if 2
moment
objects are passed they are not. And there's no way to direct the range created that way.It would be nice to be able to pass any 2 dates to
range()
and call some method that will direct the dates so earlier date isstart
and later date isend
no matter which order they were passed in to therange()
function.It may work like this:
Suggested api:
optionally
direct()
method might could take a parameter and if it's falsy or negative the range should be directed from later moment do earlier (Math.sign(b.diff(a))
)The text was updated successfully, but these errors were encountered: