some new features

This commit is contained in:
ilgazca
2025-07-30 18:53:50 +03:00
parent 8019bd3b7c
commit 079804a0fc
2118 changed files with 297840 additions and 502 deletions

View File

@ -0,0 +1,28 @@
# holidays
# --------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file)
# dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023
# ryanss <ryanssdev@icloud.com> (c) 2014-2017
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)
# ruff: noqa: F401
from holidays.groups.balinese_saka import BalineseSakaCalendarHolidays
from holidays.groups.buddhist import BuddhistCalendarHolidays
from holidays.groups.chinese import ChineseCalendarHolidays
from holidays.groups.christian import ChristianHolidays
from holidays.groups.custom import StaticHolidays
from holidays.groups.eastern import EasternCalendarHolidays
from holidays.groups.hebrew import HebrewCalendarHolidays
from holidays.groups.hindu import HinduCalendarHolidays
from holidays.groups.international import InternationalHolidays
from holidays.groups.islamic import IslamicHolidays
from holidays.groups.mongolian import MongolianCalendarHolidays
from holidays.groups.persian import PersianCalendarHolidays
from holidays.groups.sinhala import SinhalaCalendarHolidays
from holidays.groups.thai import ThaiCalendarHolidays

View File

@ -0,0 +1,45 @@
# holidays
# --------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file)
# dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023
# ryanss <ryanssdev@icloud.com> (c) 2014-2017
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)
from datetime import date
from typing import Optional
from holidays.calendars import _BalineseSakaLunar
class BalineseSakaCalendarHolidays:
"""
Balinese Saka lunar calendar holidays.
"""
def __init__(self) -> None:
self._balinese_saka_calendar = _BalineseSakaLunar()
def _add_balinese_saka_calendar_holiday(self, name: str, dt: Optional[date]) -> Optional[date]:
"""
Add Balinese Saka calendar holiday.
"""
if dt is None:
return None
return self._add_holiday(name, dt)
def _add_nyepi(self, name) -> Optional[date]:
"""
Add Nyepi (Day following the 9th of Dark Moon (Tilem)).
Nyepi is a Balinese "Day of Silence" that is commemorated every
Isakawarsa (Saka new year) according to the Balinese calendar.
https://en.wikipedia.org/wiki/Nyepi
"""
return self._add_balinese_saka_calendar_holiday(
name, self._balinese_saka_calendar.nyepi_date(self._year)
)

View File

@ -0,0 +1,63 @@
# holidays
# --------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file)
# dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023
# ryanss <ryanssdev@icloud.com> (c) 2014-2017
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)
from datetime import date
from typing import Optional
from holidays.calendars import _BuddhistLunisolar
from holidays.groups.eastern import EasternCalendarHolidays
class BuddhistCalendarHolidays(EasternCalendarHolidays):
"""
Buddhist lunisolar calendar holidays.
"""
def __init__(self, cls=None, show_estimated=False) -> None:
self._buddhist_calendar = cls() if cls else _BuddhistLunisolar()
self._buddhist_calendar_show_estimated = show_estimated
def _add_buddhist_calendar_holiday(
self, name: str, dt_estimated: tuple[Optional[date], bool]
) -> Optional[date]:
"""
Add Buddhist calendar holiday.
Adds customizable estimation label to holiday name if holiday date
is an estimation.
"""
return self._add_eastern_calendar_holiday(
name, dt_estimated, self._buddhist_calendar_show_estimated
)
def _add_vesak(self, name) -> Optional[date]:
"""
Add Vesak (15th day of the 4th lunar month).
Vesak for Thailand, Laos, Singapore and Indonesia.
https://en.wikipedia.org/wiki/Vesak
"""
return self._add_buddhist_calendar_holiday(
name, self._buddhist_calendar.vesak_date(self._year)
)
def _add_vesak_may(self, name) -> Optional[date]:
"""
Add Vesak (on the day of the first full moon in May
in the Gregorian calendar).
Vesak for Sri Lanka, Nepal, India, Bangladesh and Malaysia.
https://en.wikipedia.org/wiki/Vesak
"""
return self._add_buddhist_calendar_holiday(
name, self._buddhist_calendar.vesak_may_date(self._year)
)

View File

@ -0,0 +1,277 @@
# holidays
# --------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file)
# dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023
# ryanss <ryanssdev@icloud.com> (c) 2014-2017
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)
from datetime import date
from typing import Optional
from holidays.calendars.chinese import _ChineseLunisolar, CHINESE_CALENDAR
from holidays.calendars.gregorian import APR, DEC
from holidays.groups.eastern import EasternCalendarHolidays
class ChineseCalendarHolidays(EasternCalendarHolidays):
"""
Chinese lunisolar calendar holidays.
"""
def __init__(self, cls=None, show_estimated=False, calendar=CHINESE_CALENDAR) -> None:
self._chinese_calendar = (
cls(calendar=calendar) if cls else _ChineseLunisolar(calendar=calendar)
)
self._chinese_calendar_show_estimated = show_estimated
@property
def _chinese_new_year(self):
"""
Return Chinese New Year date.
"""
return self._chinese_calendar.lunar_new_year_date(self._year)[0]
@property
def _qingming_festival(self):
"""
Return Qingming Festival (15th day after the Spring Equinox) date.
"""
day = 5
if (self._year % 4 < 1) or (self._year % 4 < 2 and self._year >= 2009):
day = 4
return date(self._year, APR, day)
@property
def _mid_autumn_festival(self):
"""
Return Mid Autumn Festival (15th day of the 8th lunar month) date.
"""
return self._chinese_calendar.mid_autumn_date(self._year)[0]
@property
def _chinese_birthday_of_buddha(self):
"""
Return Add Birthday of the Buddha by Chinese lunar calendar (8th day of the
4th lunar month).
"""
return self._chinese_calendar.buddha_birthday_date(self._year)[0]
@property
def _dragon_boat_festival(self):
"""
Return Dragon Boat Festival (5th day of 5th lunar month) date.
"""
return self._chinese_calendar.dragon_boat_date(self._year)[0]
@property
def _double_ninth_festival(self):
"""
Return Double Ninth Festival (9th day of 9th lunar month) date.
"""
return self._chinese_calendar.double_ninth_date(self._year)[0]
@property
def _dongzhi_festival(self):
"""
Return Dongzhi Festival (Chinese Winter Solstice) date.
This approximation is reliable for 1952-2099 years.
"""
#
if (
(self._year % 4 == 0 and self._year >= 1988)
or (self._year % 4 == 1 and self._year >= 2021)
or (self._year % 4 == 2 and self._year >= 2058)
or (self._year % 4 == 3 and self._year >= 2091)
):
day = 21
else:
day = 22
return date(self._year, DEC, day)
def _add_chinese_calendar_holiday(
self, name: str, dt_estimated: tuple[Optional[date], bool], days_delta: int = 0
) -> Optional[date]:
"""
Add Chinese calendar holiday.
Adds customizable estimation label to holiday name if holiday date
is an estimation.
"""
return self._add_eastern_calendar_holiday(
name, dt_estimated, self._chinese_calendar_show_estimated, days_delta
)
def _add_chinese_birthday_of_buddha(self, name) -> Optional[date]:
"""
Add Birthday of the Buddha by Chinese lunar calendar (8th day of the
4th lunar month).
Birthday of the Buddha is a Buddhist festival that is celebrated in
most of East Asia and South Asia commemorating the birth of Gautama
Buddha, who was the founder of Buddhism.
https://en.wikipedia.org/wiki/Buddha's_Birthday
"""
return self._add_chinese_calendar_holiday(
name, self._chinese_calendar.buddha_birthday_date(self._year)
)
def _add_chinese_day_before_new_years_eve(self, name) -> Optional[date]:
"""
Add day before Chinese New Year's Eve (second to last day of 12th lunar month).
Chinese New Year's Eve is the day before the Chinese New Year.
https://en.wikipedia.org/wiki/Chinese_New_Year's_Eve
"""
return self._add_chinese_calendar_holiday(
name, self._chinese_calendar.lunar_new_year_date(self._year), days_delta=-2
)
def _add_chinese_new_years_eve(self, name) -> Optional[date]:
"""
Add Chinese New Year's Eve (last day of 12th lunar month).
Chinese New Year's Eve is the day before the Chinese New Year.
https://en.wikipedia.org/wiki/Chinese_New_Year's_Eve
"""
return self._add_chinese_calendar_holiday(
name, self._chinese_calendar.lunar_new_year_date(self._year), days_delta=-1
)
def _add_chinese_new_years_day(self, name) -> Optional[date]:
"""
Add Chinese New Year's Day (first day of the first lunar month).
Chinese New Year is the festival that celebrates the beginning of
a new year on the traditional lunisolar and solar Chinese calendar.
https://en.wikipedia.org/wiki/Chinese_New_Year
"""
return self._add_chinese_calendar_holiday(
name, self._chinese_calendar.lunar_new_year_date(self._year)
)
def _add_chinese_new_years_day_two(self, name) -> Optional[date]:
"""
Add Chinese New Year's Day Two.
https://en.wikipedia.org/wiki/Chinese_New_Year
"""
return self._add_chinese_calendar_holiday(
name, self._chinese_calendar.lunar_new_year_date(self._year), days_delta=+1
)
def _add_chinese_new_years_day_three(self, name) -> Optional[date]:
"""
Add Chinese New Year's Day Three.
https://en.wikipedia.org/wiki/Chinese_New_Year
"""
return self._add_chinese_calendar_holiday(
name, self._chinese_calendar.lunar_new_year_date(self._year), days_delta=+2
)
def _add_chinese_new_years_day_four(self, name) -> Optional[date]:
"""
Add Chinese New Year's Day Four.
https://en.wikipedia.org/wiki/Chinese_New_Year
"""
return self._add_chinese_calendar_holiday(
name, self._chinese_calendar.lunar_new_year_date(self._year), days_delta=+3
)
def _add_chinese_new_years_day_five(self, name) -> Optional[date]:
"""
Add Chinese New Year's Day Five.
https://en.wikipedia.org/wiki/Chinese_New_Year
"""
return self._add_chinese_calendar_holiday(
name, self._chinese_calendar.lunar_new_year_date(self._year), days_delta=+4
)
def _add_dongzhi_festival(self, name) -> Optional[date]:
"""
Add Dongzhi Festival (Chinese Winter Solstice).
The Dongzhi Festival or Winter Solstice Festival is a traditional
Chinese festival celebrated during the Dongzhi solar term
(winter solstice), which falls between December 21 and 23.
https://en.wikipedia.org/wiki/Dongzhi_Festival
"""
return self._add_holiday(name, self._dongzhi_festival)
def _add_qingming_festival(self, name) -> date:
"""
Add Qingming Festival (15th day after the Spring Equinox).
The Qingming festival or Ching Ming Festival, also known as
Tomb-Sweeping Day in English, is a traditional Chinese festival.
https://en.wikipedia.org/wiki/Qingming_Festival
"""
return self._add_holiday(name, self._qingming_festival)
def _add_double_ninth_festival(self, name) -> Optional[date]:
"""
Add Double Ninth Festival (9th day of 9th lunar month).
The Double Ninth Festival (Chongyang Festival in Mainland China
and Taiwan or Chung Yeung Festival in Hong Kong and Macau).
https://en.wikipedia.org/wiki/Double_Ninth_Festival
"""
return self._add_chinese_calendar_holiday(
name, self._chinese_calendar.double_ninth_date(self._year)
)
def _add_dragon_boat_festival(self, name) -> Optional[date]:
"""
Add Dragon Boat Festival (5th day of 5th lunar month).
The Dragon Boat Festival is a traditional Chinese holiday which occurs
on the fifth day of the fifth month of the Chinese calendar.
https://en.wikipedia.org/wiki/Dragon_Boat_Festival
"""
return self._add_chinese_calendar_holiday(
name, self._chinese_calendar.dragon_boat_date(self._year)
)
def _add_hung_kings_day(self, name) -> Optional[date]:
"""
Add Hùng Kings' Temple Festival (10th day of the 3rd lunar month).
Vietnamese festival held annually from the 8th to the 11th day of the
3rd lunar month in honour of the Hùng Kings.
https://en.wikipedia.org/wiki/Hùng_Kings'_Festival
"""
return self._add_chinese_calendar_holiday(
name, self._chinese_calendar.hung_kings_date(self._year)
)
def _add_mid_autumn_festival(self, name) -> Optional[date]:
"""
Add Mid Autumn Festival (15th day of the 8th lunar month).
The Mid-Autumn Festival, also known as the Moon Festival or
Mooncake Festival.
https://en.wikipedia.org/wiki/Mid-Autumn_Festival
"""
return self._add_chinese_calendar_holiday(
name, self._chinese_calendar.mid_autumn_date(self._year)
)
def _add_mid_autumn_festival_day_two(self, name) -> Optional[date]:
"""
Add Mid Autumn Festival Day Two (16th day of the 8th lunar month).
The Mid-Autumn Festival, also known as the Moon Festival or
Mooncake Festival.
https://en.wikipedia.org/wiki/Mid-Autumn_Festival
"""
return self._add_chinese_calendar_holiday(
name, self._chinese_calendar.mid_autumn_date(self._year), days_delta=+1
)

