moment-business-days icon indicating copy to clipboard operation
moment-business-days copied to clipboard

.monthBusinessWeeks subtract holidays

Open FabriceReynolds opened this issue 4 years ago • 0 comments

When adding holidays such as from the documentation I would like to use the .monthBusinessWeeks api and receive an array of weeks minus the holidays so that I have true representation of what days of the month are working business days grouped by week. The current results gets all week days of a month grouped by week whether they are holidays or not.

var moment = require('moment-business-days');

var july4th = '07-04-2015';
var laborDay = '09-07-2015';

moment.updateLocale('us', {
   holidays: [july4th, laborDay],
   holidayFormat: 'MM-DD-YYYY'
});

var month = moment('09-01-2015', 'MM-DD-YYYY')
console.log(month.monthBusinessWeeks()[1].length) // -->  actual 5 expect 4 (minus laborDay )

Maybe I'm misunderstanding this but it would be useful to take into account holidays

Thanks

FabriceReynolds avatar Mar 11 '20 01:03 FabriceReynolds