azuyalabs / yasumi

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

Mothering Sunday in the UK #266

Closed kennydude closed 2 years ago

kennydude commented 2 years ago

Mothers Day or, the british term, Mothering Sunday is on a different day to the default - https://en.wikipedia.org/wiki/Mothering_Sunday

It would be great if this could be added

stelgenhof commented 2 years ago

Hi @kennydude I've added Mothering Sunday for the United Kingdom. You can check/verify the changes in this branch: https://github.com/azuyalabs/yasumi/tree/feature/mothering-sunday

I am targeting this to include it in release 2.5.0 which I plan to release next week. Let me know if something is incorrect or missing.

Cheers!

stelgenhof commented 2 years ago

Feature completed. Work merged into the develop branch.

Jimbob001 commented 2 years ago

@stelgenhof Hi there, was about to write a separate issue when I saw this.

Mothering Sunday isn't classed as a "public holiday", albeit it being a null point given it's always on a Sunday! However, it looks odd appear in the standard holiday list with bank holidays etc.

I know better classification is in the works, to split out these sorts of days, but I wonder whether it's worth having in the standard list until then?

It also doesn't appear in the source cited in your documentation, if that's another factor: https://en.wikipedia.org/wiki/Public_holidays_in_the_United_Kingdom

stelgenhof commented 2 years ago

@Jimbob001 Mothering Sunday isn't classified as 'public' in Yasumi. See here: https://github.com/azuyalabs/yasumi/blob/master/src/Yasumi/Provider/UnitedKingdom.php#L376

Not sure what output or list you are looking at, however note that Yasumi will give you all registered holidays, irrespective of their classification. In case you need only the official (public) holidays, you should use the OffiicalHolidays filter, as explained here: https://www.yasumi.dev/docs/cookbook/filters/

The general documentation sources are in cited in the provider class file, as well as here: https://www.yasumi.dev/docs/providers/gb/ (Bottom of the page).

The source for Mothering day is not shown on the website, however documented with the respective calculation method.

Cheers! Sacha

Jimbob001 commented 2 years ago

@stelgenhof thank you for the response. I was using the standard unfiltered list. Setting to official holidays only gives me two results!

What I've done is manually filtered out the "other" type to remove this and potentially other additions. This matches up with what most people would expect in terms of whether this day counts towards holiday entitlement (which is my use case in a nutshell).

Many thanks for the help :)

stelgenhof commented 2 years ago

@Jimbob001 I checked myself and indeed it only results in two holidays. This is due the nature of the Filter classes in that they exclusively filter for that particular category.

For your use case, these filters may not give the results you need. Manually filtering out the 'other' holidays is then certainly a solution :) Or you could create your own filter doing all of that.

Cheers! Sacha