View File

@ -0,0 +1,463 @@
# holidays
# --------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file)
# dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023
# ryanss <ryanssdev@icloud.com> (c) 2014-2017
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)
from datetime import date
from dateutil.easter import EASTER_ORTHODOX, EASTER_WESTERN, easter
from holidays.calendars.gregorian import GREGORIAN_CALENDAR, JAN, DEC, _timedelta
from holidays.calendars.julian import JULIAN_CALENDAR
from holidays.calendars.julian_revised import JULIAN_REVISED_CALENDAR
class ChristianHolidays:
"""
Christian holidays.
"""
def __init__(self, calendar=GREGORIAN_CALENDAR) -> None:
self.__verify_calendar(calendar)
self.__calendar = calendar
def __get_christmas_day(self, calendar=None):
"""
Get Christmas Day date.
"""
calendar = calendar or self.__calendar
self.__verify_calendar(calendar)
return (
date(self._year, JAN, 7)
if self.__is_julian_calendar(calendar)
else date(self._year, DEC, 25)
)
def __get_easter_sunday(self, calendar=None):
"""
Get Easter Sunday date.
"""
calendar = calendar or self.__calendar
self.__verify_calendar(calendar)
return easter(
self._year,
method=EASTER_WESTERN if self.__is_gregorian_calendar(calendar) else EASTER_ORTHODOX,
)
@staticmethod
def __is_gregorian_calendar(calendar):
"""
Return True if `calendar` is Gregorian calendar.
Return False otherwise.
"""
return calendar == GREGORIAN_CALENDAR
@staticmethod
def __is_julian_calendar(calendar):
"""
Return True if `calendar` is Julian calendar.
Return False otherwise.
"""
return calendar == JULIAN_CALENDAR
@staticmethod
def __verify_calendar(calendar):
"""
Verify calendar type.
"""
if calendar not in {GREGORIAN_CALENDAR, JULIAN_CALENDAR, JULIAN_REVISED_CALENDAR}:
raise ValueError(
f"Unknown calendar name: {calendar}. "
f"Use `{GREGORIAN_CALENDAR}`, `{JULIAN_CALENDAR}` or `{JULIAN_REVISED_CALENDAR}`."
)
@property
def _christmas_day(self):
"""
Return Christmas Day date.
"""
return self.__get_christmas_day()
@property
def _easter_sunday(self):
"""
Return Easter Sunday date.
"""
return self.__get_easter_sunday()
def _add_all_saints_day(self, name) -> date:
"""
Add All Saints' Day (November 1st).
Also known as All Hallows' Day, the Feast of All Saints,
the Feast of All Hallows, the Solemnity of All Saints, and Hallowmas.
https://en.wikipedia.org/wiki/All_Saints'_Day
"""
return self._add_holiday_nov_1(name)
def _add_all_souls_day(self, name) -> date:
"""
Add All Souls' Day (November 2nd).
All Souls' Day is a day of prayer and remembrance for the faithful
departed, observed by certain Christian denominations on 2 November.
In Belarussian tradition it is called Dziady.
https://en.wikipedia.org/wiki/All_Souls'_Day
https://en.wikipedia.org/wiki/Dziady
"""
return self._add_holiday_nov_2(name)
def _add_ascension_thursday(self, name, calendar=None) -> date:
"""
Add Ascension Thursday (39 days after the Easter Sunday).
The Solemnity of the Ascension of Jesus Christ, also called Ascension
Day, or sometimes Holy Thursday.
https://en.wikipedia.org/wiki/Feast_of_the_Ascension
"""
return self._add_holiday(name, _timedelta(self.__get_easter_sunday(calendar), +39))
def _add_ash_monday(self, name) -> date:
"""
Add Ash Monday (48 days before Easter Sunday).
The Clean Monday, also known as Pure Monday, Monday of Lent
or Green Monday. The first day of Great Lent.
https://en.wikipedia.org/wiki/Clean_Monday
"""
return self._add_holiday(name, _timedelta(self._easter_sunday, -48))
def _add_ash_wednesday(self, name) -> date:
"""
Add Ash Wednesday (46 days before Easter Sunday).
A holy day of prayer and fasting. It marks the beginning of Lent.
https://en.wikipedia.org/wiki/Ash_Wednesday
"""
return self._add_holiday(name, _timedelta(self._easter_sunday, -46))
def _add_assumption_of_mary_day(self, name, calendar=None) -> date:
"""
Add Assumption Of Mary (August 15th).
The Feast of the Assumption of Mary, or simply The Assumption marks the
occasion of the Virgin Mary's bodily ascent to heaven at the end of
her life.
https://en.wikipedia.org/wiki/Assumption_of_Mary
"""
calendar = calendar or self.__calendar
self.__verify_calendar(calendar)
return (
self._add_holiday_aug_28(name)
if self.__is_julian_calendar(calendar)
else self._add_holiday_aug_15(name)
)
def _add_candlemas(self, name) -> date:
"""
Add Candlemas (February 2nd).
Also known as the Feast of the Presentation of Jesus Christ,
the Feast of the Purification of the Blessed Virgin Mary, or the Feast
of the Holy Encounter, is a Christian holiday commemorating the
presentation of Jesus at the Temple.
https://en.wikipedia.org/wiki/Candlemas
"""
return self._add_holiday_feb_2(name)
def _add_carnival_sunday(self, name) -> date:
"""
Add Carnival Sunday (49 days before Easter Sunday).
Carnival is a Catholic Christian festive season that occurs before
the liturgical season of Lent.
https://en.wikipedia.org/wiki/Carnival
"""
return self._add_holiday(name, _timedelta(self._easter_sunday, -49))
def _add_carnival_monday(self, name) -> date:
"""
Add Carnival Monday (48 days before Easter Sunday).
Carnival is a Catholic Christian festive season that occurs before
the liturgical season of Lent.
https://en.wikipedia.org/wiki/Carnival
"""
return self._add_holiday(name, _timedelta(self._easter_sunday, -48))
def _add_carnival_tuesday(self, name) -> date:
"""
Add Carnival Tuesday (47 days before Easter Sunday).
Carnival is a Catholic Christian festive season that occurs before
the liturgical season of Lent.
https://en.wikipedia.org/wiki/Carnival
"""
return self._add_holiday(name, _timedelta(self._easter_sunday, -47))
def _add_christmas_day(self, name, calendar=None) -> date:
"""
Add Christmas Day.
Christmas is an annual festival commemorating the birth of
Jesus Christ.
https://en.wikipedia.org/wiki/Christmas
"""
return self._add_holiday(name, self.__get_christmas_day(calendar))
def _add_christmas_day_two(self, name, calendar=None) -> date:
"""
Add Christmas Day 2.
A holiday celebrated after Christmas Day, also known as Boxing Day.
https://en.wikipedia.org/wiki/Boxing_Day
https://en.wikipedia.org/wiki/Christmas
"""
return self._add_holiday(name, _timedelta(self.__get_christmas_day(calendar), +1))
def _add_christmas_day_three(self, name, calendar=None) -> date:
"""
Add Christmas Day 3.
A holiday celebrated 2 days after Christmas Day (in some countries).
https://en.wikipedia.org/wiki/Christmas
"""
return self._add_holiday(name, _timedelta(self.__get_christmas_day(calendar), +2))
def _add_christmas_eve(self, name, calendar=None) -> date:
"""
Add Christmas Eve.
Christmas Eve is the evening or entire day before Christmas Day,
the festival commemorating the birth of Jesus Christ.
https://en.wikipedia.org/wiki/Christmas_Eve
"""
return self._add_holiday(name, _timedelta(self.__get_christmas_day(calendar), -1))
def _add_corpus_christi_day(self, name) -> date:
"""
Add Feast Of Corpus Christi (60 days after Easter Sunday).
The Feast of Corpus Christi, also known as the Solemnity of the Most
Holy Body and Blood of Christ, is a Christian liturgical solemnity
celebrating the Real Presence of the Body and Blood, Soul and Divinity
of Jesus Christ in the elements of the Eucharist.
https://en.wikipedia.org/wiki/Feast_of_Corpus_Christi
"""
return self._add_holiday(name, _timedelta(self._easter_sunday, +60))
def _add_easter_monday(self, name, calendar=None) -> date:
"""
Add Easter Monday (1 day after Easter Sunday).
Easter Monday refers to the day after Easter Sunday in either the
Eastern or Western Christian traditions. It is a public holiday in
some countries.
https://en.wikipedia.org/wiki/Easter_Monday
"""
return self._add_holiday(name, _timedelta(self.__get_easter_sunday(calendar), +1))
def _add_easter_sunday(self, name, calendar=None) -> date:
"""
Add Easter Sunday.
Easter, also called Pascha or Resurrection Sunday is a Christian
festival and cultural holiday commemorating the resurrection of Jesus
from the dead.
https://en.wikipedia.org/wiki/Easter
"""
return self._add_holiday(name, self.__get_easter_sunday(calendar))
def _add_easter_tuesday(self, name, calendar=None) -> date:
"""
Add Easter Tuesday (2 day after Easter Sunday).
Easter Tuesday is the third day of Eastertide and is a holiday in some areas.
https://en.wikipedia.org/wiki/Easter_Tuesday
"""
return self._add_holiday(name, _timedelta(self.__get_easter_sunday(calendar), +2))
def _add_epiphany_day(self, name, calendar=None) -> date:
"""
Add Epiphany Day.
Epiphany, also known as Theophany in Eastern Christian traditions,
is a Christian feast day that celebrates the revelation of God
incarnate as Jesus Christ.
https://en.wikipedia.org/wiki/Epiphany_(holiday)
"""
calendar = calendar or self.__calendar
self.__verify_calendar(calendar)
return (
self._add_holiday_jan_19(name)
if self.__is_julian_calendar(calendar)
else self._add_holiday_jan_6(name)
)
def _add_good_friday(self, name, calendar=None) -> date:
"""
Add Good Friday (2 days before Easter Sunday).
Good Friday is a Christian holiday commemorating the crucifixion of
Jesus and his death at Calvary. It is also known as Holy Friday,
Great Friday, Great and Holy Friday.
https://en.wikipedia.org/wiki/Good_Friday
"""
return self._add_holiday(name, _timedelta(self.__get_easter_sunday(calendar), -2))
def _add_holy_saturday(self, name, calendar=None) -> date:
"""
Add Holy Saturday (1 day before Easter Sunday).
Great and Holy Saturday is a day between Good Friday and Easter Sunday.
https://en.wikipedia.org/wiki/Holy_Saturday
"""
return self._add_holiday(name, _timedelta(self.__get_easter_sunday(calendar), -1))
def _add_holy_thursday(self, name, calendar=None) -> date:
"""
Add Holy Thursday (3 days before Easter Sunday).
Holy Thursday or Maundy Thursday is the day during Holy Week that
commemorates the Washing of the Feet (Maundy) and Last Supper of
Jesus Christ with the Apostles, as described in the canonical gospels.
https://en.wikipedia.org/wiki/Maundy_Thursday
"""
return self._add_holiday(name, _timedelta(self.__get_easter_sunday(calendar), -3))
def _add_immaculate_conception_day(self, name) -> date:
"""
Add Immaculate Conception Day (December 8th).
https://en.wikipedia.org/wiki/Immaculate_Conception
"""
return self._add_holiday_dec_8(name)
def _add_nativity_of_mary_day(self, name) -> date:
"""
Add Nativity Of Mary Day (September 8th).
The Nativity of the Blessed Virgin Mary, the Nativity of Mary,
the Marymas or the Birth of the Virgin Mary, refers to a Christian
feast day celebrating the birth of Mary, mother of Jesus.
https://en.wikipedia.org/wiki/Nativity_of_Mary
"""
return self._add_holiday_sep_8(name)
def _add_palm_sunday(self, name, calendar=None) -> date:
"""
Add Palm Sunday (7 days before Easter Sunday).
Palm Sunday is a Christian moveable feast that falls on the Sunday
before Easter. The feast commemorates Christ's triumphal entry into
Jerusalem, an event mentioned in each of the four canonical Gospels.
Palm Sunday marks the first day of Holy Week.
https://en.wikipedia.org/wiki/Palm_Sunday
"""
return self._add_holiday(name, _timedelta(self.__get_easter_sunday(calendar), -7))
def _add_rejoicing_day(self, name) -> date:
"""
Add Day Of Rejoicing (9 days after Easter Sunday).
Add Day Of Rejoicing ("Radonitsa"), in the Russian Orthodox Church is
a commemoration of the departed observed on the second Tuesday of
Pascha (Easter). In Ukrainian tradition it is called Provody.
https://en.wikipedia.org/wiki/Radonitsa
"""
return self._add_holiday(name, _timedelta(self._easter_sunday, +9))
def _add_saint_georges_day(self, name) -> date:
"""
Add Saint George's Day (April 23th).
Saint George's Day is celebrated on 23 April, the traditionally
accepted date of the saint's death.
https://en.wikipedia.org/wiki/Saint_George's_Day
"""
return self._add_holiday_apr_23(name)
def _add_saint_james_day(self, name) -> date:
"""
Add Saint James' Day (July 25th).
James the Great was one of the Twelve Apostles of Jesus.
https://en.wikipedia.org/wiki/James_the_Great#Feast
"""
return self._add_holiday_jul_25(name)
def _add_saint_johns_day(self, name) -> date:
"""
Add Saint John's Day (June 24th).
The Nativity of John the Baptist is a Christian feast day celebrating
the birth of John the Baptist.
https://en.wikipedia.org/wiki/Nativity_of_John_the_Baptist
"""
return self._add_holiday_jun_24(name)
def _add_saint_josephs_day(self, name) -> date:
"""
Add Saint Joseph's Day (March 19th).
Saint Joseph's Day, also called the Feast of Saint Joseph or the
Solemnity of Saint Joseph, is in Western Christianity the principal
feast day of Saint Joseph, husband of the Virgin Mary and legal father
of Jesus Christ.
https://en.wikipedia.org/wiki/Saint_Joseph's_Day
"""
return self._add_holiday_mar_19(name)
def _add_saints_peter_and_paul_day(self, name) -> date:
"""
Add Feast of Saints Peter and Paul (June 29th).
A liturgical feast in honor of the martyrdom in Rome of the apostles
Saint Peter and Saint Paul, which is observed on 29 June.
https://en.wikipedia.org/wiki/Feast_of_Saints_Peter_and_Paul
"""
return self._add_holiday_jun_29(name)
def _add_whit_monday(self, name) -> date:
"""
Add Whit Monday (50 days after Easter Sunday).
Whit Monday or Pentecost Monday, also known as Monday of the
Holy Spirit, is the holiday celebrated the day after Pentecost.
https://en.wikipedia.org/wiki/Pentecost
https://en.wikipedia.org/wiki/Whit_Monday
"""
return self._add_holiday(name, _timedelta(self._easter_sunday, +50))
def _add_whit_sunday(self, name, calendar=None) -> date:
"""
Add Whit Sunday (49 days after Easter Sunday).
Whit Sunday, also called Pentecost, is a holiday which commemorates
the descent of the Holy Spirit upon the Apostles and other followers
of Jesus Christ while they were in Jerusalem celebrating the
Feast of Weeks.
https://en.wikipedia.org/wiki/Pentecost
"""
return self._add_holiday(name, _timedelta(self.__get_easter_sunday(calendar), +49))
def _add_trinity_sunday(self, name) -> date:
"""
Add Trinity Sunday (56 days after Easter Sunday).
Trinity Sunday, also called Solemnity of Holy Trinity, is the first Sunday
after Pentecost in the Western Christian liturgical calendar, and the Sunday
of Pentecost in Eastern Christianity.
"""
return self._add_holiday(name, _timedelta(self._easter_sunday, +56))

