Ejemplo n.º 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 get_gre_date(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 get_gre_date(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 get_gre_date(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 get_gre_date(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 get_gre_date(year, 3, 12):
            hol_date = date_obs
            self[hol_date] = "Naissance du prophet Muhammad"
Ejemplo n.º 2
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 get_gre_date(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 get_gre_date(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"
Ejemplo n.º 3
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 get_gre_date(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"
Ejemplo n.º 4
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 get_gre_date(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"
Ejemplo n.º 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 get_gre_date(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 get_gre_date(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 get_gre_date(year, 1, 1):
            hol_date = date_obs
            self[hol_date] = "1er Moharram"

        # Prophet Muhammad's Birthday - (hijari_year, 3, 12)
        for date_obs in get_gre_date(year, 3, 12):
            hol_date = date_obs
            self[hol_date] = "Aid al Mawlid Annabawi"
            self[hol_date + rd(days=1)] = "Aid al Mawlid Annabawi"
Ejemplo n.º 6
0
 def get_hrh_date(self, year):
     return get_gre_date(year, 12, 10)
Ejemplo n.º 7
0
 def get_hrp_date(self, year):
     return get_gre_date(year, 10, 1)
    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 get_gre_date(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 get_gre_date(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 get_gre_date(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 get_gre_date(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 get_gre_date(year, 3, 12):
                    hol_date = date_obs
                    self[hol_date] = '{}* (*estimated)'.format(mawlud)
Ejemplo n.º 9
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 get_gre_date(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 get_gre_date(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 get_gre_date(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 get_gre_date(year, 3, 12):
            hol_date = date_obs
            self[hol_date] = "Prophet Muhammad's Birthday"
Ejemplo n.º 10
0
    def _populate(self, year):

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

        # Chinese New Year (two days)
        hol_date = self.get_lunar_n_y_date(year)
        self[hol_date] = "Tahun Baru Imlek"
        self[hol_date + rd(days=+1)] = "Tahun Baru Imlek"

        # Day of Silence
        # https://en.wikipedia.org/wiki/Nyepi
        dates_obs = {
            2009: (MAR, 26),
            2010: (MAR, 16),
            2011: (MAR, 5),
            2012: (MAR, 23),
            2013: (MAR, 12),
            2014: (MAR, 31),
            2015: (MAR, 21),
            2016: (MAR, 9),
            2017: (MAR, 28),
            2018: (MAR, 17),
            2019: (MAR, 7),
            2020: (MAR, 25),
            2021: (MAR, 14),
            2022: (MAR, 3),
            2023: (MAR, 22),
            2024: (MAR, 11),
            2025: (MAR, 29),
            2026: (MAR, 19)
        }
        if year in dates_obs:
            hol_date = date(year, *dates_obs[year])
            self[hol_date] = "Nyepi"

        # 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)]
        }
        if year in dates_obs:
            for date_obs in dates_obs[year]:
                hol_date = date(year, *date_obs)
                self[hol_date] = "Hari Raya Idul Fitri"
                # 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 self.get_hrp_date(year):
                hol_date = date_obs
                self[hol_date] = "Hari Raya Idul Fitri* (*estimated)"
                # Second day of Hari Raya Puasa (up to and including 1968)
                if year <= 1968:
                    hol_date += rd(days=+1)
                    self[hol_date] = ("Hari kedua dari Hari Raya Idul Fitri*"
                                      " (*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)]
        }
        if year in dates_obs:
            for date_obs in dates_obs[year]:
                hol_date = date(year, *date_obs)
                self[hol_date] = "Hari Raya Idul Adha"
        else:
            for date_obs in self.get_hrh_date(year):
                hol_date = date_obs
                self[hol_date] = "Hari Raya Idul Adha* (*estimated)"

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

        # Prophet Muhammad's Birthday - (hijari_year, 3, 12)
        for date_obs in get_gre_date(year, 3, 12):
            hol_date = date_obs
            self[hol_date] = "Maulid Nabi Muhammad"

        # Ascension of the Prophet
        for date_obs in get_gre_date(year, 7, 27):
            hol_date = date_obs
            self[hol_date] = "Isra Mikraj Nabi Muhammad"

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

        # Birthday of the Buddha
        name = "Hari Raya Waisak"
        dt = self.get_solar_date(year, 4, 8)
        buddha_date = date(dt.year, dt.month, dt.day)
        self[buddha_date] = name

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

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

        # Pancasila Day
        self[date(year, JUN, 1)] = "Pancasila Day"

        # National Day
        self[date(year, AUG, 17)] = "Indonesia Independence Day"

        # Christmas Day
        self[date(year, DEC, 25)] = "Christmas Day"
Ejemplo n.º 11
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 get_gre_date(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 get_gre_date(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
Ejemplo n.º 12
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 get_gre_date(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 get_gre_date(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)"