예제 #1
0
    def _populate(self, year):
        """
        # Function to store the holiday name in the appropriate
        # date and to shift the Public holiday in case it happens
        # on a Saturday(Weekend)
        # (NOT USED)
        def is_weekend(self, hol_date, hol_name):
            if hol_date.weekday() == FRI:
                self[hol_date] = hol_name + " [Friday]"
                self[hol_date + rd(days=+2)] = "Sunday following " + hol_name
            else:
                self[hol_date] = hol_name
        """

        # New Year's Day
        self[date(year, JAN, 1)] = "Nouvel an"

        # Labour Day
        self[date(year, MAY, 1)] = "Fête du travail"

        # Fête de l'indépendance
        self[date(year, JUN, 27)] = "Fête de l'indépendance"
        self[date(year, JUN, 28)] = "Fête de l'indépendance"

        # Isra wal Miraj
        # The night journey of the prophet Muhammad
        for date_obs in islamic_to_gre(year, 7, 27):
            hol_date = date_obs
            self[hol_date] = "Isra wal Miraj"

        # Eid al-Fitr - Feast Festive
        # date of observance is announced yearly, This is an estimate since
        # having the Holiday on Weekend does change the number of days,
        # deceided to leave it since marking a Weekend as a holiday
        # wouldn't do much harm.
        for date_obs in islamic_to_gre(year, 10, 1):
            hol_date = date_obs
            self[hol_date] = "Eid al-Fitr"
            self[hol_date + rd(days=1)] = "Eid al-Fitr deuxième jour"

        # Arafat & Eid al-Adha - Scarfice Festive
        # date of observance is announced yearly
        for date_obs in islamic_to_gre(year, 12, 9):
            hol_date = date_obs
            self[hol_date] = "Arafat"
            self[hol_date + rd(days=1)] = "Eid al-Adha"
            self[hol_date + rd(days=2)] = "Eid al-Adha deuxième jour"

        # Islamic New Year - (hijari_year, 1, 1)
        for date_obs in islamic_to_gre(year, 1, 1):
            hol_date = date_obs
            self[hol_date] = "Nouvel an musulman"

        # Prophet Muhammad's Birthday - (hijari_year, 3, 12)
        for date_obs in islamic_to_gre(year, 3, 12):
            hol_date = date_obs
            self[hol_date] = "Naissance du prophet Muhammad"
예제 #2
0
    def my_islamic_to_gre(self, year: int, month: int, day: int):
        """
        Malaysia seems to have a slightly different Hijri calendar. This
        function returns the adjusted date.

        Only knows years 2000 to 2030.

        :param year: The Gregorian year.
        :param Hmonth: The Hijri (Islamic) month.
        :param Hday: The Hijri (Islamic) day.
        :return: List of Gregorian dates within the year matching the hijri day
           month, adjusted for Malaysia.
        """
        hol_dates = islamic_to_gre(year, month, day)
        if year in (
                2003,
                2004,
                2010,
                2011,
                2013,
                2017,
                2019,
                2021,
                2024,
                2025,
                2027,
        ):
            hol_dates = [
                hol_date + timedelta(days=1) for hol_date in hol_dates
            ]
        return hol_dates
예제 #3
0
    def _populate(self, year):

        # 1st of Jan
        self[date(year, JAN, 1)] = "New Year's Day"

        # 23rd of Apr
        self[date(year, APR, 23)] = "National Sovereignty and Children's Day"

        # 1st of May
        self[date(year, MAY, 1)] = "Labour Day"

        # 19th of May
        self[date(year, MAY, 19)] = (
            "Commemoration of Ataturk, Youth and " "Sports Day"
        )

        # 15th of Jul
        # Became a national holiday after 15 Jul 2016 coup d'etat attempt.
        if year > 2016:
            self[date(year, JUL, 15)] = "Democracy and National Unity Day"

        # 30th of Aug
        self[date(year, AUG, 30)] = "Victory Day"

        # 29th of Oct
        self[date(year, OCT, 29)] = "Republic Day"

        # Ramadan Feast
        # Date of observance is announced yearly, This is an estimate.
        for date_obs in islamic_to_gre(year, 10, 1):
            hol_date = date_obs
            self[hol_date] = "Ramadan Feast"
            self[hol_date + rd(days=1)] = "Ramadan Feast Holiday"
            self[hol_date + rd(days=2)] = "Ramadan Feast Holiday"

        # Sacrifice Feast
        # Date of observance is announced yearly, This is an estimate.
        for date_obs in islamic_to_gre(year, 12, 10):
            hol_date = date_obs
            self[hol_date] = "Sacrifice Feast"
            self[hol_date + rd(days=1)] = "Sacrifice Feast Holiday"
            self[hol_date + rd(days=2)] = "Sacrifice Feast Holiday"
            self[hol_date + rd(days=3)] = "Sacrifice Feast Holiday"
예제 #4
0
    def _populate(self, year):
        """Populate the holidays for a given year

        All holidays get observed on weekdays if they fall on weekends, but
        this has not been implemented as yet.
        """
        # New Year's holiday (3 days)
        self[date(year, JAN, 1)] = "New Year"
        self[date(year, JAN, 2)] = "New Year Holiday"
        self[date(year, JAN, 3)] = "New Year Holiday"

        # Orthodox Christmas
        self[date(year, JAN, 7)] = "Orthodox Christmas"

        # Women's Day
        self[date(year, MAR, 8)] = "Women's Day"

        # Nauryz Holiday (3 days)
        self[date(year, MAR, 21)] = "Nauryz"
        self[date(year, MAR, 22)] = "Nauryz Holiday"
        self[date(year, MAR, 23)] = "Nauryz Holiday"

        # People Solidarity Holiday
        self[date(year, MAY, 1)] = "People's Solidarity Day"

        # Defender's Day
        self[date(year, MAY, 7)] = "Defender's Day"

        # Victory Day
        self[date(year, MAY, 9)] = "Victory Day"

        # Capital City Day
        self[date(year, JUL, 6)] = "Capital City Day"

        # Kurban Ait
        for hol_date in islamic_to_gre(year, 12, 10):
            self[hol_date] = "Kurban Ait"

        # Constitution Day
        self[date(year, AUG, 30)] = "Constitution Day"

        # First President Day
        self[date(year, DEC, 1)] = "First President Day"

        # Independence Day (2 days)
        self[date(year, DEC, 16)] = "Independence Day"
        self[date(year, DEC, 17)] = "Independence Day Holiday"