View File

@ -0,0 +1,47 @@
# holidays
# --------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file)
# dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023
# ryanss <ryanssdev@icloud.com> (c) 2014-2017
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)
from datetime import date
from holidays.helpers import _normalize_tuple
class StaticHolidays:
"""Helper class for special and substituted holidays support.
Populates special and substituted holidays related data from
an external class.
"""
def __init__(self, cls) -> None:
for attribute_name in cls.__dict__.keys():
# Special holidays.
if attribute_name.startswith("special_") and (
value := getattr(cls, attribute_name, None)
):
setattr(self, attribute_name, value)
self.has_special_holidays = True
# Substituted holidays.
elif attribute_name.startswith("substituted_") and (
value := getattr(cls, attribute_name, None)
):
setattr(self, attribute_name, value)
self.has_substituted_holidays = True
# Populate substituted holidays from adjacent years.
self.weekend_workdays = set()
for special_public_holidays in getattr(self, "special_public_holidays", {}).values():
for special_public_holiday in _normalize_tuple(special_public_holidays):
if len(special_public_holiday) == 5: # The fifth element is the year.
_, _, from_month, from_day, from_year = special_public_holiday
self.weekend_workdays.add(date(from_year, from_month, from_day))

View File

@ -0,0 +1,51 @@
# holidays
# --------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file)
# dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023
# ryanss <ryanssdev@icloud.com> (c) 2014-2017
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)
from datetime import date
from typing import Optional
from holidays.calendars.gregorian import _timedelta
class EasternCalendarHolidays:
"""
Eastern calendar holidays base class.
"""
def _add_eastern_calendar_holiday(
self,
name: str,
dt_estimated: tuple[Optional[date], bool],
show_estimated: bool = True,
days_delta: int = 0,
) -> Optional[date]:
"""
Add Eastern (Buddhist, Chinese, Hindu, Islamic, Mongolian) calendar holiday.
Adds customizable estimation label to holiday name if holiday date is an estimation.
"""
estimated_label = getattr(self, "estimated_label", "%s (estimated)")
dt, is_estimated = dt_estimated
if days_delta and dt:
dt = _timedelta(dt, days_delta)
return (
self._add_holiday(
self.tr(estimated_label) % self.tr(name)
if is_estimated and show_estimated
else name,
dt,
)
if dt
else None
)

View File

@ -0,0 +1,151 @@
# holidays
# --------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file)
# dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023
# ryanss <ryanssdev@icloud.com> (c) 2014-2017
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)
from collections.abc import Iterable
from datetime import date
from typing import Optional, Union
from holidays.calendars import _HebrewLunisolar
from holidays.calendars.gregorian import _timedelta
class HebrewCalendarHolidays:
"""
Hebrew lunisolar calendar holidays.
"""
def __init__(self) -> None:
self._hebrew_calendar = _HebrewLunisolar()
def _add_hebrew_calendar_holiday(
self, name: str, holiday_date: date, days_delta: Union[int, Iterable[int]] = 0
) -> set[date]:
added_dates = set()
for delta in (days_delta,) if isinstance(days_delta, int) else days_delta:
if dt := self._add_holiday(name, _timedelta(holiday_date, delta)):
added_dates.add(dt)
return added_dates
def _add_hanukkah(
self, name: str, days_delta: Union[int, Iterable[int]] = 0
) -> set[Optional[date]]:
"""
Add Hanukkah.
In some Gregorian years, there may be two Hanukkah dates.
Hanukkah is a Jewish festival commemorating the recovery of Jerusalem
and subsequent rededication of the Second Temple.
https://en.wikipedia.org/wiki/Hanukkah
"""
dts = self._hebrew_calendar.hanukkah_date(self._year)
for dt in dts:
self._add_hebrew_calendar_holiday(name, dt, days_delta) # type: ignore[arg-type]
return dts
def _add_lag_baomer(self, name: str, days_delta: Union[int, Iterable[int]] = 0) -> set[date]:
"""
Add Lag BaOmer.
Lag BaOmer, also Lag B'Omer or Lag LaOmer, is a Jewish religious holiday celebrated
on the 33rd day of the Counting of the Omer, which occurs on the 18th day of
the Hebrew month of Iyar.
https://en.wikipedia.org/wiki/Lag_BaOmer
"""
return self._add_hebrew_calendar_holiday(
name,
self._hebrew_calendar.lag_baomer_date(self._year), # type: ignore[arg-type]
days_delta,
)
def _add_passover(self, name: str, days_delta: Union[int, Iterable[int]] = 0) -> set[date]:
"""
Add Passover.
Passover, also called Pesach, is a major Jewish holiday and one of the Three Pilgrimage
Festivals. It celebrates the Exodus of the Israelites from slavery in Egypt.
https://en.wikipedia.org/wiki/Passover
"""
return self._add_hebrew_calendar_holiday(
name,
self._hebrew_calendar.passover_date(self._year), # type: ignore[arg-type]
days_delta,
)
def _add_purim(self, name: str) -> set[date]:
"""
Add Purim.
Purim is a Jewish holiday that commemorates the saving of the Jewish people
from annihilation at the hands of an official of the Achaemenid Empire named Haman,
as it is recounted in the Book of Esther.
https://en.wikipedia.org/wiki/Purim
"""
return self._add_hebrew_calendar_holiday(
name,
self._hebrew_calendar.purim_date(self._year), # type: ignore[arg-type]
)
def _add_rosh_hashanah(
self, name: str, days_delta: Union[int, Iterable[int]] = 0
) -> set[date]:
"""
Add Rosh Hashanah.
Rosh Hashanah is the New Year in Judaism.
https://en.wikipedia.org/wiki/Rosh_Hashanah
"""
return self._add_hebrew_calendar_holiday(
name,
self._hebrew_calendar.rosh_hashanah_date(self._year), # type: ignore[arg-type]
days_delta,
)
def _add_shavuot(self, name: str) -> set[date]:
"""
Add Shavuot.
Shavuot, or Shvues, is a Jewish holiday, one of the biblically ordained
Three Pilgrimage Festivals. It occurs on the sixth day of the Hebrew month of Sivan.
https://en.wikipedia.org/wiki/Shavuot
"""
return self._add_hebrew_calendar_holiday(
name,
self._hebrew_calendar.shavuot_date(self._year), # type: ignore[arg-type]
)
def _add_sukkot(self, name: str, days_delta: Union[int, Iterable[int]] = 0) -> set[date]:
"""
Add Sukkot.
Sukkot, also known as the Feast of Tabernacles or Feast of Booths, is a Torah-commanded
holiday celebrated for seven days, beginning on the 15th day of the month of Tishrei.
https://en.wikipedia.org/wiki/Sukkot
"""
return self._add_hebrew_calendar_holiday(
name,
self._hebrew_calendar.sukkot_date(self._year), # type: ignore[arg-type]
days_delta,
)
def _add_yom_kippur(self, name: str, days_delta: Union[int, Iterable[int]] = 0) -> set[date]:
"""
Add Yom Kippur.
Yom Kippur (Day of Atonement) is the holiest day of the year in Judaism.
It occurs annually on the 10th of Tishrei.
https://en.wikipedia.org/wiki/Yom_Kippur
"""
return self._add_hebrew_calendar_holiday(
name,
self._hebrew_calendar.yom_kippur_date(self._year), # type: ignore[arg-type]
days_delta,
)

