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

Extend `weekend` patterns

Open PPsyrius opened this issue 9 months ago • 2 comments

There are cases where an entity's weekend arrangements might not simply be days of the week i.e. SAT, SUN or FRI, SAT but something else, while not in use nowadays was used historically i.e.

  • Taiwan's "Every Sunday, 2nd and 4th Saturday of the month" Arrangements in 1998-2000: [1] [2] [3] Image

  • Thailand's "Every Sunday and Every Buddhist Sabbath Day" as used between 1956-1957 (IMO allowing manual addition of weekends might be easier in this particular implementation) [1] [2] Image

These features are nice to have, but not urgently needed as none of the 160+ entities currently adopt such weekend arrangements.

PPsyrius avatar Mar 15 '25 04:03 PPsyrius

  • Taiwan's "Every Sunday, 2nd and 4th Saturday of the month" Arrangements in 1998-2000
  • Thailand's "Every Sunday and Every Buddhist Sabbath Day" as used between 1956-1957

In this case, I think the most practical approach would be to override _is_weekend() method (in second case, the implementation will be a little more... complicated 😉).

KJhellico avatar Mar 16 '25 14:03 KJhellico

In this case, I think the most practical approach would be to override _is_weekend() method (in second case, the implementation will be a little more... complicated 😉).

I'll look into this myself later for Taiwan's case, though it's probably for the best to simply leave the 2nd one alone for now.

PPsyrius avatar Mar 16 '25 16:03 PPsyrius

Seems that it's easier to implement support for such patterns now, with #2945.

KJhellico avatar Sep 20 '25 14:09 KJhellico