예제 #5
0
    def _populate(self, year):
        """
        # Function to store the holiday name in the appropriate
        # date and to shift the Public holiday in case it happens
        # on a Saturday(Weekend)
        # (NOT USED)
        def is_weekend(self, hol_date, hol_name):
            if hol_date.weekday() == FRI:
                self[hol_date] = hol_name + " [Friday]"
                self[hol_date + rd(days=+2)] = "Sunday following " + hol_name
            else:
                self[hol_date] = hol_name
        """

        # New Year's Day
        self[date(year, JAN, 1)] = "Nouvel an - Premier janvier"

        # Independence Manifesto Day post 1944
        if year > 1944:
            self[date(year, JAN, 11)] = ("Commémoration de la présentation "
                                         "du manifeste de l'indépendance")

        # Labor day
        self[date(year, MAY, 1)] = "Fête du Travail"

        # Throne day
        if year > 2000:
            self[date(year, JUL, 30)] = "Fête du Trône"
        elif year > 1962:
            self[date(year, MAR, 3)] = "Fête du Trône"
        else:
            self[date(year, NOV, 18)] = "Fête du Trône"

        # Oued Ed-Dahab Day
        self[date(year, AUG, 14)] = "Journée de Oued Ed-Dahab"

        # Revolution Day
        self[date(year, AUG, 20)] = ("Commémoration de la révolution du "
                                     "Roi et du peuple")

        # Youth day
        if year > 2000:
            self[date(year, AUG, 21)] = "Fête de la jeunesse"
        else:
            self[date(year, JUL, 9)] = "Fête du Trône"

        # Green March
        if year > 1975:
            self[date(year, NOV, 6)] = "Marche verte"

        # Independance day
        if year > 1956:
            self[date(year, NOV, 18)] = "Fête de l'indépendance"

        # Eid al-Fitr - Feast Festive
        # date of observance is announced yearly, This is an estimate since
        # having the Holiday on Weekend does change the number of days,
        # deceided to leave it since marking a Weekend as a holiday
        # wouldn't do much harm.
        for date_obs in islamic_to_gre(year, 10, 1):
            hol_date = date_obs
            self[hol_date] = "Eid al-Fitr"
            self[hol_date + rd(days=1)] = "Eid al-Fitr"

        # Eid al-Adha - Sacrifice Festive
        # date of observance is announced yearly
        for date_obs in islamic_to_gre(year, 12, 10):
            hol_date = date_obs
            self[hol_date] = "Eid al-Adha"
            self[hol_date + rd(days=1)] = "Eid al-Adha"

        # Islamic New Year - (hijari_year, 1, 1)
        for date_obs in islamic_to_gre(year, 1, 1):
            hol_date = date_obs
            self[hol_date] = "1er Moharram"

        # Prophet Muhammad's Birthday - (hijari_year, 3, 12)
        for date_obs in islamic_to_gre(year, 3, 12):
            hol_date = date_obs
            self[hol_date] = "Aid al Mawlid Annabawi"
            self[hol_date + rd(days=1)] = "Aid al Mawlid Annabawi"
예제 #6
0
    def _populate(self, year):

        # New Year's Day
        self[date(year, JAN, 1)] = "New Year's Day"

        # Chinese New Year (two days)
        hol_date = self.cnls.lunar_n_y_date(year)
        self[hol_date] = "Chinese New Year"
        self[hol_date + rd(days=+1)] = "Chinese New Year"

        # Hari Raya Puasa
        # aka Eid al-Fitr
        # date of observance is announced yearly
        dates_obs = {
            2001: [(DEC, 16)],
            2002: [(DEC, 6)],
            2003: [(NOV, 25)],
            2004: [(NOV, 14)],
            2005: [(NOV, 3)],
            2006: [(OCT, 24)],
            2007: [(OCT, 13)],
            2008: [(OCT, 1)],
            2009: [(SEP, 20)],
            2010: [(SEP, 10)],
            2011: [(AUG, 30)],
            2012: [(AUG, 19)],
            2013: [(AUG, 8)],
            2014: [(JUL, 28)],
            2015: [(JUL, 17)],
            2016: [(JUL, 6)],
            2017: [(JUN, 25)],
            2018: [(JUN, 15)],
            2019: [(JUN, 5)],
            2020: [(MAY, 24)],
            2021: [(MAY, 13)],
            2022: [(MAY, 2)],
        }
        if year in dates_obs:
            for date_obs in dates_obs[year]:
                hol_date = date(year, *date_obs)
                self[hol_date] = "Hari Raya Puasa"
                # Second day of Hari Raya Puasa (up to and including 1968)
                # Removed since we don't have Hari Raya Puasa dates for the
                # the years <= 1968:
                # if year <= 1968:
                #     self[hol_date + rd(days=+1),
                #                  "Second day of Hari Raya Puasa")
        else:
            for date_obs in islamic_to_gre(year, 10, 1):
                hol_date = date_obs
                self[hol_date] = "Hari Raya Puasa* (*estimated)"
                # Second day of Hari Raya Puasa (up to and including 1968)
                if year <= 1968:
                    hol_date += rd(days=+1)
                    self[hol_date] = ("Second day of Hari Raya Puasa*"
                                      " (*estimated)")

        # Hari Raya Haji
        # aka Eid al-Adha
        # date of observance is announced yearly
        dates_obs = {
            2001: [(MAR, 6)],
            2002: [(FEB, 23)],
            2003: [(FEB, 12)],
            2004: [(FEB, 1)],
            2005: [(JAN, 21)],
            2006: [(JAN, 10)],
            2007: [(DEC, 20)],
            2008: [(DEC, 8)],
            2009: [(NOV, 27)],
            2010: [(NOV, 17)],
            2011: [(NOV, 6)],
            2012: [(OCT, 26)],
            2013: [(OCT, 15)],
            2014: [(OCT, 5)],
            2015: [(SEP, 24)],
            2016: [(SEP, 12)],
            2017: [(SEP, 1)],
            2018: [(AUG, 22)],
            2019: [(AUG, 11)],
            2020: [(JUL, 31)],
            2021: [(JUL, 20)],
            2022: [(JUL, 9)],
        }
        if year in dates_obs:
            for date_obs in dates_obs[year]:
                hol_date = date(year, *date_obs)
                self[hol_date] = "Hari Raya Haji"
        else:
            for date_obs in islamic_to_gre(year, 12, 10):
                hol_date = date_obs
                self[hol_date] = "Hari Raya Haji* (*estimated)"

        # Holy Saturday (up to and including 1968)
        if year <= 1968:
            self[easter(year) + rd(weekday=SA(-1))] = "Holy Saturday"

        # Good Friday
        self[easter(year) + rd(weekday=FR(-1))] = "Good Friday"

        # Easter Monday
        if year <= 1968:
            self[easter(year) + rd(weekday=MO(1))] = "Easter Monday"

        # Labour Day
        self[date(year, MAY, 1)] = "Labour Day"

        # Vesak Day
        # date of observance is announced yearly
        # https://en.wikipedia.org/wiki/Vesak#Dates_of_observance
        dates_obs = {
            2001: (MAY, 7),
            2002: (MAY, 27),
            2003: (MAY, 15),
            2004: (JUN, 2),
            2005: (MAY, 23),
            2006: (MAY, 12),
            2007: (MAY, 31),
            2008: (MAY, 19),
            2009: (MAY, 9),
            2010: (MAY, 28),
            2011: (MAY, 17),
            2012: (MAY, 5),
            2013: (MAY, 24),
            2014: (MAY, 13),
            2015: (JUN, 1),
            2016: (MAY, 20),
            2017: (MAY, 10),
            2018: (MAY, 29),
            2019: (MAY, 19),
            2020: (MAY, 7),
            2021: (MAY, 26),
            2022: (MAY, 15),
        }
        if year in dates_obs:
            hol_date = date(year, *dates_obs[year])
            self[hol_date] = "Vesak Day"
        else:
            hol_date = self.cnls.vesak_date(year)
            self[hol_date] = "Vesak Day* (*estimated; ~10% chance +/- 1 day)"

        # National Day
        self[date(year, AUG, 9)] = "National Day"

        # Deepavali
        # aka Diwali
        # date of observance is announced yearly
        dates_obs = {
            2001: (NOV, 14),
            2002: (NOV, 3),
            2003: (OCT, 23),
            2004: (NOV, 11),
            2005: (NOV, 1),
            2006: (OCT, 21),
            2007: (NOV, 8),
            2008: (OCT, 27),
            2009: (OCT, 17),
            2010: (NOV, 5),
            2011: (OCT, 26),
            2012: (NOV, 13),
            2013: (NOV, 2),
            2014: (OCT, 22),
            2015: (NOV, 10),
            2016: (OCT, 29),
            2017: (OCT, 18),
            2018: (NOV, 6),
            2019: (OCT, 27),
            2020: (NOV, 14),
            2021: (NOV, 4),
            2022: (NOV, 24),
        }
        if year in dates_obs:
            hol_date = date(year, *dates_obs[year])
            self[hol_date] = "Deepavali"
        else:
            hol_date = self.cnls.s_diwali_date(year)
            self[hol_date] = "Deepavali* (*estimated; rarely on day after)"

        # Christmas Day
        self[date(year, DEC, 25)] = "Christmas Day"

        # Boxing day (up to and including 1968)
        if year <= 1968:
            self[date(year, DEC, 26)] = "Boxing Day"

        # Polling Day
        dates_obs = {
            2001: (NOV, 3),
            2006: (MAY, 6),
            2011: (MAY, 7),
            2015: (SEP, 11),
            2020: (JUL, 10),
        }
        if year in dates_obs:
            self[date(year, *dates_obs[year])] = "Polling Day"

        # SG50 Public holiday
        # Announced on 14 March 2015
        # https://www.mom.gov.sg/newsroom/press-releases/2015/sg50-public-holiday-on-7-august-2015
        if year == 2015:
            self[date(2015, AUG, 7)] = "SG50 Public Holiday"

        # Check for holidays that fall on a Sunday and implement Section 4(2)
        # of the Holidays Act: "if any day specified in the Schedule falls on
        # a Sunday, the day next following not being itself a public holiday
        # is declared a public holiday in Singapore."
        for (hol_date, hol_name) in list(self.items()):
            if hol_date.year == year and hol_date.weekday() == SUN:
                self[hol_date] += " [Sunday]"
                in_lieu_date = hol_date + rd(days=+1)
                while in_lieu_date in self:
                    in_lieu_date += rd(days=+1)
                self[in_lieu_date] = hol_name + " [In lieu]"
