+
Skip to content

Add Palestine holidays #2701

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Jul 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d9a7453
Initial commit
Wasif-Shahzad Jul 5, 2025
61c0acc
Merge remote-tracking branch 'upstream/dev' into palestine-holidays
Wasif-Shahzad Jul 5, 2025
dd5c415
Update country count in README.md
Wasif-Shahzad Jul 5, 2025
ee3669a
Remove (estimated) label, migrate Christmases and Easters to PUBLIC c…
Wasif-Shahzad Jul 5, 2025
078e2ed
add review suggestions: estimated label, web archived links, typo
Wasif-Shahzad Jul 5, 2025
c0c1b8f
Fix Easter, translations
Wasif-Shahzad Jul 7, 2025
a936e02
Merge remote-tracking branch 'upstream/dev' into palestine-holidays
Wasif-Shahzad Jul 7, 2025
944e2ec
Update country count
Wasif-Shahzad Jul 7, 2025
e6e1db2
Update Epiphany en_US translation
Wasif-Shahzad Jul 8, 2025
aae9c6e
Merge remote-tracking branch 'upstream/dev' into palestine-holidays
Wasif-Shahzad Jul 8, 2025
f9e0cfc
Update project-ID version in PS.po files
Wasif-Shahzad Jul 8, 2025
892d061
add review suggestions: update test cases, minor translation fixes
Wasif-Shahzad Jul 8, 2025
88b0697
REFORMAT
Wasif-Shahzad Jul 8, 2025
f263994
Reformat dt, test_orthodox_new_years_day
Wasif-Shahzad Jul 8, 2025
5ba8931
Merge remote-tracking branch 'upstream/dev' into palestine-holidays
Wasif-Shahzad Jul 9, 2025
adcf503
Update country count
Wasif-Shahzad Jul 9, 2025
aaf54bd
remove redundant translation in ar/PS.po
Wasif-Shahzad Jul 9, 2025
661ba45
Fixed Pentecost translation
Wasif-Shahzad Jul 9, 2025
58bb30c
Merge remote-tracking branch 'upstream/dev' into palestine-holidays
Wasif-Shahzad Jul 9, 2025
a6a48d8
Update en_US/PS.po header
Wasif-Shahzad Jul 9, 2025
9962c0b
Fix arabic characters
Wasif-Shahzad Jul 9, 2025
e347a4f
REFORMAT
Wasif-Shahzad Jul 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ and detailed information.

## Available Countries

