|
| 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.gregorian import APR, MAY, JUN, JUL, SEP, DEC |
| 16 | +from holidays.groups import ChristianHolidays, InternationalHolidays, StaticHolidays |
| 17 | +from holidays.observed_holiday_base import ( |
| 18 | + ObservedHolidayBase, |
| 19 | + MON_TO_NEXT_TUE, |
| 20 | + SAT_TO_NEXT_MON, |
| 21 | + SAT_SUN_TO_NEXT_MON, |
| 22 | + SAT_SUN_TO_NEXT_MON_TUE, |
| 23 | +) |
| 24 | + |
| 25 | + |
| 26 | +class Montserrat(ObservedHolidayBase, ChristianHolidays, InternationalHolidays, StaticHolidays): |
| 27 | + """Montserrat holidays. |
| 28 | +
|
| 29 | + References: |
| 30 | + * <https://en.wikipedia.org/wiki/Public_holidays_in_Montserrat> |
| 31 | + * [Public holidays Act, 2017](https://web.archive.org/web/20240619074948/http://agc.gov.ms/wp-content/uploads/2011/10/Act-No.-3-of-2017-Public-Holidays-Amendment-Act-20171.pdf) |
| 32 | + * [Public holidays Act, 2019](https://web.archive.org/web/20241025070627/https://www.gov.ms/wp-content/uploads/2020/06/Public-Holidays-Act.pdf) |
| 33 | + * [National Day of Prayer and Thanksgiving, 2021](https://web.archive.org/web/20220809144840/https://www.gov.ms/2021/07/16/wednesday-july-21-2021-public-holiday-national-day-of-prayer-thanksgiving/) |
| 34 | + * [National Day of Prayer and Thanksgiving, 2022](https://web.archive.org/web/20220816124619/https://www.gov.ms/2022/07/19/public-holiday-for-national-day-of-prayer-and-thanksgiving-to-be-held-on-july-20-2022/) |
| 35 | + * [National Day of Prayer and Thanksgiving](https://web.archive.org/web/20240711221313/https://www.gov.ms/wp-content/uploads/2023/05/SRO-No.-15-of-2023-Public-Holidays-Amendment-of-Schedule-Order.pdf) |
| 36 | + * [Queen's Platinum Jubilee, 2022](https://web.archive.org/web/20250711160439/https://www.gov.ms/tag/public-holidays/) |
| 37 | + * [Montserrat Public holidays, 2022](https://web.archive.org/web/20220809030551/https://www.gov.ms/wp-content/uploads/2021/12/Public-Holidays-2022-1.jpeg) |
| 38 | + * [Montserrat Public holidays, 2023](https://web.archive.org/web/20241126232715/https://www.gov.ms/wp-content/uploads/2023/02/Public-Holidays-Montserrat-2023_page-0001.jpg) |
| 39 | + * [Montserrat Public holidays, 2024](https://web.archive.org/web/20240421112540/https://www.gov.ms/wp-content/uploads/2023/12/Public-Holidays-Montserrat-2024.docx.pdf) |
| 40 | + * [King's Birthday, 2024](https://web.archive.org/web/20250711202228/https://parliament.ms/wp-content/uploads/2024/09/SRO-No.-18-of-2024-PROCOLAMATION-APPOINTING-MONDAY-17-JUNE-2024-AS-A-PUBLIC-HOLIDAY.pdf) |
| 41 | + * [Montserrat Public holidays, 2025](https://web.archive.org/web/20250711160324/https://www.gov.ms/wp-content/uploads/2025/01/2025-Public-Holidays-on-Montserrat.pdf) |
| 42 | + """ |
| 43 | + |
| 44 | + country = "MS" |
| 45 | + default_language = "en_MS" |
| 46 | + # %s (observed). |
| 47 | + observed_label = "%s (observed)" |
| 48 | + # Public holidays Act, 2017. |
| 49 | + start_year = 2017 |
| 50 | + supported_languages = ("en_MS", "en_US") |
| 51 | + |
| 52 | + def __init__(self, *args, **kwargs): |
| 53 | + ChristianHolidays.__init__(self) |
| 54 | + InternationalHolidays.__init__(self) |
| 55 | + StaticHolidays.__init__(self, MontserratStaticHolidays) |
| 56 | + kwargs.setdefault("observed_rule", SAT_SUN_TO_NEXT_MON) |
| 57 | + super().__init__(*args, **kwargs) |
| 58 | + |
| 59 | + def _populate_public_holidays(self): |
| 60 | + self._add_observed( |
| 61 | + # New Year's Day. |
| 62 | + self._add_new_years_day(tr("New Year's Day")), |
| 63 | + rule=SAT_SUN_TO_NEXT_MON_TUE + MON_TO_NEXT_TUE, |
| 64 | + ) |
| 65 | + |
| 66 | + # Saint Patrick's Day. |
| 67 | + self._add_observed(self._add_holiday_mar_17(tr("Saint Patrick's Day"))) |
| 68 | + |
| 69 | + # Good Friday. |
| 70 | + self._add_good_friday(tr("Good Friday")) |
| 71 | + |
| 72 | + # Easter Monday. |
| 73 | + self._add_easter_monday(tr("Easter Monday")) |
| 74 | + |
| 75 | + # Labor Day. |
| 76 | + self._add_holiday_1st_mon_of_may(tr("Labour Day")) |
| 77 | + |
| 78 | + name = ( |
| 79 | + # King's Birthday. |
| 80 | + tr("King's Birthday") |
| 81 | + if self._year >= 2023 |
| 82 | + # Queen's Birthday. |
| 83 | + else tr("Queen's Birthday") |
| 84 | + ) |
| 85 | + sovereign_birthday_dts = { |
| 86 | + 2022: (JUN, 2), |
| 87 | + 2023: (JUN, 19), |
| 88 | + 2024: (JUN, 17), |
| 89 | + } |
| 90 | + sovereign_birthday_dt = ( |
| 91 | + self._add_holiday(name, dt) |
| 92 | + if (dt := sovereign_birthday_dts.get(self._year)) |
| 93 | + else self._add_holiday_2_days_past_2nd_sat_of_jun(name) |
| 94 | + ) |
| 95 | + |
| 96 | + # Whit Monday. |
| 97 | + name = tr("Whit Monday") |
| 98 | + whit_monday_dt = self._add_whit_monday(name) |
| 99 | + if whit_monday_dt == sovereign_birthday_dt: |
| 100 | + self._add_observed(whit_monday_dt, name=name, rule=MON_TO_NEXT_TUE) |
| 101 | + |
| 102 | + if self._year >= 2021: |
| 103 | + day_of_prayer_dts = { |
| 104 | + 2021: (JUL, 21), |
| 105 | + 2022: (JUL, 20), |
| 106 | + } |
| 107 | + name = ( |
| 108 | + # National Day of Prayer and Thanksgiving. |
| 109 | + tr("National Day of Prayer and Thanksgiving") |
| 110 | + if self._year <= 2023 |
| 111 | + # Day of Prayer and Thanksgiving. |
| 112 | + else tr("Day of Prayer and Thanksgiving") |
| 113 | + ) |
| 114 | + if dt := day_of_prayer_dts.get(self._year): |
| 115 | + self._add_holiday(name, dt) |
| 116 | + else: |
| 117 | + self._add_holiday_2nd_wed_of_jul(name) |
| 118 | + |
| 119 | + # Emancipation Day. |
| 120 | + self._add_holiday_1st_mon_of_aug(tr("Emancipation Day")) |
| 121 | + |
| 122 | + self._add_observed( |
| 123 | + # Christmas Day. |
| 124 | + self._add_christmas_day(tr("Christmas Day")), |
| 125 | + rule=SAT_SUN_TO_NEXT_MON_TUE, |
| 126 | + ) |
| 127 | + |
| 128 | + self._add_observed( |
| 129 | + # Boxing Day. |
| 130 | + self._add_christmas_day_two(tr("Boxing Day")), |
| 131 | + rule=SAT_SUN_TO_NEXT_MON_TUE, |
| 132 | + ) |
| 133 | + |
| 134 | + # Festival Day. |
| 135 | + name = tr("Festival Day") |
| 136 | + self._add_new_years_eve(name) |
| 137 | + self._add_observed((self._year - 1, DEC, 31), name, rule=SAT_TO_NEXT_MON) |
| 138 | + |
| 139 | + |
| 140 | +class MS(Montserrat): |
| 141 | + pass |
| 142 | + |
| 143 | + |
| 144 | +class MSR(Montserrat): |
| 145 | + pass |
| 146 | + |
| 147 | + |
| 148 | +class MontserratStaticHolidays(StaticHolidays): |
| 149 | + """Montserrat special holidays. |
| 150 | +
|
| 151 | + References: |
| 152 | + * [September 14th, 2018](https://web.archive.org/web/20220810224300/https://www.gov.ms/wp-content/uploads/2020/11/SRO.-No.-35-of-2018-Proclamation-Declaring-Friday-14-September-2018-as-a-public-holiday.pdf) |
| 153 | + * [May 10th, 2019](https://web.archive.org/web/20240626113529/https://parliament.ms/wp-content/uploads/2022/02/SRO-No-13-of-2019-Proclamation-Declaring-Friday-10-May-2019-as-a-publi._.pdf) |
| 154 | + * [July 15th, 2020](https://web.archive.org/web/20220810225456/https://www.gov.ms/wp-content/uploads/2020/08/SRO.-No.-40-of-2020-Proclamation-Declaring-Wednesday-15-July-2020-as-a-Public-Holiday.pdf) |
| 155 | + * [National Day of Mourning](https://web.archive.org/web/20240617072858/https://www.parliament.ms/wp-content/uploads/2022/09/SRO-No.43-of-2022-Proclamation-Appointing-Monday-19-September-2022-a-Public-Holiday.pdf) |
| 156 | + * [Coronation of King Charles III](https://web.archive.org/web/20241126232715/https://www.gov.ms/wp-content/uploads/2023/02/Public-Holidays-Montserrat-2023_page-0001.jpg) |
| 157 | + """ |
| 158 | + |
| 159 | + # Special Public Holiday. |
| 160 | + name = tr("Special Public Holiday") |
| 161 | + |
| 162 | + special_public_holidays = { |
| 163 | + 2018: (SEP, 14, name), |
| 164 | + 2019: (MAY, 10, name), |
| 165 | + 2020: (JUL, 15, name), |
| 166 | + 2022: ( |
| 167 | + # Platinum Jubilee of Elizabeth II. |
| 168 | + (JUN, 3, tr("Platinum Jubilee of Elizabeth II")), |
| 169 | + # National Day of Mourning. |
| 170 | + (SEP, 19, tr("National Day of Mourning")), |
| 171 | + ), |
| 172 | + 2023: ( |
| 173 | + (APR, 12, name), |
| 174 | + # Coronation of King Charles III. |
| 175 | + (MAY, 6, tr("Coronation of King Charles III")), |
| 176 | + ), |
| 177 | + } |
0 commit comments