예제 #7
0
    def _populate(self, year):
        """
        # Function to store the holiday name in the appropriate
        # date and to shift the Public holiday in case it happens
        # on a Saturday(Weekend)
        # (NOT USED)
        def is_weekend(self, hol_date, hol_name):
            if hol_date.weekday() == FRI:
                self[hol_date] = hol_name + " [Friday]"
                self[hol_date + rd(days=+2)] = "Sunday following " + hol_name
            else:
                self[hol_date] = hol_name
        """

        # New Year's Day
        self[date(year, JAN, 1)] = "New Year's Day - Bank Holiday"

        # Coptic Christmas
        self[date(year, JAN, 7)] = "Coptic Christmas"

        # 25th of Jan
        if year >= 2012:
            self[date(year, JAN, 25)] = "Revolution Day - January 25"
        elif year >= 2009:
            self[date(year, JAN, 25)] = "Police Day"
        else:
            pass

        # Coptic Easter - Orthodox Easter
        self[easter(year, 2)] = "Coptic Easter Sunday"

        # Sham El Nessim - Spring Festival
        self[easter(year, 2) + rd(days=1)] = "Sham El Nessim"

        # Sinai Libration Day
        if year > 1982:
            self[date(year, APR, 25)] = "Sinai Liberation Day"

        # Labour Day
        self[date(year, MAY, 1)] = "Labour Day"

        # Armed Forces Day
        self[date(year, OCT, 6)] = "Armed Forces Day"

        # 30 June Revolution Day
        if year >= 2014:
            self[date(year, JUN, 30)] = "30 June Revolution Day"

        # Revolution Day
        if year > 1952:
            self[date(year, JUL, 23)] = "Revolution Day"

        # Eid al-Fitr - Feast Festive
        # date of observance is announced yearly, This is an estimate since
        # having the Holiday on Weekend does change the number of days,
        # deceided to leave it since marking a Weekend as a holiday
        # wouldn't do much harm.
        for date_obs in islamic_to_gre(year, 10, 1):
            hol_date = date_obs
            self[hol_date] = "Eid al-Fitr"
            self[hol_date + rd(days=1)] = "Eid al-Fitr Holiday"
            self[hol_date + rd(days=2)] = "Eid al-Fitr Holiday"

        # Arafat Day & Eid al-Adha - Scarfice Festive
        # date of observance is announced yearly
        for date_obs in islamic_to_gre(year, 12, 9):
            hol_date = date_obs
            self[hol_date] = "Arafat Day"
            self[hol_date + rd(days=1)] = "Eid al-Adha"
            self[hol_date + rd(days=2)] = "Eid al-Adha Holiday"
            self[hol_date + rd(days=3)] = "Eid al-Adha Holiday"

        # Islamic New Year - (hijari_year, 1, 1)
        for date_obs in islamic_to_gre(year, 1, 1):
            hol_date = date_obs
            self[hol_date] = "Islamic New Year"

        # Prophet Muhammad's Birthday - (hijari_year, 3, 12)
        for date_obs in islamic_to_gre(year, 3, 12):
            hol_date = date_obs
            self[hol_date] = "Prophet Muhammad's Birthday"
