azuyalabs / yasumi

The easy PHP Library for calculating holidays
https://www.yasumi.dev
Other
1.05k stars 155 forks source link

Flag original dates for observed days #212

Closed jbroudou closed 4 years ago

jbroudou commented 4 years ago

When an observed day (i.e. holidays that are moved because they are on a weekend) is returned would it possible to flag what the original date was rather than relying on a string suffix?

Also, in some locations when a holiday falls on a weekend, it is moved to a weekday as an observed day. In some of these locations only the observed day is considered a holiday whereas in others both the observed and original days are considered holidays. This is an important distinction in some jurisdictions.

Is there any chance of supporting an additional flag against observed holidays that indicate the original day is or isn't a holiday?

stelgenhof commented 4 years ago

The common way of implementing this behavior is that both the original and observed/substituted holiday are registered in the Holiday Provider. This is to have the possible to refer to the original holiday (rather than simply replacing it). The substituted holiday will indeed have a string suffix however is a considered a different day.

I think what you are requesting is already in place. Is there perhaps a situation where it is not the case at the moment?

Cheers! Sacha

jbroudou commented 4 years ago

I see that the substituted holidays are typically suffixed with a string such as "Observed" or "Holiday", but I'm not certain that this is always the case. I was hoping for a property against the substitute day that explicitly states what the original date was.

Cheers

c960657 commented 4 years ago

Substituted holidays are represented with the Yasumi\SubstituteHoliday subclass. You can access the original holiday, i.e. the day being substituted, via the $substitutedHoliday property.

github-actions[bot] commented 4 years ago

This issue has been open 60 days with no activity. Please remove the stale label or comment, or this will be closed in 10 days.

github-actions[bot] commented 4 years ago

This issue has been open 60 days with no activity. Please remove the stale label or comment, or this will be closed in 10 days.

stelgenhof commented 4 years ago

Closing this issue has Yasumi has a way of separating Substituted Holidays and the original substituted holiday.