business icon indicating copy to clipboard operation
business copied to clipboard

Add extra_holidays key when creating a Calendar

Open Quintasan opened this issue 4 years ago • 1 comments

In some countries, like Poland, when a public holiday occurs on a Saturday, the employer has to pick a working day which will be a holiday. Adding extra_holidays key will allow people to adjust to things like that on a per-case basis.

Quintasan avatar Mar 05 '20 22:03 Quintasan

@danielroseman I'm not sure if this isn't out of scope but I thought it would be a good idea to allow people to add extra holidays when they use a predefined calendar. WDYT?

Quintasan avatar Mar 06 '20 11:03 Quintasan

From this diff, I (a fellow library user, not a maintainer) don’t see what extra_holidays provides that holidays doesn’t already provide. I think it would be simpler for your code that creates a Business::Calendar to add your extra holidays to the array passed as the holidays parameter:

STANDARD_HOLIDAYS = ['2022-12-24', '2022-12-25']
HOLIDAYS_OBSERVED_ON_WEEKDAYS = ['2022-12-23', '2022-12-26'] # what you called extra_holidays
Business::Calendar.new(holidays: STANDARD_HOLIDAYS + HOLIDAYS_OBSERVED_ON_WEEKDAYS)

roryokane avatar Dec 09 '22 03:12 roryokane