예제 #8
0
    def _populate(self, year):

        # New Year's Day
        if self.state not in ("JHR", "KDH", "KTN", "PLS", "TRG"):
            self[date(year, JAN, 1)] = "New Year's Day"

        # Birthday of the Prophet Muhammad (s.a.w.).
        # a.k.a. Hari Keputeraan Nabi Muhammad (Sabah Act)
        for hol_date in self.my_islamic_to_gre(year, 3, 12):
            self[
                hol_date] = "Maulidur Rasul (Birthday of the Prophet Muhammad)"

        # Hari Kebangsaan or National Day.
        self[date(year, AUG, 31)] = "National Day"

        # Chinese New Year (one day in the States of Kelantan and Terengganu,
        # two days in the other States).
        hol_date = self.cnls.lunar_n_y_date(year)
        self[hol_date] = "Chinese New Year"
        # The second day of Chinese New Year is not a federal holiday in
        # Kelantan and Terengganu. However, it is gazetted as a state holiday
        # in both states, effectively making it a nationwide holiday.
        self[hol_date + rd(days=+1)] = "Chinese New Year Holiday"

        # Wesak Day.
        # Date of observance is announced yearly
        # https://en.wikipedia.org/wiki/Vesak#Dates_of_observance
        dates_obs = {
            2001: (MAY, 7),
            2002: (MAY, 27),
            2003: (MAY, 15),
            2004: (JUN, 2),
            2005: (MAY, 23),
            2006: (MAY, 12),
            2007: (MAY, 31),
            2008: (MAY, 19),
            2009: (MAY, 9),
            2010: (MAY, 28),
            2011: (MAY, 17),
            2012: (MAY, 5),
            2013: (MAY, 24),
            2014: (MAY, 13),
            2015: (JUN, 1),
            2016: (MAY, 20),
            2017: (MAY, 10),
            2018: (MAY, 29),
            2019: (MAY, 19),
            2020: (MAY, 7),
            2021: (MAY, 26),
            2022: (MAY, 15),
        }
        if year in dates_obs:
            hol_date = date(year, *dates_obs[year])
            self[hol_date] = "Vesak Day"
        else:
            hol_date = self.cnls.vesak_may_date(year)
            self[hol_date] = "Vesak Day* (*estimated; ~10% chance +/- 1 day)"

        # Birthday of [His Majesty] the Yang di-Pertuan Agong.
        if year <= 2017:
            hol_date = rrule(
                MONTHLY,
                dtstart=date(year, JUN, 1),
                count=1,
                bysetpos=1,
                byweekday=SA,
            )[0]
        elif year == 2018:
            hol_date = date(2018, SEP, 9)
        else:
            hol_date = rrule(
                MONTHLY,
                dtstart=date(year, JUN, 1),
                count=1,
                bysetpos=1,
                byweekday=MO,
            )[0]
        self[hol_date] = "Birthday of SPB Yang di-Pertuan Agong"

        # Hari Raya Puasa (2 days).
        # aka Eid al-Fitr;
        # exact date of observance is announced yearly
        dates_obs = {
            2001: [(DEC, 17)],
            2002: [(DEC, 6)],
            2003: [(NOV, 25)],
            2004: [(NOV, 14)],
            2005: [(NOV, 3)],
            2006: [(OCT, 24)],
            2007: [(OCT, 13)],
            2008: [(OCT, 1)],
            2009: [(SEP, 20)],
            2010: [(SEP, 10)],
            2011: [(AUG, 30)],
            2012: [(AUG, 19)],
            2013: [(AUG, 8)],
            2014: [(JUL, 28)],
            2015: [(JUL, 17)],
            2016: [(JUL, 6)],
            2017: [(JUN, 25)],
            2018: [(JUN, 15)],
            2019: [(JUN, 5)],
            2020: [(MAY, 24)],
            2021: [(MAY, 13)],
            2022: [(MAY, 2)],
        }
        if year in dates_obs:
            for date_obs in dates_obs[year]:
                hol_date = date(year, *date_obs)
                self[hol_date] = "Hari Raya Puasa"
                self[hol_date + rd(days=+1)] = "Second day of Hari Raya Puasa"
        else:
            for date_obs in islamic_to_gre(year, 10, 1):
                hol_date = date_obs
                self[hol_date] = "Hari Raya Puasa* (*estimated)"
                self[hol_date +
                     rd(days=+1)] = ("Second day of Hari Raya Puasa*"
                                     " (*estimated)")

        # Hari Raya Haji and Arafat Day.
        # Date of observance is announced yearly.
        dates_obs = {
            2001: [(MAR, 6)],
            2002: [(FEB, 23)],
            2003: [(FEB, 12)],
            2004: [(FEB, 1)],
            2005: [(JAN, 21)],
            2006: [(JAN, 10)],
            2007: [(DEC, 20)],
            2008: [(DEC, 8)],
            2009: [(NOV, 27)],
            2010: [(NOV, 17)],
            2011: [(NOV, 6)],
            2012: [(OCT, 26)],
            2013: [(OCT, 15)],
            2014: [(OCT, 5)],
            2015: [(SEP, 24)],
            2016: [(SEP, 12)],
            2017: [(SEP, 1)],
            2018: [(AUG, 22)],
            2019: [(AUG, 11)],
            2020: [(JUL, 31)],
            2021: [(JUL, 20)],
            2022: [(JUL, 9)],
        }
        if year in dates_obs:
            for date_obs in dates_obs[year]:
                hol_date = date(year, *date_obs)
                self[hol_date] = "Hari Raya Haji"
                if self.state == "TRG":
                    # Arafat Day is one day before Eid al-Adha
                    self[hol_date - rd(days=1)] = "Arafat Day"
                if self.state in ("KDH", "KTN", "PLS", "TRG"):
                    # Second day
                    self[hol_date + rd(days=1)] = "Hari Raya Haji Holiday"
        else:
            for date_obs in islamic_to_gre(year, 12, 10):
                hol_date = date_obs
                self[hol_date] = "Hari Raya Haji* (*estimated)"
                if self.state == "TRG":
                    # Arafat Day is one day before Eid al-Adha
                    self[hol_date - rd(days=1)] = "Arafat Day* (*estimated)"
                if self.state in ("KDH", "KTN", "PLS", "TRG"):
                    # Second day
                    self[hol_date +
                         rd(days=1)] = "Hari Raya Haji Holiday* (*estimated)"

        # Deepavali.
        # aka Diwali;
        # date of observance is announced yearly
        if self.state != "SWK":
            dates_obs = {
                2001: (NOV, 14),
                2002: (NOV, 3),
                2003: (OCT, 23),
                2004: (NOV, 11),
                2005: (NOV, 1),
                2006: (OCT, 21),
                2007: (NOV, 8),
                2008: (OCT, 27),
                2009: (OCT, 17),
                2010: (NOV, 5),
                2011: (OCT, 26),
                2012: (NOV, 13),
                2013: (NOV, 2),
                2014: (OCT, 22),
                2015: (NOV, 10),
                2016: (OCT, 29),
                2017: (OCT, 18),
                2018: (NOV, 6),
                2019: (OCT, 27),
                2020: (NOV, 14),
                2021: (NOV, 4),
                2022: (NOV, 24),
            }
            if year in dates_obs:
                hol_date = date(year, *dates_obs[year])
                self[hol_date] = "Deepavali"
            else:
                hol_date = self.cnls.s_diwali_date(year)
                self[hol_date] = "Deepavali* (*estimated; rarely on day after)"

        # Christmas day.
        self[date(year, DEC, 25)] = "Christmas Day"

        # Malaysia Day.
        self[date(year, SEP, 16)] = "Malaysia Day"

        # ---------------------------------------------------------#
        # Holidays from the Sarawak Ordinance (not included above) #
        # ---------------------------------------------------------#
        if self.state == "SWK":
            # Dayak Festival Day (the first day of June) and the following day.
            self[date(year, JUN, 1)] = "Gawai Dayak"
            self[date(year, JUN, 2)] = "Gawai Dayak (Second day)"

            # The first day of May—Worker’s Celebration Day.

            # Birthday of Tuan Yang Terutama Yang di-Pertua Negeri Sarawak (the
            # second Saturday of September).
            second_sat_oct = rrule(
                MONTHLY,
                dtstart=date(year, OCT, 1),
                count=1,
                bysetpos=2,
                byweekday=SA,
            )[0]
            self[second_sat_oct] = "Birthday of the Governor of Sarawak"

            # Sarawak Independence Day
            if year > 2016:
                self[date(year, JUL, 22)] = "Sarawak Day"

        # Check for holidays that fall on a Sunday and
        # implement Section 3 of Malaysian Holidays Act:
        # "if any day specified in the Schedule falls on
        # Sunday then the day following shall be a public
        # holiday and if such day is already a public holiday,
        # then the day following shall be a public holiday"
        for (hol_date, hol_name) in list(self.items()):
            if hol_date.year == year and hol_date.weekday() == SUN:
                self[hol_date] += " [Sunday]"
                in_lieu_date = hol_date + rd(days=+1)
                while in_lieu_date in self:
                    in_lieu_date += rd(days=+1)
                self[in_lieu_date] = hol_name + " [In lieu]"

        # The last two days in May (Pesta Kaamatan).
        # (Sarawak Act)
        # Day following a Sunday is not a holiday
        if self.state in ("LBN", "SBH"):
            self[date(year, MAY, 30)] = "Pesta Kaamatan"
            self[date(year, MAY, 31)] = "Pesta Kaamatan (Second day)"

        # ------------------------------#
        # Other holidays (decrees etc.) #
        # ------------------------------#

        # Malaysia General Election Holiday.
        dates_obs = {
            # The years 1955 1959 1995 seems to have the elections
            # one weekday but I am not sure if they were marked as
            # holidays.
            1999: (NOV, 29),
            2018: (MAY, 9),
        }
        if year in dates_obs:
            self[date(year,
                      *dates_obs[year])] = "Malaysia General Election Holiday"

        # Awal Muharram.
        for hol_date in self.my_islamic_to_gre(year, 1, 1):
            self[hol_date] = "Awal Muharram (Hijri New Year)"

        # Labour Day.
        self[date(year, MAY, 1)] = "Labour Day"

        # ---------------------------------#
        # State holidays (multiple states) #
        # ---------------------------------#

        # 1 January (or the following day if the 1 January should fall on a
        # weekly holiday in any State or in the Federal Territory).
        if self.state in (
                "KUL",
                "LBN",
                "MLK",
                "NSN",
                "PHG",
                "PNG",
                "PRK",
                "PJY",
                "SBH",
                "SWK",
                "SGR",
        ):
            hol_date = date(year, JAN, 1)
            self[hol_date] = "New Year's Day"
            if hol_date == SUN:
                self[hol_date] += " [Sunday]"
                self[date(year, JAN, 2)] = "New Year's Day [In lieu]"

        # Isra and Mi'raj.
        if self.state in ("KDH", "NSN", "PLS", "TRG"):
            for hol_date in islamic_to_gre(year, 7, 27):
                self[hol_date] = "Isra and Mi'raj"

        # Beginning of Ramadan.
        if self.state in ("JHR", "KDH", "MLK"):
            for hol_date in islamic_to_gre(year, 9, 1):
                self[hol_date] = "Begining of Ramadan"

        # Nuzul Al-Quran Day.
        if self.state and self.state not in (
                "JHR",
                "KDH",
                "MLK",
                "NSN",
                "SBH",
                "SWK",
        ):
            for hol_date in islamic_to_gre(year, 9, 17):
                self[hol_date] = "Nuzul Al-Quran Day"

        # Hari Raya Aidilfitri.
        # aka Eid al-Fitr;
        # date of observance is announced yearly
        dates_obs = {
            2001: [(DEC, 16)],
            2002: [(DEC, 6)],
            2003: [(NOV, 25)],
            2004: [(NOV, 14)],
            2005: [(NOV, 3)],
            2006: [(OCT, 24)],
            2007: [(OCT, 13)],
            2008: [(OCT, 1)],
            2009: [(SEP, 20)],
            2010: [(SEP, 10)],
            2011: [(AUG, 30)],
            2012: [(AUG, 19)],
            2013: [(AUG, 8)],
            2014: [(JUL, 28)],
            2015: [(JUL, 17)],
            2016: [(JUL, 6)],
            2017: [(JUN, 25)],
            2018: [(JUN, 15)],
            2019: [(JUN, 5)],
            2020: [(MAY, 24)],
            2021: [(MAY, 13)],
            2022: [(MAY, 2)],
        }
        if year in dates_obs:
            for date_obs in dates_obs[year]:
                hol_date = date(year, *date_obs)
                self[hol_date] = "Hari Raya Aidilfitri"
                hol_date += rd(days=+1)
                self[hol_date] = "Hari Raya Aidilfitri Holiday"
        else:
            for date_obs in islamic_to_gre(year, 10, 1):
                hol_date = date_obs
                self[hol_date] = "Hari Raya Aidilfitri* (*estimated)"
                hol_date += rd(days=+1)
                self[hol_date] = "Hari Raya Aidilfitri Holiday* (*estimated)"

        # Good Friday.
        if self.state in ("SBH", "SWK"):
            self[easter(year) + rd(weekday=FR(-1))] = "Good Friday"

        # Thaipusam.
        # An annual Hindu festival observed on the day of the first full moon
        # during the Tamil month of Thai
        if self.state in ("JHR", "KUL", "NSN", "PJY", "PNG", "PRK", "SGR"):
            dates_obs = {
                2018: [(JAN, 31)],
                2019: [(JAN, 21)],
                2020: [(FEB, 8)],
                2021: [(JAN, 28)],
                2022: [(JAN, 18)],
                2023: [(FEB, 4)],
                2024: [(JAN, 25)],
                2025: [(FEB, 11)],
                2026: [(FEB, 1)],
                2027: [(JAN, 22)],
            }
            if year in dates_obs:
                for date_obs in dates_obs[year]:
                    hol_date = date(year, *date_obs)
                    self[hol_date] = "Thaipusam"
            else:
                hol_date = self.cnls.thaipusam_date(year)
                self[hol_date] = "Thaipusam* (*estimated)"

        # Federal Territory Day.
        if self.state in ("KUL", "LBN", "PJY"):
            if year > 1973:
                self[date(year, FEB, 1)] = "Federal Territory Day"

        # State holidays (single state)
        # -----------------------------

        if self.state == "JHR":
            if year > 2014:
                self[date(year, MAR, 23)] = "Birthday of the Sultan of Johor"
            for date_obs in islamic_to_gre(year, 2, 6):
                self[date_obs] = "Hari Hol of Sultan Iskandar of Johor"

        elif self.state == "KDH":
            third_sun_jun = rrule(
                MONTHLY,
                dtstart=date(year, JUN, 1),
                count=1,
                bysetpos=3,
                byweekday=SU,
            )[0]
            self[third_sun_jun] = "Birthday of The Sultan of Kedah"

        elif self.state == "KTN":
            self[date(year, NOV, 11)] = "Birthday of the Sultan of Kelantan"
            self[date(year, NOV,
                      12)] = "Birthday of the Sultan of Kelantan Holiday"

        elif self.state == "MLK":
            self[date(
                year, APR,
                15)] = "Declaration of Malacca as a Historical City in Melaka"
            self[date(year, AUG,
                      24)] = "Birthday of the Governor of the State of Melaka"

        elif self.state == "NSN":
            self[date(year, JAN,
                      14)] = "Birthday of the Sultan of Negeri Sembilan"

        elif self.state == "PHG":
            self[date(year, MAY, 22)] = "Hari Hol of Pahang"
            self[date(year, JUL, 30)] = "Birthday of the Sultan of Pahang"

        elif self.state == "PNG":
            self[date(year, JUL, 7)] = "George Town Heritage Day"
            second_sat_jul = rrule(
                MONTHLY,
                dtstart=date(year, JUL, 1),
                count=1,
                bysetpos=2,
                byweekday=SA,
            )[0]
            self[second_sat_jul] = "Birthday of the Governor of Penang"

        elif self.state == "PRK":
            if year > 2016:
                first_fri_nov = rrule(
                    MONTHLY,
                    dtstart=date(year, NOV, 1),
                    count=1,
                    bysetpos=1,
                    byweekday=FR,
                )[0]
                self[first_fri_nov] = "Birthday of the Sultan of Perak"
            else:
                # This Holiday used to be on 27th until 2017
                # https://www.officeholidays.com/holidays/malaysia/birthday-of-the-sultan-of-perak  # noqa: E501
                self[date(year, NOV, 27)] = "Birthday of the Sultan of Perak"

        elif self.state == "PLS":
            self[date(year, JUL, 17)] = "Birthday of The Raja of Perlis"

        elif self.state == "SGR":
            self[date(year, DEC, 11)] = "Birthday of The Sultan of Selangor"

        elif self.state == "SBH":
            first_sat_oct = rrule(
                MONTHLY,
                dtstart=date(year, OCT, 1),
                count=1,
                bysetpos=1,
                byweekday=SA,
            )[0]
            self[first_sat_oct] = "Birthday of the Governor of Sabah"
            if year > 2018:
                self[date(year, DEC, 24)] = "Christmas Eve"

        elif self.state == "TRG":
            self[date(
                year, MAR, 4
            )] = "Anniversary of the Installation of the Sultan of Terengganu"
            self[date(year, APR, 26)] = "Birthday of the Sultan of Terengganu"
예제 #9
0
    def _populate(self, year):
        observed_str = " (observed)"
        # Eid al-Fitr Holiday
        # The holiday defined from the four days after 29th of
        # the 9th month of the Islamic calendar (either from 30/9 to 3/10
        # or from 1/10 to 4/10 depending on observed Islamic calendar)

        holiday_name = "Eid al-Fitr Holiday"
        for hijri_date in islamic_to_gre(year, 9, 29):
            self[hijri_date + rd(days=1)] = holiday_name
            self[hijri_date + rd(days=2)] = holiday_name
            self[hijri_date + rd(days=3)] = holiday_name
            self[hijri_date + rd(days=4)] = holiday_name
            if self.observed:
                if (hijri_date + rd(days=1)).weekday() in WEEKEND:
                    self[hijri_date + rd(days=5)] = holiday_name + observed_str
                if (hijri_date + rd(days=2)).weekday() in WEEKEND:
                    self[hijri_date + rd(days=5)] = holiday_name + observed_str
                    self[hijri_date + rd(days=6)] = holiday_name + observed_str
                if (hijri_date + rd(days=3)).weekday() in WEEKEND:
                    self[hijri_date + rd(days=5)] = holiday_name + observed_str
                    self[hijri_date + rd(days=6)] = holiday_name + observed_str
                if (hijri_date + rd(days=4)).weekday() in WEEKEND:
                    self[hijri_date + rd(days=6)] = holiday_name + observed_str

        # Arafat Day & Eid al-Adha
        # date of observance is announced yearly
        holiday_name = "Eid al-Adha Holiday"
        for hijri_date in islamic_to_gre(year, 12, 9):
            self[hijri_date] = holiday_name
            self[hijri_date + rd(days=1)] = holiday_name
            self[hijri_date + rd(days=2)] = holiday_name
            self[hijri_date + rd(days=3)] = holiday_name

            if self.observed:
                if hijri_date.weekday() in WEEKEND:
                    self[hijri_date + rd(days=4)] = holiday_name + observed_str
                if (hijri_date + rd(days=1)).weekday() in WEEKEND:
                    self[hijri_date + rd(days=4)] = holiday_name + observed_str
                    self[hijri_date + rd(days=5)] = holiday_name + observed_str
                if (hijri_date + rd(days=2)).weekday() in WEEKEND:
                    self[hijri_date + rd(days=4)] = holiday_name + observed_str
                    self[hijri_date + rd(days=5)] = holiday_name + observed_str
                if (hijri_date + rd(days=3)).weekday() in WEEKEND:
                    self[hijri_date + rd(days=5)] = holiday_name + observed_str

        # National Day holiday (started at the year 2005).
        # Note: if national day happens within the Eid al-Fitr Holiday or
        # within Eid al-Fitr Holiday, then it is not holiday.
        holiday_name = "National Day Holiday"
        if year >= 2005:
            national_day = date(year, SEP, 23)
            if national_day not in self:
                self[national_day] = holiday_name

                if self.observed and national_day.weekday() == FRI:
                    national_day -= rd(days=1)
                    self[national_day] = holiday_name + observed_str
                elif self.observed and national_day.weekday() == SAT:
                    national_day += rd(days=1)
                    self[national_day] = holiday_name + observed_str
예제 #10
0
    def _populate(self, year):
        if year > 1978:
            # New Year's Day
            self[date(year, JAN, 1)] = "New Year's day"

            # Calculate Easter for given year
            # followed by easter related holidays
            e = easter(year)

            good_friday = e - rd(days=2)
            self[good_friday] = "Good Friday"

            easter_monday = e + rd(days=1)
            self[easter_monday] = "Easter Monday"

            # Worker's day
            self[date(year, MAY, 1)] = "Workers' day"

            # Eid al-Fitr - Feast Festive
            # This is an estimate
            # date of observance is announced yearly
            for date_obs in islamic_to_gre(year, 10, 1):
                hol_date = date_obs
                self[hol_date] = "Eid al-Fitr"
                self[hol_date + rd(days=1)] = "Eid al-Fitr Holiday"

            # Arafat Day & Eid al-Adha - Scarfice Festive
            # This is an estimate
            # date of observance is announced yearly
            for date_obs in islamic_to_gre(year, 12, 10):
                hol_date = date_obs
                self[hol_date] = "Eid al-Adha"
                self[hol_date + rd(days=1)] = "Eid al-Adha Holiday"

            # Independence Day
            self[date(year, OCT, 1)] = "National day"

            # Christmas day
            self[date(year, DEC, 25)] = "Christmas day"

            # Boxing day
            self[date(year, DEC, 26)] = "Boxing day"

            # Democracy day moved around after its inception in 2000
            # Initally it fell on May 29th
            if 2019 > year > 1999:
                self[date(year, MAY, 29)] = "Democracy day"
            # In 2018 it was announced that the holiday
            # will move to June 12th from 2019
            if year >= 2019:
                self[date(year, JUN, 12)] = "Democracy day"

            # Observed holidays
            for k, v in list(self.items()):
                # If a holiday falls on a Saturday the
                # following Monday is Observed as a public holiday
                if (self.observed and year > 2015 and k.weekday() == SAT
                        and k.year == year
                        and v.upper() in ("WORKER'S DAY", "DEMOCRACY DAY")):
                    # Add the (Observed) holiday
                    self[k + rd(days=2)] = v + " (Observed)"
예제 #11
0
    def _populate(self, year):
        # New Year's Day
        # The Ethiopian New Year is called Kudus Yohannes in Ge'ez and
        # Tigrinya, while in Amharic,
        # the official language of Ethiopia it is called Enkutatash.
        # It occurs on September 11 in the Gregorian Calendar;
        # except for the year preceding a leap year, when it occurs on
        # September 12.
        if self.ethiopian_isleap(year):
            self[date(year, SEP, 12)] = "አዲስ ዓመት እንቁጣጣሽ/Ethiopian New Year"
        else:
            self[date(year, SEP, 11)] = "አዲስ ዓመት እንቁጣጣሽ/Ethiopian New Year"

        # Finding of true cross
        if self.ethiopian_isleap(year):
            self[date(year, SEP, 28)] = "መስቀል/Finding of True Cross"
        else:
            self[date(year, SEP, 27)] = "መስቀል/Finding of True Cross"

        # Ethiopian Christmas
        self[date(year, JAN, 7)] = "ገና/Ethiopian X-Mas"

        # Ethiopian Ephiphany
        self[date(year, JAN, 19)] = "ጥምቀት/Ephiphany"

        # Ethiopian Good Friday
        self[easter(year, 2) - rd(days=2)] = "ስቅለት/Ethiopian Good Friday"

        # Ethiopian  Easter - Orthodox Easter
        self[easter(year, 2)] = "ፋሲካ/Ethiopian Easter"

        # Adwa Victory Day
        if year > 1896:
            self[date(year, MAR, 2)] = "አድዋ/Victory of Adwa"

        # Labour Day
        self[date(year, MAY, 1)] = "የሰራተኞች ቀን/Labor Day"

        # Patriots Day
        if year > 1941:
            self[date(year, MAY, 5)] = "የአርበኞች ቀን/Patriots Day"

        # Derg Downfall Day
        if year > 1991:
            self[date(year, MAY,
                      28)] = "ደርግ የወደቀበት ቀን/Downfall of Dergue regime"

        # Downfall of King. Hailesilassie
        if year < 1991 and year > 1974:
            if self.ethiopian_isleap(year):
                self[date(year, SEP, 13)] = "ደርግ የመጣበት ቀን/Formation of Dergue"
            else:
                self[date(year, SEP, 12)] = "ደርግ የመጣበት ቀን/Formation of Dergue"

        # Eid al-Fitr - Feast Festive
        # date of observance is announced yearly, This is an estimate since
        # having the Holiday on Weekend does change the number of days,
        # deceided to leave it since marking a Weekend as a holiday
        # wouldn't do much harm.
        for date_obs in islamic_to_gre(year, 10, 1):
            hol_date = date_obs
            self[hol_date] = "ኢድ አልፈጥር/Eid-Al-Fitr"

        # Eid al-Adha - Scarfice Festive
        # date of observance is announced yearly
        for date_obs in islamic_to_gre(year, 12, 9):
            hol_date = date_obs
            self[hol_date + rd(days=1)] = "አረፋ/Eid-Al-Adha"

        # Prophet Muhammad's Birthday - (hijari_year, 3, 12)
        for date_obs in islamic_to_gre(year, 3, 12):
            hol_date = date_obs
            self[hol_date + rd(days=1)] = "መውሊድ/Prophet Muhammad's Birthday"
예제 #12
0
    def _populate(self, year):

        # New Year's Day
        self[date(year, JAN, 1)] = "New Year's Day"

        # Commemoration Day, since 2015.
        if year >= 2015 and year < 2019:
            self[date(year, NOV, 30)] = "Commemoration Day"
        elif year >= 2019:
            self[date(year, DEC, 1)] = "Commemoration Day"
        else:
            pass

        # National Day
        self[date(year, DEC, 2)] = "National Day"
        self[date(year, DEC, 3)] = "National Day Holiday"

        # Eid al-Fitr
        # Date is announced each year. Usually stretches along 3 or 4 days,
        # in some instances prepending/appending a day or two
        # before/after the official holiday.
        dates_obs = {
            2017: [(JUN, 25)],
            2018: [(JUN, 14)],
            2019: [(JUN, 3)],
            2020: [(MAY, 24)],
        }
        fitr = "Eid al-Fitr"
        if year in dates_obs:
            for date_obs in dates_obs[year]:
                hol_date = date(year, *date_obs)
                self[hol_date] = fitr
                self[hol_date + rd(days=1)] = "{} Holiday".format(fitr)
                self[hol_date + rd(days=2)] = "{} Holiday".format(fitr)
        else:
            for date_obs in islamic_to_gre(year, 10, 1):
                hol_date = date_obs
                self[hol_date] = "{}* (*estimated)".format(fitr)
                self[hol_date +
                     rd(days=1)] = "{} Holiday* (*estimated)".format(fitr)
                self[hol_date +
                     rd(days=2)] = "{} Holiday* (*estimated)".format(fitr)

        # Arafat Day & Eid al-Adha
        dates_obs = {
            2017: [(AUG, 31)],
            2018: [(AUG, 20)],
            2019: [(AUG, 10)],
            2020: [(JUL, 30)],
        }
        hajj = "Arafat (Hajj) Day"
        adha = "Eid al-Adha"
        if year in dates_obs:
            for date_obs in dates_obs[year]:
                hol_date = date(year, *date_obs)
                self[hol_date] = hajj
                self[hol_date + rd(days=1)] = adha
                self[hol_date + rd(days=2)] = "{} Holiday".format(adha)
                self[hol_date + rd(days=3)] = "{} Holiday".format(adha)
        else:
            for date_obs in islamic_to_gre(year, 12, 9):
                hol_date = date_obs
                self[hol_date] = "{}* (*estimated)".format(hajj)
                self[hol_date + rd(days=1)] = "{}* (*estimated)".format(adha)
                self[hol_date +
                     rd(days=2)] = "{}* Holiday* (*estimated)".format(adha)
                self[hol_date +
                     rd(days=3)] = "{} Holiday* (*estimated)".format(adha)

        # Islamic New Year - (hijari_year, 1, 1)
        dates_obs = {
            2017: [(SEP, 22)],
            2018: [(SEP, 11)],
            2019: [(AUG, 31)],
            2020: [(AUG, 23)],
        }
        new_hijri_year = "Al Hijra - Islamic New Year"
        if year in dates_obs:
            for date_obs in dates_obs[year]:
                hol_date = date(year, *date_obs)
                self[hol_date] = new_hijri_year
        else:
            for date_obs in islamic_to_gre(year, 1, 1):
                hol_date = date_obs
                self[hol_date] = "{}* (*estimated)".format(new_hijri_year)

        # Leilat al-Miraj - The Prophet's ascension (hijari_year, 7, 27)
        if year <= 2018:  # starting from 2019 the UAE government removed this
            dates_obs = {2017: [(APR, 23)], 2018: [(APR, 13)]}
            ascension = "Leilat al-Miraj - The Prophet's ascension"
            if year in dates_obs:
                for date_obs in dates_obs[year]:
                    hol_date = date(year, *date_obs)
                    self[hol_date] = ascension
            else:
                for date_obs in islamic_to_gre(year, 7, 27):
                    hol_date = date_obs
                    self[hol_date] = "{}* (*estimated)".format(ascension)

        # Prophet Muhammad's Birthday - (hijari_year, 3, 12)
        if year <= 2019:  # starting from 2020 the UAE government removed this
            dates_obs = {
                2017: [(NOV, 30)],
                2018: [(NOV, 19)],
                2019: [(NOV, 9)],
            }
            mawlud = "Mawlud al-Nabi - Prophet Mohammad's Birthday"
            if year in dates_obs:
                for date_obs in dates_obs[year]:
                    hol_date = date(year, *date_obs)
                    self[hol_date] = mawlud
            else:
                for date_obs in islamic_to_gre(year, 3, 12):
                    hol_date = date_obs
                    self[hol_date] = "{}* (*estimated)".format(mawlud)
