moment-business-days-diff
This is a Moment.js plugin that allows you to work with only business days (Monday to Friday). You can customize the working week
Usage
// NodeJS: require instead of standard moment packageconst moment = ;// You'll be able use Moment.js as you normally do
<!-- Browser --><!-- NB: add after moment.js -->
Use localization to configure business days
const moment = ; moment; // Defines days from 1 (Monday) to 6 (Saturday) as business days.// When omitting this configuration parameter, business days are based on locale default
API
.isBusinessDay()
=> boolean
Check if the date is a business day and return true or false:
// 2018-09-17 is Monday // true // 2018-09-20 is Sunday // false
.businessDiff()
=> number
Calculate the number of business days between dates.
const diff = ;// diff = 5
.countBusinessDaysInDaysFromDate()
=> number
Calculate the number of business days in next given days
const count = ;// count = 5