Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.monthBusinessWeeks subtract holidays #84

Open
FabriceReynolds opened this issue Mar 11, 2020 · 0 comments
Open

.monthBusinessWeeks subtract holidays #84

FabriceReynolds opened this issue Mar 11, 2020 · 0 comments

Comments

@FabriceReynolds
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant