Let your date libaray like Moment.js can count holidays!
- configurable workdays (default: Mon. -> Fri.)
- configurable holidays
- configurable make-up days
- support Moment.js
- support Day.js
- support date-fns
- fully tests
# use npm
yarn add business-day
# use npm
npm i business-day
import moment from 'moment'
import { MomentCore as BusinessDay } from 'business-day'
// 2020-12-01 (Tuesday), 2020-12-02 (Wednesday)
BusinessDay.setConfig({ holidays: ['2020-12-01'] })
const day1 = moment('2020-11-30')
console.log(BusinessDay.addBusinessDays(day1.toDate(), 1))
// Moment<2020-12-02T00:00:00+08:00>
BusinessDay.setConfig({ holidays: ['2020-12-01', '2020-12-02'] })
const day2 = moment('2020-11-30')
console.log(BusinessDay.addBusinessDays(day2.toDate(), 1))
// Moment<2020-12-03T00:00:00+08:00>