Skip to content

Commit c981269

Browse files
kritibirda26PPsyriusKJhellico
authored
Add Libya holidays (#2671)
Signed-off-by: Kriti Birda <[email protected]> Co-authored-by: Panpakorn Siripanich <[email protected]> Co-authored-by: ~Jhellico <[email protected]>
1 parent 88054e3 commit c981269

File tree

7 files changed

+778
-1
lines changed

7 files changed

+778
-1
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ and detailed information.
105105

106106
## Available Countries
107107

108-
We currently support 205 country codes. The standard way to refer to a country is by using its [ISO
108+
We currently support 206 country codes. The standard way to refer to a country is by using its [ISO
109109
3166-1 alpha-2 code](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes), the same used
110110
for domain names, and for a subdivision its [ISO 3166-2
111111
code](https://en.wikipedia.org/wiki/ISO_3166-2). Some countries have common or foreign names or
@@ -868,6 +868,13 @@ any) in brackets, available languages and additional holiday categories. All cou
868868
<td></td>
869869
</tr>
870870
<tr>
871+
<td>Libya</td>
872+
<td>LY</td>
873+
<td></td>
874+
<td><strong>ar</strong>, en_US</td>
875+
<td>WORKDAY</td>
876+
</tr>
877+
<tr>
871878
<td>Liechtenstein</td>
872879
<td>LI</td>
873880
<td></td>

holidays/countries/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@
120120
from holidays.countries.laos import Laos, LA, LAO
121121
from holidays.countries.latvia import Latvia, LV, LVA
122122
from holidays.countries.lesotho import Lesotho, LS, LSO
123+
from holidays.countries.libya import Libya, LY, LBY
123124
from holidays.countries.liechtenstein import Liechtenstein, LI, LIE
124125
from holidays.countries.lithuania import Lithuania, LT, LTU
125126
from holidays.countries.luxembourg import Luxembourg, LU, LUX

holidays/countries/libya.py

Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
# holidays
2+
# --------
3+
# A fast, efficient Python library for generating country, province and state
4+
# specific sets of holidays on the fly. It aims to make determining whether a
5+
# specific date is a holiday as fast and flexible as possible.
6+
#
7+
# Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file)
8+
# dr-prodigy <[email protected]> (c) 2017-2023
9+
# ryanss <[email protected]> (c) 2014-2017
10+
# Website: https://github.com/vacanza/holidays
11+
# License: MIT (see LICENSE file)
12+
13+
from gettext import gettext as tr
14+
15+
from holidays.calendars import _CustomIslamicHolidays
16+
from holidays.calendars.gregorian import JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC
17+
from holidays.constants import PUBLIC, WORKDAY
18+
from holidays.groups import InternationalHolidays, IslamicHolidays, StaticHolidays
19+
from holidays.holiday_base import HolidayBase
20+
21+
22+
class Libya(HolidayBase, InternationalHolidays, IslamicHolidays, StaticHolidays):
23+
"""Libya holidays.
24+
25+
References:
26+
* [Law No. 4 of 1987](https://web.archive.org/web/20250629084625/https://lawsociety.ly/legislation/قانون-رقم-4-لسنة-1987-م-بشأن-العطلات-الرسمية/)
27+
* [Law No. 5 of 2012](https://web.archive.org/web/20250629084558/https://lawsociety.ly/legislation/القانون-رقم-5-لسنة-2012-م-بشأن-العطلات-الرسم/)
28+
* [National Environmental Sanitation Day](https://web.archive.org/web/20250629084547/https://lawsociety.ly/legislation/قرار-رقم-414-لسنة-2021-م-باعتبار-يوم-14-أغسطس-يو/)
29+
"""
30+
31+
country = "LY"
32+
default_language = "ar"
33+
# %s (estimated).
34+
estimated_label = tr("%s (المقدرة)")
35+
start_year = 1988
36+
supported_categories = (PUBLIC, WORKDAY)
37+
supported_languages = ("ar", "en_US")
38+
39+
def __init__(self, *args, islamic_show_estimated: bool = True, **kwargs):
40+
"""
41+
Args:
42+
islamic_show_estimated:
43+
Whether to add "estimated" label to Islamic holidays name
44+
if holiday date is estimated.
45+
"""
46+
InternationalHolidays.__init__(self)
47+
IslamicHolidays.__init__(
48+
self, cls=LibyaIslamicHolidays, show_estimated=islamic_show_estimated
49+
)
50+
StaticHolidays.__init__(self, cls=LibyaStaticHolidays)
51+
super().__init__(*args, **kwargs)
52+
53+
def _populate_public_holidays(self):
54+
if self._year <= 2011:
55+
# People's Authority Day.
56+
self._add_holiday_mar_2(tr("عید إعلان سلطة الشعب"))
57+
58+
# American Forces Evacuation Day.
59+
self._add_holiday_jun_11(tr("عيد إجلاء القوات الأمريكية"))
60+
61+
# Glorious July Revolution Day.
62+
self._add_holiday_jul_23(tr("عيد ثورة يوليو المجيدة"))
63+
64+
# Great Al-Fateh Revolution Day.
65+
self._add_holiday_sep_1(tr("عيد الفاتح العظيم"))
66+
else:
67+
# Anniversary of the February 17 Revolution.
68+
self._add_holiday_feb_17(tr("ثورة 17 فبراير"))
69+
70+
# Labor Day.
71+
self._add_labor_day(tr("عيد العمال"))
72+
73+
if self._year >= 2022:
74+
# National Environmental Sanitation Day.
75+
self._add_holiday_aug_14(tr("يوم وطني للإصحاح البيئي"))
76+
77+
# Martyrs' Day.
78+
self._add_holiday_sep_16(tr("يوم الشهيد"))
79+
80+
# Liberation Day.
81+
self._add_holiday_oct_23(tr("يوم التحرير"))
82+
83+
# Independence Day.
84+
self._add_holiday_dec_24(tr("عيد الاستقلال"))
85+
86+
# Islamic New Year.
87+
self._add_islamic_new_year_day(tr("عيد رأس السنة الهجرية"))
88+
89+
# Prophet's Birthday.
90+
self._add_mawlid_day(tr("ذكرى المولد النبوي الشريف"))
91+
92+
# Eid al-Fitr.
93+
name = tr("عيد الفطر")
94+
self._add_eid_al_fitr_day(name)
95+
self._add_eid_al_fitr_day_two(name)
96+
self._add_eid_al_fitr_day_three(name)
97+
98+
# Day of Arafah.
99+
self._add_arafah_day(tr("يوم عرفة"))
100+
101+
# Eid al-Adha.
102+
name = tr("عيد الأضحى")
103+
self._add_eid_al_adha_day(name)
104+
self._add_eid_al_adha_day_two(name)
105+
self._add_eid_al_adha_day_three(name)
106+
107+
def _populate_workday_holidays(self):
108+
if self._year <= 2011:
109+
# Syrian Revolution Day.
110+
self._add_holiday_mar_8(tr("عيد ثورة سوريا"))
111+
112+
# Anniversary of the Arab League.
113+
self._add_holiday_mar_22(tr("ذكرى إنشاء الجامعة العربية"))
114+
115+
# British Forces Evacuation Day.
116+
self._add_holiday_mar_28(tr("عيد إجلاء القوات البريطانية"))
117+
118+
# Italian Forces Evacuation Day.
119+
self._add_holiday_oct_7(tr("عيد إجلاء الطليان"))
120+
121+
# Islamic New Year.
122+
self._add_islamic_new_year_day(tr("عيد رأس السنة الهجرية"))
123+
124+
# Ashura.
125+
self._add_ashura_day(tr("عاشوراء"))
126+
127+
# Isra and Mi'raj.
128+
self._add_isra_and_miraj_day(tr("ذكرى الإسراء والمعراج"))
129+
130+
# Night of Forgiveness.
131+
self._add_imam_mahdi_birthday_day(tr("ليلة النصف من شعبان"))
132+
133+
134+
class LY(Libya):
135+
pass
136+
137+
138+
class LBY(Libya):
139+
pass
140+
141+
142+
class LibyaIslamicHolidays(_CustomIslamicHolidays):
143+
# https://web.archive.org/web/20240908234803/https://www.timeanddate.com/holidays/libya/eid-al-adha
144+
# https://web.archive.org/web/20250629084537/https://lawsociety.ly/legislation/قرار-رقم-773-لسنة-2017-م-بشأن-تحديد-عطلة-عيد-ال/
145+
EID_AL_ADHA_DATES = {
146+
2012: (OCT, 26),
147+
2013: (OCT, 15),
148+
2014: (OCT, 5),
149+
2015: (SEP, 23),
150+
2016: (SEP, 11),
151+
2017: (SEP, 1),
152+
2018: (AUG, 22),
153+
2019: (AUG, 11),
154+
2020: (JUL, 31),
155+
2021: (JUL, 20),
156+
2022: (JUL, 9),
157+
2023: (JUN, 28),
158+
2024: (JUN, 16),
159+
2025: (JUN, 6),
160+
}
161+
162+
# https://web.archive.org/web/20241012125707/https://www.timeanddate.com/holidays/libya/eid-al-fitr
163+
EID_AL_FITR_DATES = {
164+
2012: (AUG, 19),
165+
2013: (AUG, 8),
166+
2014: (JUL, 29),
167+
2015: (JUL, 18),
168+
2016: (JUL, 7),
169+
2017: (JUN, 26),
170+
2018: (JUN, 15),
171+
2019: (JUN, 4),
172+
2020: (MAY, 24),
173+
2021: (MAY, 13),
174+
2022: (MAY, 2),
175+
2023: (APR, 21),
176+
2024: (APR, 10),
177+
2025: (MAR, 31),
178+
}
179+
180+
# https://web.archive.org/web/20250418094505/https://www.timeanddate.com/holidays/libya/muharram-new-year
181+
HIJRI_NEW_YEAR_DATES = {
182+
2012: (NOV, 15),
183+
2013: (NOV, 5),
184+
2014: (OCT, 25),
185+
2015: (OCT, 15),
186+
2016: (OCT, 3),
187+
2017: (SEP, 22),
188+
2018: (SEP, 12),
189+
2019: (AUG, 31),
190+
2020: (AUG, 20),
191+
2021: (AUG, 10),
192+
2022: (JUL, 30),
193+
2023: (JUL, 19),
194+
2024: (JUL, 7),
195+
2025: (JUN, 26),
196+
}
197+
198+
# https://web.archive.org/web/20241213175353/https://www.timeanddate.com/holidays/libya/prophet-birthday
199+
# https://web.archive.org/web/20250629084607/https://lawsociety.ly/legislation/قرار-رقم-1299-لسنة-2019-م-بشأن-عطلة-ذكرى-المولد/
200+
MAWLID_DATES = {
201+
2012: (FEB, 5),
202+
2013: (JAN, 24),
203+
2014: (JAN, 14),
204+
2015: ((JAN, 3), (DEC, 23)),
205+
2016: (DEC, 12),
206+
2017: (DEC, 1),
207+
2018: (NOV, 21),
208+
2019: (NOV, 9),
209+
2020: (OCT, 29),
210+
2021: (OCT, 19),
211+
2022: (OCT, 8),
212+
2023: (SEP, 27),
213+
2024: (SEP, 15),
214+
}
215+
216+
217+
class LibyaStaticHolidays:
218+
"""Libya special holidays.
219+
220+
References:
221+
* <https://web.archive.org/web/20250629084721/https://lawsociety.ly/legislation/قرار-رقم-555-لسنة-2023-م-بمنح-إجازة-رسمية/>
222+
"""
223+
224+
special_public_holidays = {
225+
# Public Holiday.
226+
2023: (DEC, 10, tr("عطلة رسمية"))
227+
}

holidays/locale/ar/LC_MESSAGES/LY.po

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# holidays
2+
# --------
3+
# A fast, efficient Python library for generating country, province and state
4+
# specific sets of holidays on the fly. It aims to make determining whether a
5+
# specific date is a holiday as fast and flexible as possible.
6+
#
7+
# Authors: Vacanza Team and individual contributors (see CONTRIBUTORS file)
8+
# dr-prodigy <[email protected]> (c) 2017-2023
9+
# ryanss <[email protected]> (c) 2014-2017
10+
# Website: https://github.com/vacanza/holidays
11+
# License: MIT (see LICENSE file)
12+
#
13+
# Libya holidays.
14+
#
15+
msgid ""
16+
msgstr ""
17+
"Project-Id-Version: Holidays 0.76\n"
18+
"POT-Creation-Date: 2025-06-23 01:55+0530\n"
19+
"PO-Revision-Date: 2025-06-23 01:55+0530\n"
20+
"Last-Translator: Kriti Birda <[email protected]>\n"
21+
"Language-Team: Holidays Localization Team\n"
22+
"Language: ar\n"
23+
"MIME-Version: 1.0\n"
24+
"Content-Type: text/plain; charset=UTF-8\n"
25+
"Content-Transfer-Encoding: 8bit\n"
26+
"Generated-By: Lingva 5.0.6\n"
27+
"X-Source-Language: ar\n"
28+
29+
#. %s (estimated).
30+
#, c-format
31+
msgid "%s (المقدرة)"
32+
msgstr ""
33+
34+
#. People's Authority Day.
35+
msgid "عید إعلان سلطة الشعب"
36+
msgstr ""
37+
38+
#. American Forces Evacuation Day.
39+
msgid "عيد إجلاء القوات الأمريكية"
40+
msgstr ""
41+
42+
#. Glorious July Revolution Day.
43+
msgid "عيد ثورة يوليو المجيدة"
44+
msgstr ""
45+
46+
#. Great Al-Fateh Revolution Day.
47+
msgid "عيد الفاتح العظيم"
48+
msgstr ""
49+
50+
#. Anniversary of the February 17 Revolution.
51+
msgid "ثورة 17 فبراير"
52+
msgstr ""
53+
54+
#. Labor Day.
55+
msgid "عيد العمال"
56+
msgstr ""
57+
58+
#. National Environmental Sanitation Day.
59+
msgid "يوم وطني للإصحاح البيئي"
60+
msgstr ""
61+
62+
#. Martyrs' Day.
63+
msgid "يوم الشهيد"
64+
msgstr ""
65+
66+
#. Liberation Day.
67+
msgid "يوم التحرير"
68+
msgstr ""
69+
70+
#. Independence Day.
71+
msgid "عيد الاستقلال"
72+
msgstr ""
73+
74+
#. Islamic New Year.
75+
msgid "عيد رأس السنة الهجرية"
76+
msgstr ""
77+
78+
#. Prophet's Birthday.
79+
msgid "ذكرى المولد النبوي الشريف"
80+
msgstr ""
81+
82+
#. Eid al-Fitr.
83+
msgid "عيد الفطر"
84+
msgstr ""
85+
86+
#. Day of Arafah.
87+
msgid "يوم عرفة"
88+
msgstr ""
89+
90+
#. Eid al-Adha.
91+
msgid "عيد الأضحى"
92+
msgstr ""
93+
94+
#. Syrian Revolution Day.
95+
msgid "عيد ثورة سوريا"
96+
msgstr ""
97+
98+
#. Anniversary of the Arab League.
99+
msgid "ذكرى إنشاء الجامعة العربية"
100+
msgstr ""
101+
102+
#. British Forces Evacuation Day.
103+
msgid "عيد إجلاء القوات البريطانية"
104+
msgstr ""
105+
106+
#. Italian Forces Evacuation Day.
107+
msgid "عيد إجلاء الطليان"
108+
msgstr ""
109+
110+
#. Ashura.
111+
msgid "عاشوراء"
112+
msgstr ""
113+
114+
#. Isra and Mi'raj.
115+
msgid "ذكرى الإسراء والمعراج"
116+
msgstr ""
117+
118+
#. Night of Forgiveness.
119+
msgid "ليلة النصف من شعبان"
120+
msgstr ""
121+
122+
#. Public Holiday.
123+
msgid "عطلة رسمية"
124+
msgstr ""

0 commit comments

Comments
 (0)