Utilities for working with week days and work days in Moment. It assumes a Western workweek, wherein weekends are Saturday and Sunday.
Moment is an indispensable tool for working with dates in Javascript, but it doesn't supply methods for working with week days or weekend days (at least, not yet).
This library supplies you with those missing tools.
There are alternative libraries for these methods, but this one supplies constant-time algorithms, whereas others tend to rely on loops. Loops are easier for a human to write, but they are much slower for a computer to process.
The above is actually a lie. The add and subtract methods use a looping algorithm right now, but I'm working on the constant time solution.
Calculate the number of work days between the moment and otherMoment
. Work days are Monday through Friday.
Calculate the number of weekend days between the moment and otherMoment
. Weekend days are Saturday and Sunday.
Add work days to a moment, modifying the original moment. Returns the moment.
Subtract work days from the moment, modifying the original moment. Returns the moment.