We currently support 209 country codes. The standard way to refer to a country is by using its [ISO
We currently support 210 country codes. The standard way to refer to a country is by using its [ISO
3166-1 alpha-2 code](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes), the same used
for domain names, and for a subdivision its [ISO 3166-2
code](https://en.wikipedia.org/wiki/ISO_3166-2). Some countries have common or foreign names or
Expand Down Expand Up @@ -1148,6 +1148,13 @@ any) in brackets, available languages and additional holiday categories. All cou
<td>ARMED_FORCES, HALF_DAY</td>
</tr>
<tr>
<td>Palestine</td>
<td>PS</td>
<td></td>
<td><strong>ar</strong>, en_US</td>
<td>CATHOLIC, ORTHODOX</td>
</tr>
<tr>
<td>Panama</td>
<td>PA</td>
<td></td>
Expand Down
1 change: 1 addition & 0 deletions holidays/countries/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
from holidays.countries.oman import Oman, OM, OMN
from holidays.countries.pakistan import Pakistan, PK, PAK
from holidays.countries.palau import Palau, PW, PLW
from holidays.countries.palestine import Palestine, PS, PSE
from holidays.countries.panama import Panama, PA, PAN
from holidays.countries.papua_new_guinea import PapuaNewGuinea, PG, PNG
from holidays.countries.paraguay import Paraguay, PY, PRY
Expand Down
177 changes: 177 additions & 0 deletions holidays/countries/palestine.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
# 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 gettext import gettext as tr

from holidays.calendars import _CustomIslamicHolidays
from holidays.calendars.gregorian import GREGORIAN_CALENDAR, SEP
from holidays.calendars.julian import JULIAN_CALENDAR
from holidays.constants import CATHOLIC, ORTHODOX, PUBLIC
from holidays.groups import ChristianHolidays, InternationalHolidays, IslamicHolidays
from holidays.holiday_base import HolidayBase


class Palestine(HolidayBase, ChristianHolidays, InternationalHolidays, IslamicHolidays):
"""Palestine holidays.

References:
* <https://en.wikipedia.org/wiki/Public_holidays_in_Palestine>
* <https://web.archive.org/web/20250705114216/https://info.wafa.ps/pages/details/29601>
* [Declaration of Palestine independence](https://en.wikipedia.org/wiki/Palestine#Uprising,_declaration_and_peace_treaty)
"""

country = "PS"
default_language = "ar"
# %s (estimated).
estimated_label = tr("%s (المقدرة)")
# State of Palestine declared in November 1988.
start_year = 1989
supported_categories = (CATHOLIC, ORTHODOX, PUBLIC)
supported_languages = ("ar", "en_US")

def __init__(self, *args, islamic_show_estimated: bool = False, **kwargs):
"""
Args:
islamic_show_estimated:
Whether to add "estimated" label to Islamic holidays name
if holiday date is estimated.
"""
ChristianHolidays.__init__(self, calendar=JULIAN_CALENDAR)
InternationalHolidays.__init__(self)
IslamicHolidays.__init__(
self, cls=PalestineIslamicHolidays, show_estimated=islamic_show_estimated
)
super().__init__(*args, **kwargs)

def _populate_public_holidays(self):
# New Year's Day.
self._add_new_years_day(tr("رأس السنة الميلادي"))

# Orthodox Christmas Day.
self._add_christmas_day(tr("عيد الميلاد المجيد الشرقي"))

# International Women's Day.
self._add_womens_day(tr("يوم المراة العالمي"))

# Easter.
self._add_easter_sunday(tr("عيد الفصح المجيد"), GREGORIAN_CALENDAR)

# Easter.
self._add_easter_sunday(tr("عيد الفصح المجيد"))

# Labor Day.
self._add_labor_day(tr("عيد العمال"))

# Independence Day.
self._add_holiday_nov_15(tr("عيد الإستقلال"))

# Catholic Christmas Day.
self._add_christmas_day(tr("عيد الميلاد المجيد الغربي"), GREGORIAN_CALENDAR)

# Hijri New Year.
self._add_islamic_new_year_day(tr("رأس السنة الهجرية"))

# Prophet's Birthday.
self._add_mawlid_day(tr("ذكرى المولد النبوي الشريف"))

# Isra' and Mi'raj.
self._add_isra_and_miraj_day(tr("ذكرى الإسراء والمعراج"))

# Eid al-Fitr.
name = tr("عيد الفطر السعيد")
self._add_eid_al_fitr_day(name)
self._add_eid_al_fitr_day_two(name)
self._add_eid_al_fitr_day_three(name)

# Eid al-Adha.
name = tr("عيد الأضحى المبارك")
self._add_eid_al_adha_day(name)
self._add_eid_al_adha_day_two(name)
self._add_eid_al_adha_day_three(name)
self._add_eid_al_adha_day_four(name)

def _populate_catholic_holidays(self):
# New Year's Day.
self._add_new_years_day(tr("رأس السنة الميلادي"))

# Epiphany.
self._add_epiphany_day(tr("عيد الغطاس"), GREGORIAN_CALENDAR)

# Palm Sunday.
self._add_palm_sunday(tr("أحد الشعانين"), GREGORIAN_CALENDAR)

# Holy Thursday.
self._add_holy_thursday(tr("خميس الغسل"), GREGORIAN_CALENDAR)

# Good Friday.
self._add_good_friday(tr("الجمعة العظيمة"), GREGORIAN_CALENDAR)

# Holy Saturday.
self._add_holy_saturday(tr("سبت النور"), GREGORIAN_CALENDAR)

# Easter.
self._add_easter_monday(tr("عيد الفصح المجيد"), GREGORIAN_CALENDAR)

# Ascension Day.
self._add_ascension_thursday(tr("خميس الصعود"), GREGORIAN_CALENDAR)

# Pentecost.
self._add_whit_sunday(tr("أحد العنصرة"), GREGORIAN_CALENDAR)

# Catholic Christmas Day.
self._add_christmas_day_two(tr("عيد الميلاد المجيد الغربي"), GREGORIAN_CALENDAR)

def _populate_orthodox_holidays(self):
# Orthodox New Year's Day.
self._add_holiday_jan_14(tr("عيد رأس السنة الشرقي"))

# Orthodox Christmas Day.
self._add_christmas_day_two(tr("عيد الميلاد المجيد الشرقي"))

# Epiphany.
self._add_epiphany_day(tr("عيد الغطاس"))

# Palm Sunday.
self._add_palm_sunday(tr("أحد الشعانين"))

# Holy Thursday.
self._add_holy_thursday(tr("خميس الغسل"))

# Good Friday.
self._add_good_friday(tr("الجمعة العظيمة"))

# Holy Saturday.
self._add_holy_saturday(tr("سبت النور"))

# Easter.
self._add_easter_monday(tr("عيد الفصح المجيد"))

# Ascension Day.
self._add_ascension_thursday(tr("خميس الصعود"))

# Pentecost.
self._add_whit_sunday(tr("أحد العنصرة"))


class PS(Palestine):
pass


class PSE(Palestine):
pass


class PalestineIslamicHolidays(_CustomIslamicHolidays):
# All other dates follow Umm al-Qura calendar.
MAWLID_DATES = {
2023: (SEP, 27),
}
20 changes: 10 additions & 10 deletions holidays/groups/christian.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,15 @@ def _add_all_souls_day(self, name) -> date:
"""
return self._add_holiday_nov_2(name)

def _add_ascension_thursday(self, name) -> date:
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._easter_sunday, +39))
return self._add_holiday(name, _timedelta(self.__get_easter_sunday(calendar), +39))

def _add_ash_monday(self, name) -> date:
"""
Expand Down Expand Up @@ -316,16 +316,16 @@ def _add_good_friday(self, name, calendar=None) -> date:
"""
return self._add_holiday(name, _timedelta(self.__get_easter_sunday(calendar), -2))

def _add_holy_saturday(self, name) -> date:
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._easter_sunday, -1))
return self._add_holiday(name, _timedelta(self.__get_easter_sunday(calendar), -1))

def _add_holy_thursday(self, name) -> date:
def _add_holy_thursday(self, name, calendar=None) -> date:
"""
Add Holy Thursday (3 days before Easter Sunday).

Expand All @@ -334,7 +334,7 @@ def _add_holy_thursday(self, name) -> date:
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._easter_sunday, -3))
return self._add_holiday(name, _timedelta(self.__get_easter_sunday(calendar), -3))

