Skip to content

Utilities for working with week days and work days in Moment. (Western workweeks only.)

License

Notifications You must be signed in to change notification settings

megawac/moment-business

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

moment-business

Travis build status Code Climate Test Coverage Dependency Status devDependency Status

Utilities for working with week days and work days in Moment. It assumes a Western workweek, wherein weekends are Saturday and Sunday.

Motivation

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.

Why this library?

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.

FAQ

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.

API

workDays( otherMoment )

Calculate the number of work days between the moment and otherMoment. Work days are Monday through Friday.

weekendDays( otherMoment )

Calculate the number of weekend days between the moment and otherMoment. Weekend days are Saturday and Sunday.

addWorkDays( amount )

Add work days to a moment, modifying the original moment. Returns the moment.

subtractWorkDays( amount )

Subtract work days from the moment, modifying the original moment. Returns the moment.

About

Utilities for working with week days and work days in Moment. (Western workweeks only.)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%