python-holidays icon indicating copy to clipboard operation
python-holidays copied to clipboard

Add `include_sundays` flag to `country_holidays()`

Open NickiForte opened this issue 1 year ago • 3 comments

Feature Request

Description

The include_sundays flag is already available in country classes for some countries, as e.g. Sweden:

https://github.com/vacanza/holidays/blob/df5c0bc6baf08677d145fefd9041d11990455d75/holidays/countries/sweden.py#L39

It would be of great help if this flag would also be available in the country_holidays function, used like this:

import holidays
holidays.country_holidays("SE", years=2021, include_sundays=False)

because now Sundays are included for some countries and not for others, and this flag would allow for a more consistent behaviour.

Related Issues

Proposed Solution

Should be very easy to add, given that the flag is already implemented in country-specific classes where applicable.

Additional context

NickiForte avatar Oct 22 '24 14:10 NickiForte

We've just discussed this recently in https://github.com/vacanza/holidays/issues/1654

As far as I know this special parameter exists for NO and SE only.

Holidays has always been open to community members' suggestions. Personally I was planning to get rid of the include_sundays in v1 if possible. However, if we want to keep/extend it then we must do it in a right way.

Some perspectives to consider:

  • do we want to make it include_weekends
  • or maybe have 2 separate include_saturdays. include_sundays
  • some countries have/had weekends on different days (e.g., (FRI, SAT), or (THU, FRI)

If it's just a matter of consistency I'd prefer to wait until https://github.com/vacanza/holidays/issues/1654 is resolved and make a decision after that (remove the flag if possible).

If it's something that'd be useful for the end users -- let's discuss.

@NickiForte looking forward to hearing your thoughts and thanks for raising this!

arkid15r avatar Oct 24 '24 02:10 arkid15r

At least from the perspective of my company, we are only interested in holidays other than Sundays (if we wanted Sundays we could very easily get them without this package). I find it confusing that Sundays are included for Sweden but not for other countries, because for all practical purposes, there is nothing special about Sundays in Sweden (apart from maybe some constitutional definition that bears no practical implication). Also, it caused a bug for us when Sundays coincided with other holidays and the name of the holiday changed, e.g. "Julafton; Söndag".

So regardless of if we want to use include_weekends or include_sundays, I think the default should be False to make it consistent with other countries. But then again, I don't know in which ways others use this package.

NickiForte avatar Oct 24 '24 12:10 NickiForte

I'm going to keep it open just in case somebody wants to help with this.

arkid15r avatar Dec 18 '24 01:12 arkid15r