View File

@ -0,0 +1,481 @@
# holidays
# --------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file)
# dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023
# ryanss <ryanssdev@icloud.com> (c) 2014-2017
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)
from collections.abc import Iterable
from datetime import date
from typing import Optional
from holidays.calendars import _HinduLunisolar
from holidays.groups.eastern import EasternCalendarHolidays
class HinduCalendarHolidays(EasternCalendarHolidays):
"""
Hindu lunisolar calendar holidays.
"""
def __init__(self, cls=None, show_estimated=False) -> None:
self._hindu_calendar = cls() if cls else _HinduLunisolar()
self._hindu_calendar_show_estimated = show_estimated
def _add_hindu_calendar_holiday(
self, name: str, dt_estimated: tuple[Optional[date], bool], days_delta: int = 0
) -> Optional[date]:
"""
Add Hindu calendar holiday.
Adds customizable estimation label to holiday name if holiday date
is an estimation.
"""
return self._add_eastern_calendar_holiday(
name, dt_estimated, self._hindu_calendar_show_estimated, days_delta
)
def _add_hindu_calendar_holiday_set(
self, name: str, dts_estimated: Iterable[tuple[date, bool]], days_delta: int = 0
) -> set[date]:
"""
Add Hindu calendar holidays.
Adds customizable estimation label to holiday name if holiday date
is an estimation.
"""
added_dates = set()
for dt_estimated in dts_estimated:
if dt := self._add_eastern_calendar_holiday(
name, dt_estimated, self._hindu_calendar_show_estimated, days_delta=days_delta
):
added_dates.add(dt)
return added_dates
def _add_bhai_dooj(self, name) -> Optional[date]:
"""
Add Bhai Dooj.
Bhai Dooj, also known as Bhai Tika or Bhaiya Dooj, is a Hindu festival celebrating the bond
between brothers and sisters. It is observed two days after Diwali on the second lunar day
of the Shukla Paksha in the Hindu month of Kartika.
"""
return self._add_hindu_calendar_holiday(
name, self._hindu_calendar.govardhan_puja_date(self._year), days_delta=+1
)
def _add_buddha_purnima(self, name) -> Optional[date]:
"""
Add Buddha Purnima.
Buddha Purnima, also known as Vesak, commemorates the birth, enlightenment,
and passing of Gautama Buddha. It falls on the full moon day of the
Hindu month of Vaisakha (April-May).
https://en.wikipedia.org/wiki/Vesak
"""
return self._add_hindu_calendar_holiday(
name, self._hindu_calendar.buddha_purnima_date(self._year)
)
def _add_chhath_puja(self, name) -> Optional[date]:
"""
Add Chhath Puja.
Chhath Puja is a Hindu festival dedicated to the Sun God (Surya).
It is observed six days after Diwali in the month of Kartika (October-November).
https://en.wikipedia.org/wiki/Chhath
"""
return self._add_hindu_calendar_holiday(
name, self._hindu_calendar.chhath_puja_date(self._year)
)
def _add_diwali(self, name) -> Optional[date]:
"""
Add Diwali Festival.
Diwali (Deepavali, Festival of Lights) is one of the most important
festivals in Indian religions. It is celebrated during the Hindu
lunisolar months of Ashvin and Kartika (between mid-October and
mid-November).
https://en.wikipedia.org/wiki/Diwali
"""
return self._add_hindu_calendar_holiday(name, self._hindu_calendar.diwali_date(self._year))
def _add_diwali_india(self, name) -> Optional[date]:
return self._add_hindu_calendar_holiday(
name, self._hindu_calendar.diwali_india_date(self._year)
)
def _add_dussehra(self, name) -> Optional[date]:
"""
Add Dussehra Festival.
Dussehra (Vijayadashami) is a major Hindu festival that marks the end
of Navratri. It is celebrated on the 10th day of the Hindu lunisolar
month of Ashvin (September-October).
https://en.wikipedia.org/wiki/Vijayadashami
"""
return self._add_hindu_calendar_holiday(
name, self._hindu_calendar.dussehra_date(self._year)
)
def _add_ganesh_chaturthi(self, name) -> Optional[date]:
"""
Add Ganesh Chaturthi.
Ganesh Chaturthi is a Hindu festival celebrating the birth of Lord Ganesha.
It falls on the fourth day of the Hindu month of Bhadrapada (August/September).
https://en.wikipedia.org/wiki/Ganesh_Chaturthi
"""
return self._add_hindu_calendar_holiday(
name, self._hindu_calendar.ganesh_chaturthi_date(self._year)
)
def _add_gau_krida(self, name) -> Optional[date]:
"""
Add Gau Krida.
Gau Krida, is celebrated the day after Diwali to honor cows.
"""
return self._add_hindu_calendar_holiday(
name, self._hindu_calendar.govardhan_puja_date(self._year), days_delta=-1
)
def _add_govardhan_puja(self, name) -> Optional[date]:
"""
Add Govardhan Puja.
Govardhan Puja, also known as Annakut, is celebrated after Diwali
to honor Lord Krishna. It falls on the first lunar day of the Hindu month of Kartika.
https://en.wikipedia.org/wiki/Govardhan_Puja
"""
return self._add_hindu_calendar_holiday(
name, self._hindu_calendar.govardhan_puja_date(self._year)
)
def _add_gudi_padwa(self, name) -> Optional[date]:
"""
Add Gudi Padwa.
Gudi Padwa is the traditional New Year festival for Maharashtrians.
It falls on the first day of Chaitra (March-April).
https://en.wikipedia.org/wiki/Gudi_Padwa
"""
return self._add_hindu_calendar_holiday(
name, self._hindu_calendar.gudi_padwa_date(self._year)
)
def _add_guru_gobind_singh_jayanti(self, name) -> set[date]:
"""
Add Guru Gobind Singh Jayanti.
Guru Gobind Singh Jayanti commemorates the birth anniversary of
Guru Gobind Singh, the tenth Sikh Guru. It follows the Nanakshahi calendar.
https://en.wikipedia.org/wiki/Guru_Gobind_Singh
"""
return self._add_hindu_calendar_holiday_set(
name, self._hindu_calendar.guru_gobind_singh_jayanti_date(self._year)
)
def _add_guru_nanak_jayanti(self, name) -> Optional[date]:
"""
Add Guru Nanak Jayanti.
Guru Nanak Jayanti celebrates the birth anniversary of Guru Nanak,
the founder of Sikhism. It is observed on the full moon day of
Kartik (October-November).
https://en.wikipedia.org/wiki/Guru_Nanak_Gurpurab
"""
return self._add_hindu_calendar_holiday(
name, self._hindu_calendar.guru_nanak_jayanti_date(self._year)
)
def _add_gyalpo_losar(self, name) -> Optional[date]:
"""
Add Gyalpo Losar.
Gyalpo Losar marks the Tibetan New Year and is widely celebrated by the
Tibetan and Sherpa communities in Nepal. It falls on the first day of the
Tibetan lunar calendar, typically in February or March.
https://en.wikipedia.org/wiki/Gyalpo_Losar
"""
return self._add_hindu_calendar_holiday(
name, self._hindu_calendar.gyalpo_losar_date(self._year)
)
def _add_nepal_holi(self, name) -> Optional[date]:
"""
Add Holi Festival for Nepal (Mountain & Hilly).
Holi, known as the Festival of Colors, is a Hindu festival that marks
the arrival of spring. It is celebrated on the full moon day of the
Hindu month of Phalguna (February/March).
https://en.wikipedia.org/wiki/Holi
"""
return self._add_hindu_calendar_holiday(
name, self._hindu_calendar.holi_date(self._year), days_delta=-1
)
def _add_holi(self, name) -> Optional[date]:
"""
Add Holi Festival.
Holi, known as the Festival of Colors, is a Hindu festival that marks
the arrival of spring. It is celebrated on the full moon day of the
Hindu month of Phalguna (February/March).
https://en.wikipedia.org/wiki/Holi
"""
return self._add_hindu_calendar_holiday(name, self._hindu_calendar.holi_date(self._year))
def _add_janmashtami(self, name) -> Optional[date]:
"""
Add Janmashtami.
Janmashtami is a Hindu festival that celebrates the birth of Lord Krishna.
It falls on the eighth day of the Hindu month of Bhadrapada (August/September).
https://en.wikipedia.org/wiki/Krishna_Janmashtami
"""
return self._add_hindu_calendar_holiday(
name, self._hindu_calendar.janmashtami_date(self._year)
)
def _add_maha_saptami(self, name) -> Optional[date]:
"""
Add Maha Saptami.
Maha Saptami is the seventh day of Navratri, dedicated to Goddess Durga.
It is observed in Ashvin (September-October).
https://en.wikipedia.org/wiki/Navaratri
"""
return self._add_hindu_calendar_holiday(
name, self._hindu_calendar.maha_ashtami_date(self._year), days_delta=-1
)
def _add_maha_ashtami(self, name) -> Optional[date]:
"""
Add Maha Ashtami.
Maha Ashtami is the eighth day of Navratri, dedicated to Goddess Durga.
It is observed in Ashvin (September-October).
https://en.wikipedia.org/wiki/Navaratri
"""
return self._add_hindu_calendar_holiday(
name, self._hindu_calendar.maha_ashtami_date(self._year)
)
def _add_maha_navami(self, name) -> Optional[date]:
"""
Add Maha Navami.
Maha Navami is the ninth day of Navratri, dedicated to Goddess Durga.
It is observed in Ashvin (September-October).
https://en.wikipedia.org/wiki/Navaratri
"""
return self._add_hindu_calendar_holiday(
name, self._hindu_calendar.maha_navami_date(self._year)
)
def _add_maha_shivaratri(self, name) -> Optional[date]:
"""
Add Maha Shivaratri.
Maha Shivaratri is a Hindu festival dedicated to Lord Shiva. It is celebrated
on the 14th night of the Hindu month of Phalguna (February/March).
https://en.wikipedia.org/wiki/Maha_Shivaratri
"""
return self._add_hindu_calendar_holiday(
name, self._hindu_calendar.maha_shivaratri_date(self._year)
)
def _add_mahavir_jayanti(self, name) -> Optional[date]:
"""
Add Mahavir Jayanti.
Mahavir Jayanti celebrates the birth of Lord Mahavira, the 24th
Tirthankara of Jainism. It falls on the 13th day of Chaitra (March-April).
https://en.wikipedia.org/wiki/Mahavir_Jayanti
"""
return self._add_hindu_calendar_holiday(
name, self._hindu_calendar.mahavir_jayanti_date(self._year)
)
def _add_makar_sankranti(self, name) -> Optional[date]:
"""
Add Makar Sankranti.
Makar Sankranti is a Hindu festival that marks the transition of the Sun
into Capricorn (Makar). It is celebrated on January 14th or 15th every year.
https://en.wikipedia.org/wiki/Makar_Sankranti
"""
return self._add_hindu_calendar_holiday(
name, self._hindu_calendar.makar_sankranti_date(self._year)
)
def _add_onam(self, name) -> Optional[date]:
"""
Add Onam.
Onam is a major festival in Kerala, celebrating the homecoming of
King Mahabali. It falls in the month of Chingam (August-September).
https://en.wikipedia.org/wiki/Onam
"""
return self._add_hindu_calendar_holiday(name, self._hindu_calendar.onam_date(self._year))
def _add_papankusha_ekadashi(self, name) -> Optional[date]:
"""
Add Papankusha Ekadashi.
Papankusha Ekadashi is a Hindu festival which occurs on eleventh day on month of
Ashwin (September-October).
https://en.wikipedia.org/wiki/Ekadashi
"""
return self._add_hindu_calendar_holiday(
name, self._hindu_calendar.dussehra_date(self._year), days_delta=+1
)
def _add_papankusha_duwadashi(self, name) -> Optional[date]:
"""
Add Papankusha Duwadashi.
Papankusha Duwadashi is a Hindu festival which occurs next day of Papankusha Ekadashi.
https://en.wikipedia.org/wiki/Ekadashi
"""
return self._add_hindu_calendar_holiday(
name, self._hindu_calendar.dussehra_date(self._year), days_delta=+2
)
def _add_pongal(self, name) -> Optional[date]:
"""
Add Pongal.
Pongal is a major harvest festival celebrated in Tamil Nadu, India, marking the
beginning of the sun's northward journey (Uttarayana). It is usually observed
on January 14th or 15th every year, coinciding with the Tamil month of Thai.
The festival is dedicated to the Sun God and marks a season of prosperity and abundance.
https://en.wikipedia.org/wiki/Pongal_(festival)
"""
return self._add_hindu_calendar_holiday(name, self._hindu_calendar.pongal_date(self._year))
def _add_raksha_bandhan(self, name) -> Optional[date]:
"""
Add Raksha Bandhan.
Raksha Bandhan is a Hindu festival that celebrates the bond between
brothers and sisters. It falls on the full moon day of the Hindu month
of Shravana (July/August).
https://en.wikipedia.org/wiki/Raksha_Bandhan
"""
return self._add_hindu_calendar_holiday(
name, self._hindu_calendar.raksha_bandhan_date(self._year)
)
def _add_ram_navami(self, name) -> Optional[date]:
"""
Add Ram Navami.
Ram Navami is a Hindu festival celebrating the birth of Lord Rama.
It is observed on the ninth day of the Hindu month of Chaitra (March/April).
https://en.wikipedia.org/wiki/Rama_Navami
"""
return self._add_hindu_calendar_holiday(
name, self._hindu_calendar.ram_navami_date(self._year)
)
def _add_sharad_navratri(self, name) -> Optional[date]:
"""
Add Navratri / Sharad Navratri.
Navratri is a Hindu festival dedicated to the worship of Goddess Durga.
It is celebrated over nine nights and occurs in the lunar month of Ashvin
(September/October).
https://en.wikipedia.org/wiki/Navratri
"""
return self._add_hindu_calendar_holiday(
name, self._hindu_calendar.sharad_navratri_date(self._year)
)
def _add_sonam_losar(self, name) -> Optional[date]:
"""
Add Sonam Losar.
Sonam Losar is the New Year festival celebrated by the Tamang community
in Nepal. It follows the Tibetan lunar calendar and usually falls in
January or February.
https://en.wikipedia.org/wiki/Sonam_Lhosar
"""
return self._add_hindu_calendar_holiday(
name, self._hindu_calendar.sonam_losar_date(self._year)
)
def _add_tamu_losar(self, name) -> Optional[date]:
"""
Add Tamu Losar.
Tamu Losar marks the New Year festival of the Gurung community in Nepal.
It is traditionally celebrated on December 30th each year.
https://en.wikipedia.org/wiki/Tamu_Lhosar
"""
return self._add_hindu_calendar_holiday(
name, self._hindu_calendar.tamu_losar_date(self._year)
)
def _add_thaipusam(self, name) -> Optional[date]:
"""
Add Thaipusam.
Thaipusam is a Tamil Hindu festival celebrated on the full moon
of the Tamil month of Thai (January/February).
https://en.wikipedia.org/wiki/Thaipusam
"""
return self._add_hindu_calendar_holiday(
name, self._hindu_calendar.thaipusam_date(self._year)
)
def _add_thiruvalluvar_day(self, name) -> Optional[date]:
"""
Add Thiruvalluvar Day and Mattu Pongal.
Thiruvalluvar Day and Mattu Pongal are celebrated in Tamil Nadu, India, as part
of the Pongal festival. Thiruvalluvar Day honors the classical Tamil poet and
philosopher Thiruvalluvar, while Mattu Pongal is dedicated to cattle, recognizing
their importance in agriculture. Both events usually fall on January 15th or 16th
each year during the Tamil month of Thai.
https://en.wikipedia.org/wiki/Thiruvalluvar_Day
https://en.wikipedia.org/wiki/Pongal_(festival)#Mattu_Pongal
"""
return self._add_hindu_calendar_holiday(
name, self._hindu_calendar.pongal_date(self._year), days_delta=+1
)
def _add_uzhavar_thirunal(self, name) -> Optional[date]:
"""
Add Uzhavar Thirunal.
Uzhavar Thirunal is a harvest festival celebrated in Tamil Nadu, India,
as part of the Pongal festivities. It is dedicated to honoring farmers
(uzhavar) and their contribution to agriculture. Uzhavar Thirunal usually
falls on January 16th or 17th each year.
https://en.wikipedia.org/wiki/Pongal_(festival)#Uzhavar_Thirunal
"""
return self._add_hindu_calendar_holiday(
name, self._hindu_calendar.pongal_date(self._year), days_delta=+2
)
def _add_vaisakhi(self, name) -> Optional[date]:
"""
Add Vaisakhi.
Vaisakhi is a major Sikh festival marking the Sikh New Year and the
founding of the Khalsa. It falls on April 13 or 14.
https://en.wikipedia.org/wiki/Vaisakhi
"""
return self._add_hindu_calendar_holiday(
name, self._hindu_calendar.vaisakhi_date(self._year)
)

