Open hdoan741 opened 2 years ago
@manhhung741 Could you please advice which version do you use? I'm pretty sure it should throw an error if start date is after end date.
The version I'm using is "moment-weekday-calc": "^1.1.4",
I thought this code would flip start & end date if start > end date
https://github.com/andruhon/moment-weekday-calc/blob/master/src/moment-weekday-calc.js#L202-L207
There is a bizarre problem where the
weekdayCalc
is different when the start date & end date is reversed. Specifically, if start > end, some time the result is 1 day short of the correct value.In the source code, I could see that if start > end, their position are switched. The calculation should have been the same for both. I don't know how this could happen. See the example above.