def _add_immaculate_conception_day(self, name) -> date:
"""
Expand All @@ -355,7 +355,7 @@ def _add_nativity_of_mary_day(self, name) -> date:
"""
return self._add_holiday_sep_8(name)

def _add_palm_sunday(self, name) -> date:
def _add_palm_sunday(self, name, calendar=None) -> date:
"""
Add Palm Sunday (7 days before Easter Sunday).

Expand All @@ -365,7 +365,7 @@ def _add_palm_sunday(self, name) -> date:
Palm Sunday marks the first day of Holy Week.
https://en.wikipedia.org/wiki/Palm_Sunday
"""
return self._add_holiday(name, _timedelta(self._easter_sunday, -7))
return self._add_holiday(name, _timedelta(self.__get_easter_sunday(calendar), -7))

def _add_rejoicing_day(self, name) -> date:
"""
Expand Down Expand Up @@ -440,7 +440,7 @@ def _add_whit_monday(self, name) -> date:
"""
return self._add_holiday(name, _timedelta(self._easter_sunday, +50))

def _add_whit_sunday(self, name) -> date:
def _add_whit_sunday(self, name, calendar=None) -> date:
"""
Add Whit Sunday (49 days after Easter Sunday).

Expand All @@ -450,7 +450,7 @@ def _add_whit_sunday(self, name) -> date:
Feast of Weeks.
https://en.wikipedia.org/wiki/Pentecost
"""
return self._add_holiday(name, _timedelta(self._easter_sunday, +49))
return self._add_holiday(name, _timedelta(self.__get_easter_sunday(calendar), +49))

def _add_trinity_sunday(self, name) -> date:
"""
Expand Down
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载