View File

@ -0,0 +1,220 @@
# holidays
# --------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file)
# dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023
# ryanss <ryanssdev@icloud.com> (c) 2014-2017
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)
from datetime import date
from holidays.calendars.gregorian import JAN
class InternationalHolidays:
"""
International holidays.
"""
@property
def _next_year_new_years_day(self):
"""
Return New Year's Day of next year.
"""
return date(self._year + 1, JAN, 1)
def _add_africa_day(self, name):
"""
Add Africa Day (May 25th)
Africa Day (formerly African Freedom Day and African Liberation Day)
is the annual commemoration of the foundation of the Organisation
of African Unity on 25 May 1963.
https://en.wikipedia.org/wiki/Africa_Day
"""
return self._add_holiday_may_25(name)
def _add_anzac_day(self, name):
"""
Add Anzac Day (April 25th)
Anzac Day is a national day of remembrance in Australia and New Zealand
that broadly commemorates all Australians and New Zealanders "who
served and died in all wars, conflicts, and peacekeeping operations"
and "the contribution and suffering of all those who have served".
Anzac Day is a public holiday in Australia, New Zealand, and Tonga; it
used to be a public holiday in Samoa up until 2008.
https://en.wikipedia.org/wiki/Anzac_Day
"""
return self._add_holiday_apr_25(name)
def _add_childrens_day(self, name, variation="JUN"):
"""
Add International Children's Day (June 1).
In 1925, International Children's Day was first proclaimed in Geneva
during the World Conference on Child Welfare. Since 1950, it is
celebrated on June 1 in many countries.
As such, this entry currently defaults to June 1, though this also
supports another internationally adopted variant, November 20th.
https://en.wikipedia.org/wiki/Children's_Day
"""
if variation == "JUN":
return self._add_holiday_jun_1(name)
elif variation == "NOV":
return self._add_holiday_nov_20(name)
else:
raise ValueError(
f"Unknown variation name: {variation}. "
"This entry currently supports `JUN` and `NOV` variation only."
)
def _add_columbus_day(self, name):
"""
Add Columbus Day (October 12th)
Columbus Day is a national holiday which officially celebrates the
anniversary of Christopher Columbus's arrival in the Americas.
https://en.wikipedia.org/wiki/Columbus_Day
"""
return self._add_holiday_oct_12(name)
def _add_europe_day(self, name):
"""
Add Europe Day (May 9th)
Europe Day is a day celebrating "peace and unity in Europe"
celebrated on 5 May by the Council of Europe
and on 9 May by the European Union.
https://en.wikipedia.org/wiki/Europe_Day
"""
return self._add_holiday_may_9(name)
def _add_labor_day(self, name):
"""
Add International Workers' Day (May 1st)
International Workers' Day, also known as Labour Day, is a celebration
of labourers and the working classes that is promoted by the
international labour movement.
https://en.wikipedia.org/wiki/International_Workers'_Day
"""
return self._add_holiday_may_1(name)
def _add_labor_day_two(self, name):
"""
Add International Workers' Day Two (May 2nd)
https://en.wikipedia.org/wiki/International_Workers'_Day
"""
return self._add_holiday_may_2(name)
def _add_labor_day_three(self, name):
"""
Add International Workers' Day Three (May 3rd)
https://en.wikipedia.org/wiki/International_Workers'_Day
"""
return self._add_holiday_may_3(name)
def _add_new_years_day(self, name) -> date:
"""
Add New Year's Day (January 1st).
New Year's Day is a festival observed in most of the world on
1 January, the first day of the year in the modern Gregorian calendar.
https://en.wikipedia.org/wiki/New_Year's_Day
"""
return self._add_holiday_jan_1(name)
def _add_new_years_day_two(self, name) -> date:
"""
Add New Year's Day Two (January 2nd).
New Year's Day is a festival observed in most of the world on
1 January, the first day of the year in the modern Gregorian calendar.
https://en.wikipedia.org/wiki/New_Year's_Day
"""
return self._add_holiday_jan_2(name)
def _add_new_years_day_three(self, name) -> date:
"""
Add New Year's Day Three (January 3rd).
New Year's Day is a festival observed in most of the world on
1 January, the first day of the year in the modern Gregorian calendar.
https://en.wikipedia.org/wiki/New_Year's_Day
"""
return self._add_holiday_jan_3(name)
def _add_new_years_day_four(self, name) -> date:
"""
Add New Year's Day Four (January 4th).
New Year's Day is a festival observed in most of the world on
1 January, the first day of the year in the modern Gregorian calendar.
https://en.wikipedia.org/wiki/New_Year's_Day
"""
return self._add_holiday_jan_4(name)
def _add_remembrance_day(self, name):
"""
Add Remembrance Day / Armistice Day (Nov 11th)
It's a memorial day since the end of the First World War in 1919
to honour armed forces members who have died in the line of duty.
https://en.wikipedia.org/wiki/Remembrance_Day
"""
return self._add_holiday_nov_11(name)
def _add_new_years_eve(self, name) -> date:
"""
Add New Year's Eve (December 31st).
In the Gregorian calendar, New Year's Eve, also known as Old Year's
Day or Saint Sylvester's Day in many countries, is the evening or the
entire day of the last day of the year, on 31 December.
https://en.wikipedia.org/wiki/New_Year's_Eve
"""
return self._add_holiday_dec_31(name)
def _add_womens_day(self, name):
"""
Add International Women's Day (March 8th).
International Women's Day is a global holiday celebrated as a focal
point in the women's rights movement, bringing attention to issues
such as gender equality, reproductive rights, and violence and abuse
against women.
https://en.wikipedia.org/wiki/International_Women's_Day
"""
return self._add_holiday_mar_8(name)
def _add_world_war_two_victory_day(self, name, is_western=True):
"""
Add Day of Victory in World War II in Europe (May 8).
https://en.wikipedia.org/wiki/Victory_in_Europe_Day
Some Eastern European countries celebrate Victory Day on May 9.
https://en.wikipedia.org/wiki/Victory_Day_(9_May)
"""
if is_western:
return self._add_holiday_may_8(name)
else:
return self._add_holiday_may_9(name)
def _add_united_nations_day(self, name):
"""
Add United Nations Day (Oct 24th)
United Nations Day is an annual commemorative day, reflecting the
official creation of the United Nations on 24 October 1945.
https://en.wikipedia.org/wiki/United_Nations_Day
"""
return self._add_holiday_oct_24(name)

