-
-
Notifications
You must be signed in to change notification settings - Fork 554
Add Mauritius holidays #2643
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
Add Mauritius holidays #2643
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
727020f
Add Mauritius holidays
kritibirda26 e452d87
Archive links
kritibirda26 93e4dcf
Apply suggestions from code review
kritibirda26 c56587d
address changes from code review
kritibirda26 2cd41ac
Update tests/countries/test_mauritius.py
kritibirda26 78d0701
fix order
kritibirda26 6f7bb7b
Merge branch 'dev' into mauritius
kritibirda26 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,197 @@ | ||
# 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 _CustomHinduHolidays, _CustomIslamicHolidays | ||
from holidays.calendars.gregorian import JAN, FEB, APR, MAY, JUN, JUL, AUG, SEP | ||
from holidays.groups import ( | ||
ChineseCalendarHolidays, | ||
ChristianHolidays, | ||
HinduCalendarHolidays, | ||
InternationalHolidays, | ||
IslamicHolidays, | ||
StaticHolidays, | ||
) | ||
from holidays.holiday_base import HolidayBase | ||
|
||
|
||
class Mauritius( | ||
HolidayBase, | ||
ChineseCalendarHolidays, | ||
ChristianHolidays, | ||
HinduCalendarHolidays, | ||
InternationalHolidays, | ||
IslamicHolidays, | ||
StaticHolidays, | ||
): | ||
"""Mauritius holidays. | ||
|
||
References: | ||
* [Public Holidays Act Consolidated 1991](https://web.archive.org/web/20250618211720/https://natlex.ilo.org/dyn/natlex2/natlex2/files/download/101480/MUS101480.pdf) | ||
* [The Public Holidays (Amendment) Act 2015](https://web.archive.org/web/20240805131941/http://mauritiusassembly.govmu.org/mauritiusassembly/wp-content/uploads/2023/03/act2815.pdf) | ||
KJhellico marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* Mauritius became independent in 1968, but the earliest accessible version of the Public | ||
Holidays Act is the one consolidated in 1991. The most recent update to the holiday | ||
schedule reflected in that version dates back to 1987. Therefore, 1988 is being used | ||
as the starting year. | ||
* [Ougadi](https://en.wikipedia.org/wiki/Ugadi) is another name for the Telugu holiday, | ||
Ugadi, which is celebrated on the same day as Gudi Padwa. Therefore, reusing Gudi Padwa | ||
for adding Ougadi. | ||
* [2021](https://web.archive.org/web/20210926053030/https://mauritius-paris.govmu.org/Pages/About%20Us/Public-Holidays-in-Mauritius-for-Year-2021.aspx) | ||
* [2022](https://web.archive.org/web/20240703234017/https://mauritius-kualalumpur.govmu.org/Documents/Public%20Holiday/Public%20holidays%20-%202022.pdf) | ||
* [2024](https://web.archive.org/web/20240703233951/https://mauritius-paris.govmu.org/Documents/Public%20Holidays/Notice%20-%20Final%20Public%20holidays%20-%202024.pdf) | ||
* [2025](https://web.archive.org/web/20250113100149/https://pmo.govmu.org/Communique/Notice-Public_Holidays_2025.pdf) | ||
""" | ||
|
||
country = "MU" | ||
default_language = "en_MU" | ||
# %s (estimated). | ||
estimated_label = tr("%s (estimated)") | ||
start_year = 1988 | ||
supported_languages = ("en_MU", "en_US") | ||
|
||
def __init__(self, *args, islamic_show_estimated: bool = True, **kwargs): | ||
""" | ||
Args: | ||
islamic_show_estimated: | ||
Whether to add "estimated" label to Islamic holidays name | ||
if holiday date is estimated. | ||
""" | ||
ChineseCalendarHolidays.__init__(self) | ||
ChristianHolidays.__init__(self) | ||
HinduCalendarHolidays.__init__(self, cls=MauritiusHinduHolidays) | ||
InternationalHolidays.__init__(self) | ||
IslamicHolidays.__init__( | ||
self, cls=MauritiusIslamicHolidays, show_estimated=islamic_show_estimated | ||
) | ||
StaticHolidays.__init__(self, cls=MauritiusStaticHolidays) | ||
super().__init__(*args, **kwargs) | ||
|
||
def _populate_public_holidays(self): | ||
# New Year's Day. | ||
self._add_new_years_day(tr("New Year's Day")) | ||
|
||
# Day after New Year's Day. | ||
self._add_new_years_day_two(tr("Day after New Year's Day")) | ||
|
||
# Abolition of Slavery. | ||
self._add_holiday_feb_1(tr("Abolition of Slavery")) | ||
|
||
# Independence and Republic Day. | ||
self._add_holiday_mar_12(tr("Independence and Republic Day")) | ||
|
||
# Labor Day. | ||
self._add_labor_day(tr("Labour Day")) | ||
|
||
if self._year >= 2016 and self._year % 2 == 0: | ||
# Assumption Day. | ||
self._add_assumption_of_mary_day(tr("Assumption of the Blessed Virgin Mary")) | ||
|
||
if self._year <= 2015 or self._year % 2 != 0: | ||
# All Saints' Day. | ||
self._add_all_saints_day(tr("All Saints' Day")) | ||
|
||
# Arrival of Indentured Laborers. | ||
self._add_holiday_nov_2(tr("Arrival of Indentured Labourers")) | ||
|
||
# Christmas Day. | ||
self._add_christmas_day(tr("Christmas Day")) | ||
|
||
# Chinese Spring Festival. | ||
self._add_chinese_new_years_day(tr("Chinese Spring Festival")) | ||
|
||
# Eid al-Fitr. | ||
self._add_eid_al_fitr_day(tr("Eid-ul-Fitr")) | ||
|
||
# Thaipusam. | ||
self._add_thaipusam(tr("Thaipoosam Cavadee")) | ||
|
||
# Maha Shivaratri. | ||
self._add_maha_shivaratri(tr("Maha Shivaratree")) | ||
|
||
# Ugadi. | ||
self._add_gudi_padwa(tr("Ougadi")) | ||
|
||
# Ganesh Chaturthi. | ||
self._add_ganesh_chaturthi(tr("Ganesh Chaturthi")) | ||
|
||
# Diwali. | ||
self._add_diwali_india(tr("Divali")) | ||
|
||
|
||
class MU(Mauritius): | ||
pass | ||
|
||
|
||
class MUS(Mauritius): | ||
pass | ||
KJhellico marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
class MauritiusHinduHolidays(_CustomHinduHolidays): | ||
# https://web.archive.org/web/20241208154454/https://www.timeanddate.com/holidays/mauritius/ganesh-chaturthi | ||
GANESH_CHATURTHI_DATES = { | ||
2015: (SEP, 18), | ||
2016: (SEP, 6), | ||
2017: (AUG, 25), | ||
2018: (SEP, 14), | ||
2019: (SEP, 3), | ||
2020: (AUG, 23), | ||
2021: (SEP, 11), | ||
2022: (SEP, 1), | ||
2023: (SEP, 20), | ||
2024: (SEP, 8), | ||
2025: (AUG, 28), | ||
} | ||
|
||
# https://web.archive.org/web/20240910225221/https://www.timeanddate.com/holidays/mauritius/thaipoosam-cavadee | ||
THAIPUSAM_DATES = { | ||
2020: (FEB, 8), | ||
2021: (JAN, 28), | ||
2022: (JAN, 18), | ||
2023: (FEB, 4), | ||
2024: (JAN, 25), | ||
2025: (FEB, 11), | ||
} | ||
|
||
PPsyrius marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
class MauritiusIslamicHolidays(_CustomIslamicHolidays): | ||
# https://web.archive.org/web/20250420201326/https://www.timeanddate.com/holidays/mauritius/eid-al-fitr | ||
EID_AL_FITR_DATES = { | ||
2016: (JUL, 6), | ||
2017: (JUN, 26), | ||
2018: (JUN, 16), | ||
2019: (JUN, 5), | ||
2020: (MAY, 24), | ||
2021: (MAY, 14), | ||
2022: (MAY, 3), | ||
2023: (APR, 22), | ||
2024: (APR, 11), | ||
2025: (APR, 1), | ||
} | ||
PPsyrius marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
class MauritiusStaticHolidays(StaticHolidays): | ||
"""Mauritius special holidays. | ||
|
||
References: | ||
* [July 29, 2019 and September 9, 2019](https://web.archive.org/web/20250618211631/https://mauritiuslii.org/akn/mu/officialGazette/government-gazette/2019-07-27/78/eng@2019-07-27) | ||
""" | ||
|
||
# Public Holiday. | ||
public_holiday = tr("Public Holiday") | ||
|
||
special_public_holidays = { | ||
2019: ( | ||
(JUL, 29, public_holiday), | ||
(SEP, 9, public_holiday), | ||
) | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# 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) | ||
# | ||
# Mauritius holidays. | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Holidays 0.76\n" | ||
"POT-Creation-Date: 2025-06-15 18:34+0530\n" | ||
"PO-Revision-Date: 2025-06-15 18:34+0530\n" | ||
"Last-Translator: Kriti Birda <workwithkritibirda@gmail.com>\n" | ||
"Language-Team: Holidays Localization Team\n" | ||
"Language: en_MU\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Generated-By: Lingva 5.0.6\n" | ||
"X-Source-Language: en_MU\n" | ||
|
||
#. %s (estimated). | ||
#, c-format | ||
msgid "%s (estimated)" | ||
msgstr "" | ||
|
||
#. New Year's Day. | ||
msgid "New Year's Day" | ||
msgstr "" | ||
|
||
#. Day after New Year's Day. | ||
msgid "Day after New Year's Day" | ||
msgstr "" | ||
|
||
#. Abolition of Slavery. | ||
msgid "Abolition of Slavery" | ||
msgstr "" | ||
|
||
#. Independence and Republic Day. | ||
msgid "Independence and Republic Day" | ||
msgstr "" | ||
|
||
#. Labor Day. | ||
msgid "Labour Day" | ||
msgstr "" | ||
|
||
#. Arrival of Indentured Laborers. | ||
msgid "Arrival of Indentured Labourers" | ||
msgstr "" | ||
|
||
#. All Saints' Day. | ||
msgid "All Saints' Day" | ||
msgstr "" | ||
|
||
#. Assumption Day. | ||
msgid "Assumption of the Blessed Virgin Mary" | ||
msgstr "" | ||
|
||
#. Christmas Day. | ||
msgid "Christmas Day" | ||
msgstr "" | ||
|
||
#. Chinese Spring Festival. | ||
msgid "Chinese Spring Festival" | ||
msgstr "" | ||
|
||
#. Eid al-Fitr. | ||
msgid "Eid-ul-Fitr" | ||
msgstr "" | ||
|
||
#. Thaipusam. | ||
msgid "Thaipoosam Cavadee" | ||
msgstr "" | ||
|
||
#. Maha Shivaratri. | ||
msgid "Maha Shivaratree" | ||
msgstr "" | ||
|
||
#. Ugadi. | ||
msgid "Ougadi" | ||
msgstr "" | ||
|
||
#. Ganesh Chaturthi. | ||
msgid "Ganesh Chaturthi" | ||
msgstr "" | ||
|
||
#. Diwali. | ||
msgid "Divali" | ||
msgstr "" | ||
|
||
#. Public Holiday. | ||
msgid "Public Holiday" | ||
msgstr "" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.