vacanza / python-holidays

Generate and work with holidays in Python
https://pypi.org/project/holidays
MIT License
1.43k stars 457 forks source link

HK holiday , 30 September 2022 (The day following the Chinese Mid-Autumn Festival) problem, day of the Mid-Autumn Festival not a holiday , only (T+1) is the public holiday! #778

Closed magggzzz closed 1 year ago

magggzzz commented 1 year ago

It cannot show the day following the Chinese Mid-Autumn Festival for 30 sept 2022

2022-09-10 Chinese Mid-Autumn Festival day of the Mid-Autumn Festival , it itself is not a holiday , only the day after it (T+1) is the public holiday

i think the logic should be : if "the day following the Chinese Mid-Autumn Festival" lays on a Sunday , then there will be ""The second weekday after Chinese Mid-Autumn Festival "

MAYBE this can be changed to

    # Chinese Mid-Autumn Festival
    name = "Chinese Mid-Autumn Festival"
    first_after_mid_autumn= "The day following the " + name
    second_after_mid_autumn = "The second following the " + name

    dt = self.cnls.lunar_to_gre(year, 8, 15)
    mid_autumn_date = date(dt.year, dt.month, dt.day)

    if self.observed:
        if mid_autumn_date.weekday() == SAT:
            self[mid_autumn_date + rd(days=+1)] = first_after_mid_autumn
            self[mid_autumn_date + rd(days=+2)] = second_after_mid_autumn 
        else:
            self[mid_autumn_date + rd(days=+1)] = first_after_mid_autumn
        mid_autumn_date = mid_autumn_date + rd(days=+1)
    else:
        self[mid_autumn_date + rd(days=+1)] = first_after_mid_autumn
dr-prodigy commented 1 year ago

Hi @magggzzz this should be fixed with #779 (now merged in beta). Could you please confirm? Thx!

magggzzz commented 1 year ago

hi @dr-prodigy , checked , confirm working fine, thank you very much, but the day of mid autumn it self is not a public holiday

poshingchu commented 1 year ago

Hi @magggzzz , the situation is like this: 3 Oct 2009 (SAT) is Chinese Mid-Autumn Festival and GOV set the same day as public holiday. 10 Sep 2022 (SAT) is Chinese Mid-Autumn Festival and GOV set the 12 Sep 2022 (MON) as public holiday.

779 added speiacl case for this situation on 2022, further may need to add the case depend on the GOV if Chinese Mid-Autumn Festival on saturday and GOV set the public holiday to next monday.

REF: https://www.gov.hk/en/about/abouthk/holiday/2009.htm https://www.gov.hk/en/about/abouthk/holiday/2022.htm

magggzzz commented 1 year ago

HI, @poshingchu , it is not a special case

it has always been like this , the day of mid autumn , is not a holiday , only the following day is public holiday !

ref: https://www.elegislation.gov.hk/hk/cap149?xpid=ID_1438402723242_002

poshingchu commented 1 year ago

Hi @magggzzz , you mean that 2022 is not a special case, 2009 is. And want to switch? As my understand, point (o) can negotiate but more chance to set public holiday on Monday if Chinese Mid-Autumn Festival lies on Saturday. The next Chinese Mid-Autumn Festival lies on Saturday will be 22 Sep 2029.

magggzzz commented 1 year ago

hi @dr-prodigy ,

so both of them are not special case

from 1983 to 2010, the gov 's logic was : if mid autumn lies on a sat , i.e.: the following day is a sunday , then the mid autumn day ITSELF will be a full day public holiday

from 2011 HK government change the logic : if mid autumn lies on a sat , i.e.: the following day is a sunday , then INSTEAD of making the mid autumn day ITSELF will be a full day public holiday, the next non holiday work day will be made into a public holiday

(or if that day is a Sunday, then the second day following that Festival) or such other day as the Chief Executive in Council may, Special case only occurs when and if other wise appointed by the Chief Executive in Council

poshingchu commented 1 year ago

Hi @magggzzz and @dr-prodigy , #782 is fixed branch, if have other concern please sugguest. Otherwise this case can be closed.

dr-prodigy commented 1 year ago

Thank you @poshingchu , closing! 👍