View File

@ -0,0 +1,453 @@
# holidays
# --------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file)
# dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023
# ryanss <ryanssdev@icloud.com> (c) 2014-2017
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)
from collections.abc import Iterable
from datetime import date
from holidays.calendars import _IslamicLunar
from holidays.groups.eastern import EasternCalendarHolidays
class IslamicHolidays(EasternCalendarHolidays):
"""
Islamic holidays.
The Hijri calendar also known as Islamic calendar, is a lunar
calendar consisting of 12 lunar months in a year of 354 or 355 days.
"""
def __init__(self, cls=None, show_estimated=True) -> None:
self._islamic_calendar = cls() if cls else _IslamicLunar()
self._islamic_calendar_show_estimated = show_estimated
def _add_ali_al_rida_death_day(self, name) -> set[date]:
"""
Add death of Ali al-Rida day (last (29th or 30th) day of 2nd month).
https://en.wikipedia.org/wiki/Ali_al-Rida
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.ali_al_rida_death_dates(self._year)
)
def _add_ali_birthday_day(self, name) -> set[date]:
"""
Add birthday of Ali ibn Abu Talib day (13th day of 7th month).
https://en.wikipedia.org/wiki/Ali
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.ali_birthday_dates(self._year)
)
def _add_ali_death_day(self, name) -> set[date]:
"""
Add death of Ali ibn Abu Talib day (21st day of 9th month).
https://en.wikipedia.org/wiki/Ali
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.ali_death_dates(self._year)
)
def _add_arbaeen_day(self, name) -> set[date]:
"""
Add Arbaeen day (20th day of 2nd month).
https://en.wikipedia.org/wiki/Arbaeen
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.arbaeen_dates(self._year)
)
def _add_arafah_day(self, name) -> set[date]:
"""
Add Day of Arafah (9th day of 12th month).
At dawn of this day, Muslim pilgrims will make their way from Mina
to a nearby hillside and plain called Mount Arafat and the Plain of
Arafat.
https://en.wikipedia.org/wiki/Day_of_Arafah
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.eid_al_adha_dates(self._year), days_delta=-1
)
def _add_ashura_day(self, name) -> set[date]:
"""
Add Ashura Day (10th day of 1st month).
Ashura is a day of commemoration in Islam. It occurs annually on the
10th of Muharram, the first month of the Islamic calendar.
https://en.wikipedia.org/wiki/Ashura
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.ashura_dates(self._year)
)
def _add_ashura_eve(self, name) -> set[date]:
"""
Add Ashura Eve (Day before the 10th day of 1st month).
Ashura is a day of commemoration in Islam. It occurs annually on the
10th of Muharram, the first month of the Islamic calendar.
https://en.wikipedia.org/wiki/Ashura
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.ashura_dates(self._year), days_delta=-1
)
def _add_eid_al_adha_day(self, name) -> set[date]:
"""
Add Eid al-Adha Day (10th day of the 12th month of Islamic calendar).
Feast of the Sacrifice. It honours the willingness of Ibrahim
(Abraham) to sacrifice his son Ismail (Ishmael) as an act of obedience
to Allah's command.
https://en.wikipedia.org/wiki/Eid_al-Adha
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.eid_al_adha_dates(self._year)
)
def _add_eid_al_adha_day_two(self, name) -> set[date]:
"""
Add Eid al-Adha Day Two.
https://en.wikipedia.org/wiki/Eid_al-Adha
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.eid_al_adha_dates(self._year), days_delta=+1
)
def _add_eid_al_adha_day_three(self, name) -> set[date]:
"""
Add Eid al-Adha Day Three.
https://en.wikipedia.org/wiki/Eid_al-Adha
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.eid_al_adha_dates(self._year), days_delta=+2
)
def _add_eid_al_adha_day_four(self, name) -> set[date]:
"""
Add Eid al-Adha Day Four.
https://en.wikipedia.org/wiki/Eid_al-Adha
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.eid_al_adha_dates(self._year), days_delta=+3
)
def _add_eid_al_fitr_day(self, name) -> set[date]:
"""
Add Eid al-Fitr Day (1st day of 10th month of Islamic calendar).
Holiday of Breaking the Fast. The religious holiday is celebrated
by Muslims worldwide because it marks the end of the month-long
dawn-to-sunset fasting of Ramadan.
https://en.wikipedia.org/wiki/Eid_al-Fitr
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.eid_al_fitr_dates(self._year)
)
def _add_eid_al_fitr_day_two(self, name) -> set[date]:
"""
Add Eid al-Fitr Day Two.
https://en.wikipedia.org/wiki/Eid_al-Fitr
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.eid_al_fitr_dates(self._year), days_delta=+1
)
def _add_eid_al_fitr_day_three(self, name) -> set[date]:
"""
Add Eid al-Fitr Day Three.
https://en.wikipedia.org/wiki/Eid_al-Fitr
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.eid_al_fitr_dates(self._year), days_delta=+2
)
def _add_eid_al_fitr_day_four(self, name) -> set[date]:
"""
Add Eid al-Fitr Day Four.
https://en.wikipedia.org/wiki/Eid_al-Fitr
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.eid_al_fitr_dates(self._year), days_delta=+3
)
def _add_eid_al_fitr_eve(self, name) -> set[date]:
"""
Add Eid al-Fitr Eve (last day of 9th month of Islamic calendar).
https://en.wikipedia.org/wiki/Eid_al-Fitr
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.eid_al_fitr_dates(self._year), days_delta=-1
)
def _add_eid_al_ghadir_day(self, name) -> set[date]:
"""
Add Eid al-Ghadir Day (18th day of 12th month).
https://en.wikipedia.org/wiki/Eid_al-Ghadeer
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.eid_al_ghadir_dates(self._year)
)
def _add_fatima_death_day(self, name) -> set[date]:
"""
Add death of Fatima day (3rd day of 6th month).
https://en.wikipedia.org/wiki/Fatima
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.fatima_death_dates(self._year)
)
def _add_grand_magal_of_touba(self, name) -> set[date]:
"""
Annual religious pilgrimage of Senegalese Mouride brotherhood.
https://en.wikipedia.org/wiki/Grand_Magal_of_Touba
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.grand_magal_of_touba_dates(self._year)
)
def _add_hari_hol_johor(self, name) -> set[date]:
"""
Hari Hol Johor.
https://web.archive.org/web/20241202170507/https://publicholidays.com.my/hari-hol-almarhum-sultan-iskandar/
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.hari_hol_johor_dates(self._year)
)
def _add_hasan_al_askari_death_day(self, name) -> set[date]:
"""
Add death of Hasan_al-Askari day (8th day of 3rd month).
https://en.wikipedia.org/wiki/Hasan_al-Askari
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.hasan_al_askari_death_dates(self._year)
)
def _add_holiday_29_ramadan(self, name) -> set[date]:
"""
Add 29th Ramadan holiday.
https://web.archive.org/web/20250323065556/https://decree.om/2022/rd20220088/
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.ramadan_beginning_dates(self._year), days_delta=+28
)
def _add_imam_mahdi_birthday_day(self, name) -> set[date]:
"""
Add birthday of Muhammad al-Mahdi day (15th day of 8th month).
https://en.wikipedia.org/wiki/Muhammad_al-Mahdi
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.imam_mahdi_birthday_dates(self._year)
)
def _add_islamic_calendar_holiday(
self, name: str, dates: Iterable[tuple[date, bool]], days_delta: int = 0
) -> set[date]:
"""
Add lunar calendar holiday.
Appends customizable estimation label at the end of holiday name if
holiday date is an estimation.
"""
added_dates = set()
for dts in dates:
if dt := self._add_eastern_calendar_holiday(
name, dts, self._islamic_calendar_show_estimated, days_delta
):
added_dates.add(dt)
return added_dates
def _add_islamic_new_year_day(self, name) -> set[date]:
"""
Add Islamic New Year Day (last day of Dhu al-Hijjah).
The Islamic New Year, also called the Hijri New Year, is the day that
marks the beginning of a new lunar Hijri year, and is the day on which
the year count is incremented. The first day of the Islamic year is
observed by most Muslims on the first day of the month of Muharram.
https://en.wikipedia.org/wiki/Islamic_New_Year
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.hijri_new_year_dates(self._year)
)
def _add_isra_and_miraj_day(self, name):
"""
Add Isra' and Mi'raj Day (27th day of 7th month).
The Prophet's Ascension.
https://en.wikipedia.org/wiki/Isra'_and_Mi'raj
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.isra_and_miraj_dates(self._year)
)
def _add_laylat_al_qadr_day(self, name):
"""
Add Laylat al-Qadr Day (27th day of 9th month).
The Night of Power.
https://en.wikipedia.org/wiki/Night_of_Power
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.laylat_al_qadr_dates(self._year)
)
def _add_maldives_embraced_islam_day(self, name) -> set[date]:
"""
Add Maldives Embraced Islam Day (1st day of 4th month).
https://en.wikipedia.org/wiki/Islam_in_Maldives
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.maldives_embraced_islam_day_dates(self._year)
)
def _add_mawlid_day(self, name) -> set[date]:
"""
Add Mawlid Day (12th day of 3rd month).
Mawlid is the observance of the birthday of the Islamic prophet
Muhammad.
https://en.wikipedia.org/wiki/Mawlid
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.mawlid_dates(self._year)
)
def _add_mawlid_day_two(self, name) -> set[date]:
"""
Add Mawlid Day Two.
Mawlid is the observance of the birthday of the Islamic prophet
Muhammad.
https://en.wikipedia.org/wiki/Mawlid
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.mawlid_dates(self._year), days_delta=+1
)
def _add_nuzul_al_quran_day(self, name) -> set[date]:
"""
Add Nuzul Al Quran (17th day of 9th month).
Nuzul Al Quran is a Muslim festival to remember the day when Prophet
Muhammad received his first revelation of Islam's sacred book,
the holy Quran.
https://web.archive.org/web/20241012115752/https://zamzam.com/blog/nuzul-al-quran/
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.nuzul_al_quran_dates(self._year)
)
def _add_prophet_baptism_day(self, name) -> set[date]:
"""
Add Prophet's Baptism.
Celebrated one week after the Prophet Mohammed's Birthday, this
marks the traditional Islamic birth rites that take place seven
days after birth. While it is not recognized in mainstream Islam,
Mali celebrates it as a cultural-religious public holiday that
reflects the local interpretation and honor of the Prophet Muhammad.
The term "baptism" is symbolic and not literal - there's no Islamic
ritual akin to Christian baptism.
https://www.officeholidays.com/holidays/mali/prophets-baptism
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.mawlid_dates(self._year), days_delta=+7
)
def _add_prophet_death_day(self, name) -> set[date]:
"""
Add death of Prophet Muhammad and Hasan ibn Ali day (28th day of 2nd month).
https://en.wikipedia.org/wiki/Hasan_ibn_Ali
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.prophet_death_dates(self._year)
)
def _add_quamee_dhuvas_day(self, name) -> set[date]:
"""
Add Quamee Dhuvas (1st day of 3rd month).
https://en.wikipedia.org/wiki/Qaumee_Dhuvas_(Maldives_National_Day)
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.quamee_dhuvas_dates(self._year)
)
def _add_ramadan_beginning_day(self, name) -> set[date]:
"""
Add First Day of Ramadan (1st day of 9th month).
Ramadan is the ninth month of the Islamic calendar, observed by Muslims
worldwide as a month of fasting, prayer, reflection, and community
https://en.wikipedia.org/wiki/Ramadan
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.ramadan_beginning_dates(self._year)
)
def _add_sadiq_birthday_day(self, name) -> set[date]:
"""
Add birthday of Prophet Muhammad and Ja'far al-Sadiq day (17th day of 3rd month).
https://en.wikipedia.org/wiki/Ja'far_al-Sadiq
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.sadiq_birthday_dates(self._year)
)
def _add_sadiq_death_day(self, name) -> set[date]:
"""
Add death of Ja'far al-Sadiq day (25th day of 10th month).
https://en.wikipedia.org/wiki/Ja'far_al-Sadiq
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.sadiq_death_dates(self._year)
)
def _add_tasua_day(self, name) -> set[date]:
"""
Add Tasua day (9th day of 1st month).
https://en.wikipedia.org/wiki/Tasua
"""
return self._add_islamic_calendar_holiday(
name, self._islamic_calendar.tasua_dates(self._year)
)