예제 #13
0
    def _populate(self, year):
        """
        # Function to store the holiday name in the appropriate
        # date and to shift the Public holiday in case it happens
        # on a Saturday(Weekend)
        # (NOT USED)
        def is_weekend(self, hol_date, hol_name):
            if hol_date.weekday() == FRI:
                self[hol_date] = hol_name + " [Friday]"
                self[hol_date + rd(days=+2)] = "Sunday following " + hol_name
            else:
                self[hol_date] = hol_name
        """

        # New Year's Day
        self[date(year, JAN, 1)] = "New Year's Day"

        # Revolution and Youth Day - January 14
        self[date(year, JAN, 14)] = "Revolution and Youth Day - January 14"

        # Independence Day
        self[date(year, MAR, 20)] = "Independence Day"

        # Martyrs' Day
        self[date(year, APR, 9)] = "Martyrs' Day"

        # Labour Day
        self[date(year, MAY, 1)] = "Labour Day"

        # Republic Day
        self[date(year, JUL, 25)] = "Republic Day"

        # Women's Day
        self[date(year, AUG, 13)] = "Women's Day"

        # Evacuation Day
        self[date(year, OCT, 15)] = "Evacuation Day"

        # Eid al-Fitr - Feast Festive
        # date of observance is announced yearly, This is an estimate since
        # having the Holiday on Weekend does change the number of days,
        # deceided to leave it since marking a Weekend as a holiday
        # wouldn't do much harm.
        for date_obs in islamic_to_gre(year, 10, 1):
            hol_date = date_obs
            self[hol_date] = "Eid al-Fitr"
            self[hol_date + rd(days=1)] = "Eid al-Fitr Holiday"
            self[hol_date + rd(days=2)] = "Eid al-Fitr Holiday"

        # Arafat Day & Eid al-Adha - Scarfice Festive
        # date of observance is announced yearly
        for date_obs in islamic_to_gre(year, 12, 9):
            hol_date = date_obs
            self[hol_date] = "Arafat Day"
            self[hol_date + rd(days=1)] = "Eid al-Adha"
            self[hol_date + rd(days=2)] = "Eid al-Adha Holiday"
            self[hol_date + rd(days=3)] = "Eid al-Adha Holiday"

        # Islamic New Year - (hijari_year, 1, 1)
        for date_obs in islamic_to_gre(year, 1, 1):
            hol_date = date_obs
            self[hol_date] = "Islamic New Year"

        # Prophet Muhammad's Birthday - (hijari_year, 3, 12)
        for date_obs in islamic_to_gre(year, 3, 12):
            hol_date = date_obs
            self[hol_date] = "Prophet Muhammad's Birthday"
예제 #14
0
    def _populate(self, year):
        # New Year's Day
        self[date(year, JAN, 1)] = "New Year's Day"

        # Unity Day
        name = "Unity Day"
        self[date(year, FEB, 5)] = name
        if date(year, FEB, 5).weekday() == SUN:
            self[date(year, FEB, 6)] = name + " (Observed)"

        # President Ntaryamira Day
        name = "President Ntaryamira Day"
        self[date(year, APR, 6)] = "President Ntaryamira Day"
        if date(year, APR, 6).weekday() == SUN:
            self[date(year, APR, 7)] = name + " (Observed)"

        # Labour Day
        name = "Labour Day"
        self[date(year, MAY, 1)] = name
        if date(year, MAY, 1).weekday() == SUN:
            self[date(year, MAY, 2)] = name + " (Observed)"

        # Ascension Day
        name = "Ascension Day"
        self[easter(year) + rd(days=+39)] = name

        # Independence Day post 1962
        name = "Independence Day"
        if year > 1961:
            self[date(year, JUL, 1)] = name
            if date(year, JUL, 1).weekday() == SUN:
                self[date(year, JUL, 2)] = name + " (Observed)"

        # Eid Al Adha- Feast of the Sacrifice
        # date of observance is announced yearly
        for date_obs in islamic_to_gre(year, 12, 10):
            hol_date = date_obs
            self[hol_date] = "Eid Al Adha"
            self[hol_date + rd(days=1)] = "Eid Al Adha"

        # Assumption Day
        name = "Assumption Day"
        self[date(year, AUG, 15)] = name

        # Prince Louis Rwagasore Day
        name = "Prince Louis Rwagasore Day"
        self[date(year, OCT, 13)] = name
        if date(year, OCT, 13).weekday() == SUN:
            self[date(year, OCT, 14)] = name + " (Observed)"

        # President Ndadaye's Day
        name = "President Ndadaye's Day"
        self[date(year, OCT, 21)] = name
        if date(year, OCT, 21).weekday() == SUN:
            self[date(year, OCT, 22)] = name + " (Observed)"

        # All Saints' Day
        name = "All Saints' Day"
        self[date(year, NOV, 1)] = name
        if date(year, NOV, 1).weekday() == SUN:
            self[date(year, NOV, 2)] = name + " (Observed)"

        # Christmas Day
        self[date(year, DEC, 25)] = "Christmas Day"
예제 #15
0
    def _populate(self, year):

        # 1st of Jan
        self[date(year, JAN, 1)] = "New Year's Day"
        self[date(year, JAN, 2)] = "New Year's Day"
        self._add_observed(date(year, JAN, 2))

        # Black January
        self[date(year, JAN, 20)] = "Black January"
        self._add_observed(date(year, JAN, 20))

        # International Women's Day
        self[date(year, MAR, 8)] = "International Women's Day"
        self._add_observed(date(year, MAR, 8))

        # Novruz
        for i in range(5):
            self[date(year, MAR, 20 + i)] = "Novruz"
        self._add_observed(date(year, MAR, 24))

        # Victory Day
        self[date(year, MAY, 9)] = "Victory Day over Fascism"
        self._add_observed(date(year, MAY, 9))

        # Republic Day
        self[date(year, MAY, 28)] = "Republic Day"
        self._add_observed(date(year, MAY, 28))

        # National Salvation Day
        self[date(year, JUN, 15)] = "National Salvation Day"
        self._add_observed(date(year, JUN, 15))

        # Azerbaijan Armed Forces Day
        self[date(year, JUN, 26)] = "Azerbaijan Armed Forces Day"
        self._add_observed(date(year, JUN, 26))

        # Victory Day
        if year > 2020:
            self[date(year, NOV, 8)] = "Victory Day"
            self._add_observed(date(year, NOV, 8))

        # Flag Day
        self[date(year, NOV, 9)] = "Flag Day"
        self._add_observed(date(year, NOV, 9))

        # International Solidarity Day of Azerbaijanis
        self[date(year, DEC,
                  31)] = "International Solidarity Day of Azerbaijanis"
        self._add_observed(date(year, DEC, 31))

        # Ramadan
        # Date of observance is announced yearly, This is an estimate.
        hol_date = islamic_to_gre(year, 10, 1)[0]
        self[hol_date] = "Ramadan"
        self[hol_date + rd(days=1)] = "Ramadan"
        self._add_observed(hol_date + rd(days=1))

        # Festival of the Sacrifice
        # Date of observance is announced yearly, This is an estimate.
        hol_date = islamic_to_gre(year, 12, 10)[0]
        self[hol_date] = "Festival of the Sacrifice"
        self[hol_date + rd(days=1)] = "Festival of the Sacrifice"
        self._add_observed(hol_date + rd(days=1))