View File

@ -0,0 +1,103 @@
# holidays
# --------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file)
# dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023
# ryanss <ryanssdev@icloud.com> (c) 2014-2017
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)
from datetime import date
from typing import Optional
from holidays.calendars import _MongolianLunisolar
from holidays.groups.eastern import EasternCalendarHolidays
class MongolianCalendarHolidays(EasternCalendarHolidays):
"""
Mongolian lunisolar calendar holidays.
"""
def __init__(self, cls=None, show_estimated=False) -> None:
self._mongolian_calendar = cls() if cls else _MongolianLunisolar()
self._mongolian_calendar_show_estimated = show_estimated
def _add_mongolian_calendar_holiday(
self, name: str, dt_estimated: tuple[Optional[date], bool], days_delta: int = 0
) -> Optional[date]:
"""
Add Mongolian calendar holiday.
Adds customizable estimation label to holiday name if holiday date
is an estimation.
"""
return self._add_eastern_calendar_holiday(
name, dt_estimated, self._mongolian_calendar_show_estimated, days_delta
)
def _add_buddha_day(self, name) -> Optional[date]:
"""
Add Buddha Day.
Buddha Day is celebrated on the 15th day of the early summer month
in the Mongolian lunisolar calendar.
This holiday honors the birth, enlightenment, and death of Buddha.
https://en.wikipedia.org/wiki/Vesak (general Buddhist context)
"""
return self._add_mongolian_calendar_holiday(
name, self._mongolian_calendar.buddha_day_date(self._year)
)
def _add_genghis_khan_day(self, name) -> Optional[date]:
"""
Add Genghis Khan's Birthday.
Genghis Khan's Birthday is observed on the 1st day of the early winter month
according to the Mongolian lunisolar calendar.
It commemorates the birth of the founder of the Mongol Empire.
https://en.wikipedia.org/wiki/Genghis_Khan
"""
return self._add_mongolian_calendar_holiday(
name, self._mongolian_calendar.genghis_khan_day_date(self._year)
)
def _add_tsagaan_sar(self, name) -> Optional[date]:
"""
Add Tsagaan Sar (Mongolian Lunar New Year).
Tsagaan Sar, or White Moon Festival, marks the beginning of the Mongolian Lunar New Year.
It usually falls on the first day of the first month of the Mongolian lunisolar calendar.
https://en.wikipedia.org/wiki/Tsagaan_Sar
"""
return self._add_mongolian_calendar_holiday(
name, self._mongolian_calendar.tsagaan_sar_date(self._year)
)
def _add_tsagaan_sar_day_2(self, name) -> Optional[date]:
"""
Add Tsagaan Sar Day 2 (Mongolian Lunar New Year).
Tsagaan Sar, or White Moon Festival, marks the beginning of the Mongolian Lunar New Year.
It usually falls on the first day of the first month of the Mongolian lunisolar calendar.
https://en.wikipedia.org/wiki/Tsagaan_Sar
"""
return self._add_mongolian_calendar_holiday(
name, self._mongolian_calendar.tsagaan_sar_date(self._year), days_delta=+1
)
def _add_tsagaan_sar_day_3(self, name) -> Optional[date]:
"""
Add Tsagaan Sar Day 3 (Mongolian Lunar New Year).
Tsagaan Sar, or White Moon Festival, marks the beginning of the Mongolian Lunar New Year.
It usually falls on the first day of the first month of the Mongolian lunisolar calendar.
https://en.wikipedia.org/wiki/Tsagaan_Sar
"""
return self._add_mongolian_calendar_holiday(
name, self._mongolian_calendar.tsagaan_sar_date(self._year), days_delta=+2
)

View File

@ -0,0 +1,169 @@
# holidays
# --------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file)
# dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023
# ryanss <ryanssdev@icloud.com> (c) 2014-2017
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)
from datetime import date
from typing import Optional
from holidays.calendars.gregorian import _timedelta
from holidays.calendars.persian import _Persian
class PersianCalendarHolidays:
"""
Persian (Solar Hijri) calendar holidays.
"""
def __init__(self) -> None:
self._persian_calendar = _Persian()
def _add_death_of_khomeini_day(self, name: str) -> Optional[date]:
"""
Add Death of Ruhollah Khomeini Day (14th day of the 3rd month).
Ayatollah Ruhollah Khomeini was an Iranian revolutionary, politician and religious leader.
https://en.wikipedia.org/wiki/Ruhollah_Khomeini
"""
return self._add_persian_calendar_holiday(
name, self._persian_calendar.persian_to_gregorian(self._year, 3, 14)
)
def _add_islamic_emirat_victory_day(self, name: str) -> Optional[date]:
"""
Add Islamic Emirate Victory Day (24th day of the 5th month).
Anniversary of the Taliban forces arrival in Kabul.
https://en.wikipedia.org/wiki/Fall_of_Kabul_(2021)
"""
return self._add_persian_calendar_holiday(
name, self._persian_calendar.persian_to_gregorian(self._year, 5, 24)
)
def _add_islamic_republic_day(self, name: str) -> Optional[date]:
"""
Add Islamic Republic Day (12th day of the 1st month).
Iranian Islamic Republic Day is a national and a public holiday in Iran. It marks the day
that the results of the March 1979 Iranian Islamic Republic referendum were announced.
https://en.wikipedia.org/wiki/Islamic_Republic_Day
"""
return self._add_persian_calendar_holiday(
name, self._persian_calendar.persian_to_gregorian(self._year, 1, 12)
)
def _add_islamic_revolution_day(self, name: str) -> Optional[date]:
"""
Add Islamic Revolution Day (22nd day of the 11th month).
The anniversary of the Iranian Revolution commemorates the protests that led to
the downfall of the Pahlavi dynasty and the installation of the Islamic Revolutionary
which is headed by Imam Khomeini.
https://en.wikipedia.org/wiki/Anniversary_of_Islamic_Revolution
"""
return self._add_persian_calendar_holiday(
name, self._persian_calendar.persian_to_gregorian(self._year - 1, 11, 22)
)
def _add_khordad_uprising_day(self, name: str) -> Optional[date]:
"""
Add 15 Khordad uprising Day (15th day of the 3rd month).
The demonstrations of June 5 and 6, also called the events of June 1963 or (using
the Iranian calendar) the 15 Khordad uprising were protests in Iran against the arrest
of Ayatollah Ruhollah Khomeini.
https://en.wikipedia.org/wiki/June_5,_1963_demonstrations_in_Iran
"""
return self._add_persian_calendar_holiday(
name, self._persian_calendar.persian_to_gregorian(self._year, 3, 15)
)
def _add_last_day_of_year(self, name: str) -> Optional[date]:
"""
If previous year is a leap year, its 12th month (Esfand) has 30 days,
and this 30th day is a holiday.
"""
if self._persian_calendar.is_leap_year(self._year - 1):
return self._add_persian_calendar_holiday(
name, self._persian_calendar.new_year_date(self._year), days_delta=-1
)
else:
return None
def _add_natures_day(self, name: str) -> Optional[date]:
"""
Add Nature's Day, or Sizdah Bedar (13th day of the 1st month).
Nature's Day is an Iranian festival, during which people spend time picnicking outdoors.
https://en.wikipedia.org/wiki/Sizdah_Be-dar
"""
return self._add_persian_calendar_holiday(
name, self._persian_calendar.persian_to_gregorian(self._year, 1, 13)
)
def _add_nowruz_day(self, name: str) -> Optional[date]:
"""
Add Nowruz Day (1st day of the 1st month).
Nowruz (Iranian or Persian New Year) is a festival based on the Iranian Solar Hijri
calendar, on the spring equinox.
https://en.wikipedia.org/wiki/Nowruz
"""
return self._add_persian_calendar_holiday(
name, self._persian_calendar.new_year_date(self._year)
)
def _add_nowruz_day_two(self, name: str) -> Optional[date]:
"""
Add Nowruz Day Two.
"""
return self._add_persian_calendar_holiday(
name, self._persian_calendar.new_year_date(self._year), days_delta=+1
)
def _add_nowruz_day_three(self, name: str) -> Optional[date]:
"""
Add Nowruz Day Three.
"""
return self._add_persian_calendar_holiday(
name, self._persian_calendar.new_year_date(self._year), days_delta=+2
)
def _add_nowruz_day_four(self, name: str) -> Optional[date]:
"""
Add Nowruz Day Four.
"""
return self._add_persian_calendar_holiday(
name, self._persian_calendar.new_year_date(self._year), days_delta=+3
)
def _add_oil_nationalization_day(self, name: str) -> Optional[date]:
"""
Add Iranian Oil Industry Nationalization Day (29th day of the 12th month).
The nationalization of the Iranian oil industry resulted from a movement in the Iranian
parliament (Majlis) to seize control of Iran's oil industry.
https://en.wikipedia.org/wiki/Nationalization_of_the_Iranian_oil_industry
"""
return self._add_persian_calendar_holiday(
name, self._persian_calendar.persian_to_gregorian(self._year - 1, 12, 29)
)
def _add_persian_calendar_holiday(
self, name: str, dt: Optional[date], days_delta: int = 0
) -> Optional[date]:
"""
Add Persian calendar holiday.
"""
if dt is None:
return None
if days_delta != 0:
dt = _timedelta(dt, days_delta)
return self._add_holiday(name, dt)

View File

@ -0,0 +1,192 @@
# holidays
# --------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file)
# dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023
# ryanss <ryanssdev@icloud.com> (c) 2014-2017
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)
from collections.abc import Iterable
from datetime import date
from typing import Optional
from holidays.calendars import _SinhalaLunar
from holidays.groups.eastern import EasternCalendarHolidays
class SinhalaCalendarHolidays(EasternCalendarHolidays):
"""
Sinhala holidays.
Sinhala Buddhist Uposatha day calculation method is different from Thai LuniSolar
and Buddhist (Mahayana) used in East Asia.
Due to the fact that Poya (Uposatha) days are calculated astronomically
based on how close a particular day is closest to full moon at noon, and that
an extra month is added every 33 months interval, this is hardcoded for now.
Adhi month dates are instead hardcoded in Sri Lanka country implementation.
"""
def __init__(self, cls=None, show_estimated=False) -> None:
self._sinhala_calendar = cls() if cls else _SinhalaLunar()
self._sinhala_calendar_show_estimated = show_estimated
def _add_sinhala_calendar_holiday(
self, name: str, dt_estimated: tuple[Optional[date], bool]
) -> Optional[date]:
"""
Add Sinhala calendar holiday.
Adds customizable estimation label to holiday name if holiday date
is an estimation.
"""
return self._add_eastern_calendar_holiday(
name, dt_estimated, self._sinhala_calendar_show_estimated
)
def _add_sinhala_calendar_holiday_set(
self, name: str, dts_estimated: Iterable[tuple[date, bool]], days_delta: int = 0
) -> set[date]:
"""
Add Sinhala calendar holidays.
Adds customizable estimation label to holiday name if holiday date
is an estimation.
"""
added_dates = set()
for dt_estimated in dts_estimated:
if dt := self._add_eastern_calendar_holiday(
name, dt_estimated, self._sinhala_calendar_show_estimated, days_delta=days_delta
):
added_dates.add(dt)
return added_dates
def _add_bak_poya(self, name) -> Optional[date]:
"""
Add Bak Poya (first full moon day of the 5th lunar month).
https://web.archive.org/web/20250417183100/https://us.lakpura.com/pages/bak-poya
"""
return self._add_sinhala_calendar_holiday(
name, self._sinhala_calendar.bak_poya_date(self._year)
)
def _add_binara_poya(self, name) -> Optional[date]:
"""
Add Binara Poya (first full moon day of the 10th lunar month).
https://web.archive.org/web/20250415144613/https://us.lakpura.com/pages/binara-poya
"""
return self._add_sinhala_calendar_holiday(
name, self._sinhala_calendar.binara_poya_date(self._year)
)
def _add_duruthu_poya(self, name) -> set[date]:
"""
Add Duruthu Poya (first full moon day of the 2nd lunar month).
https://web.archive.org/web/20250417123343/https://us.lakpura.com/pages/duruthu-poya
"""
return self._add_sinhala_calendar_holiday_set(
name, self._sinhala_calendar.duruthu_poya_date(self._year)
)
def _add_esala_poya(self, name) -> Optional[date]:
"""
Add Esala Poya (first full moon day of the 8th lunar month).
https://web.archive.org/web/20250415231927/https://us.lakpura.com/pages/esala-poya
"""
return self._add_sinhala_calendar_holiday(
name, self._sinhala_calendar.esala_poya_date(self._year)
)
def _add_il_poya(self, name) -> Optional[date]:
"""
Add Il Poya (first full moon day of the 12th lunar month).
Also known as "Ill Poya"
https://web.archive.org/web/20250415054940/https://us.lakpura.com/pages/il-poya
"""
return self._add_sinhala_calendar_holiday(
name, self._sinhala_calendar.il_poya_date(self._year)
)
def _add_medin_poya(self, name) -> Optional[date]:
"""
Add Medin Poya (first full moon day of the 4th lunar month).
https://web.archive.org/web/20250415154545/https://us.lakpura.com/pages/medin-poya
"""
return self._add_sinhala_calendar_holiday(
name, self._sinhala_calendar.medin_poya_date(self._year)
)
def _add_nawam_poya(self, name) -> Optional[date]:
"""
Add Nawam Poya (first full moon day of the 3rd lunar month).
Also known as "Navam Poya" and "Magha Puja".
https://web.archive.org/web/20250416122014/https://us.lakpura.com/pages/navam-poya
"""
return self._add_sinhala_calendar_holiday(
name, self._sinhala_calendar.nawam_poya_date(self._year)
)
def _add_nikini_poya(self, name) -> Optional[date]:
"""
Add Nikini Poya (first full moon day of the 9th lunar month).
https://web.archive.org/web/20241204065104/https://us.lakpura.com/pages/nikini-poya
"""
return self._add_sinhala_calendar_holiday(
name, self._sinhala_calendar.nikini_poya_date(self._year)
)
def _add_poson_poya(self, name) -> Optional[date]:
"""
Add Poson Poya (first full moon day of the 7th lunar month).
https://web.archive.org/web/20250416105848/https://us.lakpura.com/pages/poson
"""
return self._add_sinhala_calendar_holiday(
name, self._sinhala_calendar.poson_poya_date(self._year)
)
def _add_unduvap_poya(self, name) -> Optional[date]:
"""
Add Unduvap Poya (first full moon day of the 1st lunar month).
Also known as "Undawap Poya".
https://web.archive.org/web/20250413191847/https://us.lakpura.com/pages/unduvap-poya
"""
return self._add_sinhala_calendar_holiday(
name, self._sinhala_calendar.unduvap_poya_date(self._year)
)
def _add_vap_poya(self, name) -> Optional[date]:
"""
Add Vap Poya (first full moon day of the 11th lunar month).
https://web.archive.org/web/20250418083429/https://us.lakpura.com/pages/vap-poya
"""
return self._add_sinhala_calendar_holiday(
name, self._sinhala_calendar.vap_poya_date(self._year)
)
def _add_vesak_poya(self, name) -> Optional[date]:
"""
Add Vesak Poya (first full moon day of the 6th lunar month).
Also known as "Wesak Poya".
https://web.archive.org/web/20250419054525/https://us.lakpura.com/pages/vesak
"""
return self._add_sinhala_calendar_holiday(
name, self._sinhala_calendar.vesak_poya_date(self._year)
)

View File

@ -0,0 +1,206 @@
# holidays
# --------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file)
# dr-prodigy <dr.prodigy.github@gmail.com> (c) 2017-2023
# ryanss <ryanssdev@icloud.com> (c) 2014-2017
# Website: https://github.com/vacanza/holidays
# License: MIT (see LICENSE file)
from datetime import date
from typing import Optional
from holidays.calendars.thai import THAI_CALENDAR, _ThaiLunisolar
class ThaiCalendarHolidays:
"""
Thai lunisolar calendar holidays.
For more info, see class `_ThaiLunisolar`.
Calendar-type checking are done by `_ThaiLunisolar`.
"""
def __init__(self, calendar=THAI_CALENDAR) -> None:
self.__calendar = calendar
self._thai_calendar = _ThaiLunisolar(calendar)
def _add_asarnha_bucha(self, name) -> Optional[date]:
"""
Add Asarnha Bucha.
Asalha Pūjā (also written as Asarnha Bucha Day) is a Buddhist festival
celebrated on the 15th Waxing Day (Full Moon) of Month 8.
https://en.wikipedia.org/wiki/Asalha_Puja
"""
return self._add_thai_calendar_holiday(
name, self._thai_calendar.asarnha_bucha_date(self._year)
)
def _add_boun_haw_khao_padapdin(self, name) -> Optional[date]:
"""
Add Boun Haw Khao Padapdin.
Boun Haw Khao Padapdin (also known as Rice Growing Festival)
is a Buddhist festival celebrated on the 14th Waning Day of Month 9.
https://web.archive.org/web/20250415072547/https://www.timsthailand.com/boon-khao-pradap-din/
"""
return self._add_thai_calendar_holiday(
name, self._thai_calendar.boun_haw_khao_padapdin_date(self._year)
)
def _add_boun_haw_khao_salark(self, name) -> Optional[date]:
"""
Add Boun Haw Khao Salark.
Boun Haw Khao Salark (also known as Ancestor Festival)
is a Buddhist festival celebrated on the 15th Waxing Day of Month 10.
https://web.archive.org/web/20250414145714/https://www.timsthailand.com/boon-khao-sak/
"""
return self._add_thai_calendar_holiday(
name, self._thai_calendar.boun_haw_khao_salark_date(self._year)
)
def _add_boun_suang_heua(self, name) -> Optional[date]:
"""
Add Boun Suang Huea.
Boun Suang Huea Nakhone Luang Prabang (also known as Vientiane Boat Racing Festival)
is a Buddhist festival celebrated on the 1st Waning Day of Month 11.
https://web.archive.org/web/20250413191357/https://sonasia-holiday.com/sonabee/laos-boat-racing-festival
"""
return self._add_thai_calendar_holiday(
name, self._thai_calendar.boun_suang_heua_date(self._year)
)
def _add_khao_phansa(self, name) -> Optional[date]:
"""
Add Khao Phansa.
Start of Buddhist Lent (also written as Khao Phansa Day) is a Buddhist
festival celebrated on the 1st Waning Day of Month 8.
https://en.wikipedia.org/wiki/Vassa
"""
return self._add_thai_calendar_holiday(
name, self._thai_calendar.khao_phansa_date(self._year)
)
def _add_loy_krathong(self, name) -> Optional[date]:
"""
Add Loy Krathong.
Also known as "Boun That Louang" and "Bon Om Touk".
This concides with the 15th Waxing Day (Full Moon) of Month 12
in Thai Lunar Calendar.
https://en.wikipedia.org/wiki/Loy_Krathong
https://en.wikipedia.org/wiki/Bon_Om_Touk
"""
return self._add_thai_calendar_holiday(
name, self._thai_calendar.loy_krathong_date(self._year)
)
def _add_makha_bucha(self, name, calendar=None) -> Optional[date]:
"""
Add Makha Bucha.
Māgha Pūjā (also written as Makha Bousa and Meak Bochea Day) is a Buddhist
festival celebrated on the 15th Waxing Day (Full Moon) of Month 3.
Khmer variant: always fall on Month 3.
Thai variant: will use Month 4 instead for Athikamat years.
https://en.wikipedia.org/wiki/Māgha_Pūjā
"""
calendar = calendar or self.__calendar
return self._add_thai_calendar_holiday(
name, self._thai_calendar.makha_bucha_date(self._year, calendar)
)
def _add_ok_phansa(self, name) -> Optional[date]:
"""
Add Ok Phansa.
End of Buddhist Lent (also written as Ok Phansa Day) is a Buddhist
festival celebrated on the 15th Waxing Day of Month 11.
https://en.wikipedia.org/wiki/Pavarana
"""
return self._add_thai_calendar_holiday(
name, self._thai_calendar.ok_phansa_date(self._year)
)
def _add_pchum_ben(self, name) -> Optional[date]:
"""
Add Pchum Ben.
Also known as "Prachum Bandar".
This concides with the 15th Waning Day (New Moon) of Month 10 in
Thai Lunar Calendar.
https://en.wikipedia.org/wiki/Pchum_Ben
"""
return self._add_thai_calendar_holiday(
name, self._thai_calendar.pchum_ben_date(self._year)
)
def _add_preah_neangkoal(self, name) -> Optional[date]:
"""
Add Preah Reach Pithi Chrat Preah Neangkoal.
Also known as "Cambodian Royal Ploughing Ceremony". This always
concides with the 4th Waning Day of Month 6 in Khmer Lunar Calendar.
https://en.wikipedia.org/wiki/Royal_Ploughing_Ceremony
"""
return self._add_thai_calendar_holiday(
name, self._thai_calendar.preah_neangkoal_date(self._year)
)
def _add_thai_calendar_holiday(self, name, dt) -> Optional[date]:
"""
Add Thai calendar holiday.
If the result from `_ThaiLunisolar` is none then no holidays added.
"""
if dt is None:
return None
return self._add_holiday(name, dt)
def _add_visakha_bucha(self, name, calendar=None) -> Optional[date]:
"""
Add Visakha Bucha.
Vesak (also written as Visakha Bousa Day and Visaka Bochea Day) is a
Buddhist festival celebrated on the 15th Waxing Day (Full Moon)
of Month 6.
Khmer variant: always fall on Month 6.
Thai variant: will use Month 7 instead for Athikamat years.
https://en.wikipedia.org/wiki/Vesak
"""
calendar = calendar or self.__calendar
return self._add_thai_calendar_holiday(
name, self._thai_calendar.visakha_bucha_date(self._year, calendar)
)