Skip to content

Commit f95f232

Browse files
Add Niue holidays (#2737)
Co-authored-by: Arkadii Yakovets <[email protected]>
1 parent e09311e commit f95f232

File tree

7 files changed

+533
-1
lines changed

7 files changed

+533
-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 220 country codes. The standard way to refer to a country is by using its [ISO
108+
We currently support 221 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
@@ -1162,6 +1162,13 @@ any) in brackets, available languages and additional holiday categories. All cou
11621162
<td></td>
11631163
</tr>
11641164
<tr>
1165+
<td>Niue</td>
1166+
<td>NU</td>
1167+
<td></td>
1168+
<td><strong>en_NU</strong>, en_US</td>
1169+
<td></td>
1170+
</tr>
1171+
<tr>
11651172
<td>Norfolk Island</td>
11661173
<td>NF</td>
11671174
<td></td>

holidays/countries/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@
162162
from holidays.countries.nicaragua import Nicaragua, NI, NIC
163163
from holidays.countries.niger import Niger, NE, NER
164164
from holidays.countries.nigeria import Nigeria, NG, NGA
165+
from holidays.countries.niue import Niue, NU, NIU
165166
from holidays.countries.norfolk_island import NorfolkIsland, NF, NFK
166167
from holidays.countries.north_macedonia import NorthMacedonia, MK, MKD
167168
from holidays.countries.northern_mariana_islands import NorthernMarianaIslands, MP, MNP, HolidaysMP

holidays/countries/niue.py

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
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 SEP
16+
from holidays.groups import ChristianHolidays, InternationalHolidays, StaticHolidays
17+
from holidays.observed_holiday_base import (
18+
ObservedHolidayBase,
19+
SAT_SUN_TO_NEXT_MON,
20+
SAT_SUN_TO_NEXT_MON_TUE,
21+
)
22+
23+
24+
class Niue(ObservedHolidayBase, ChristianHolidays, InternationalHolidays, StaticHolidays):
25+
"""Niue holidays.
26+
27+
References:
28+
* <https://en.wikipedia.org/wiki/Public_holidays_in_Niue>
29+
* <https://en.wikipedia.org/wiki/Niue_Constitution_Act>
30+
* [Public Holidays Ordinance 1961](https://web.archive.org/web/20250102100637/http://www.paclii.org/nu/legis/num_act/nipho1961314.pdf)
31+
* <https://web.archive.org/web/20250223114854/https://niuepocketguide.com/public-holidays-in-niue-other-important-dates/>
32+
* [2021/2022 Public Holidays](https://web.archive.org/web/20250509105501/https://www.gov.nu/media/pages/information/1018c58017-1725838374/4nov2021-circular.pdf)
33+
* [2025 Good Friday & Easter Monday and Anzac Day](https://web.archive.org/web/20250719195126/https://www.gov.nu/media/pages/gazette/3e02b3aa84-1746400484/official-psc-circular-easter-anzac-holiday.pdf)
34+
* [2025 King's Birthday](https://web.archive.org/web/20250719195301/https://www.gov.nu/media/pages/public-service-circulars/3b9f44b6a0-1748573974/king-s-birthday-public-holiday-2025-circular.pdf)
35+
* <http://archive.today/2025.07.14-145535/https://www.wipo.int/wipolex/en/text/427817>
36+
"""
37+
38+
country = "NU"
39+
default_language = "en_NU"
40+
# %s observed.
41+
observed_label = tr("%s (observed)")
42+
# Public Holidays Ordinance 1961.
43+
start_year = 1962
44+
supported_languages = ("en_NU", "en_US")
45+
46+
def __init__(self, *args, **kwargs):
47+
ChristianHolidays.__init__(self)
48+
InternationalHolidays.__init__(self)
49+
StaticHolidays.__init__(self, cls=NiueStaticHolidays)
50+
kwargs.setdefault("observed_rule", SAT_SUN_TO_NEXT_MON_TUE)
51+
super().__init__(*args, **kwargs)
52+
53+
def _populate_public_holidays(self):
54+
# New Year's Day.
55+
self._add_observed(self._add_new_years_day(tr("New Year's Day")))
56+
57+
# Takai Commission Holiday.
58+
self._add_observed(self._add_new_years_day_two(tr("Takai Commission Holiday")))
59+
60+
# Good Friday.
61+
self._add_good_friday(tr("Good Friday"))
62+
63+
# Easter Monday.
64+
self._add_easter_monday(tr("Easter Monday"))
65+
66+
# ANZAC Day.
67+
self._add_observed(self._add_anzac_day(tr("ANZAC Day")), rule=SAT_SUN_TO_NEXT_MON)
68+
69+
self._add_holiday_1st_mon_of_jun(
70+
# King's Birthday.
71+
tr("King's Birthday")
72+
if self._year >= 2023
73+
# Queen's Birthday.
74+
else tr("Queen's Birthday")
75+
)
76+
77+
if self._year >= 1974:
78+
# Constitution Day.
79+
self._add_observed(self._add_holiday_oct_19(tr("Constitution Day")))
80+
81+
# Constitution Day Holiday.
82+
self._add_observed(self._add_holiday_oct_20(tr("Constitution Day Holiday")))
83+
else:
84+
# Annexation Day.
85+
self._add_holiday_3rd_mon_of_oct(tr("Annexation Day"))
86+
87+
# Peniamina Gospel Day.
88+
self._add_holiday_4th_mon_of_oct(tr("Peniamina Gospel Day"))
89+
90+
# Christmas Day.
91+
self._add_observed(self._add_christmas_day(tr("Christmas Day")))
92+
93+
# Boxing Day.
94+
self._add_observed(self._add_christmas_day_two(tr("Boxing Day")))
95+
96+
97+
class NU(Niue):
98+
pass
99+
100+
101+
class NIU(Niue):
102+
pass
103+
104+
105+
class NiueStaticHolidays:
106+
"""Niue special holidays.
107+
108+
References:
109+
* [Queen Elizabeth II's Funeral](https://web.archive.org/web/20250617174022/https://tvniue.com/2022/09/premier-will-attend-hm-the-queens-funeral-while-monday-19th-is-declared-one-off-public-holiday/)
110+
"""
111+
112+
special_public_holidays = {
113+
# Queen Elizabeth II's Funeral.
114+
2022: (SEP, 19, tr("Queen Elizabeth II's Funeral")),
115+
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
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+
# Niue holidays.
14+
#
15+
msgid ""
16+
msgstr ""
17+
"Project-Id-Version: Holidays 0.77\n"
18+
"POT-Creation-Date: 2025-07-19 13:54+0000\n"
19+
"PO-Revision-Date: 2025-07-19 13:54+0000\n"
20+
"Last-Translator: Abheelash Mishra <[email protected]>\n"
21+
"Language-Team: Holidays Localization Team\n"
22+
"Language: en_NU\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: en_NU\n"
28+
29+
#. %s observed.
30+
#, c-format
31+
msgid "%s (observed)"
32+
msgstr ""
33+
34+
#. New Year's Day.
35+
msgid "New Year's Day"
36+
msgstr ""
37+
38+
#. Takai Commission Holiday.
39+
msgid "Takai Commission Holiday"
40+
msgstr ""
41+
42+
#. Good Friday.
43+
msgid "Good Friday"
44+
msgstr ""
45+
46+
#. Easter Monday.
47+
msgid "Easter Monday"
48+
msgstr ""
49+
50+
#. ANZAC Day.
51+
msgid "ANZAC Day"
52+
msgstr ""
53+
54+
#. King's Birthday.
55+
msgid "King's Birthday"
56+
msgstr ""
57+
58+
#. Queen's Birthday.
59+
msgid "Queen's Birthday"
60+
msgstr ""
61+
62+
#. Constitution Day.
63+
msgid "Constitution Day"
64+
msgstr ""
65+
66+
#. Constitution Day Holiday.
67+
msgid "Constitution Day Holiday"
68+
msgstr ""
69+
70+
#. Annexation Day.
71+
msgid "Annexation Day"
72+
msgstr ""
73+
74+
#. Peniamina Gospel Day.
75+
msgid "Peniamina Gospel Day"
76+
msgstr ""
77+
78+
#. Christmas Day.
79+
msgid "Christmas Day"
80+
msgstr ""
81+
82+
#. Boxing Day.
83+
msgid "Boxing Day"
84+
msgstr ""
85+
86+
#. Queen Elizabeth II's Funeral.
87+
msgid "Queen Elizabeth II's Funeral"
88+
msgstr ""
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
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+
# Niue holidays en_US localization.
14+
#
15+
msgid ""
16+
msgstr ""
17+
"Project-Id-Version: Holidays 0.77\n"
18+
"POT-Creation-Date: 2025-07-19 13:54+0000\n"
19+
"PO-Revision-Date: 2025-07-19 13:54+0000\n"
20+
"Last-Translator: Abheelash Mishra <[email protected]>\n"
21+
"Language-Team: Holidays Localization Team\n"
22+
"Language: en_US\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: en_NU\n"
28+
29+
#. %s observed.
30+
#, c-format
31+
msgid "%s (observed)"
32+
msgstr "%s (observed)"
33+
34+
#. New Year's Day.
35+
msgid "New Year's Day"
36+
msgstr "New Year's Day"
37+
38+
#. Takai Commission Holiday.
39+
msgid "Takai Commission Holiday"
40+
msgstr "Takai Commission Holiday"
41+
42+
#. Good Friday.
43+
msgid "Good Friday"
44+
msgstr "Good Friday"
45+
46+
#. Easter Monday.
47+
msgid "Easter Monday"
48+
msgstr "Easter Monday"
49+
50+
#. ANZAC Day.
51+
msgid "ANZAC Day"
52+
msgstr "ANZAC Day"
53+
54+
#. King's Birthday.
55+
msgid "King's Birthday"
56+
msgstr "King's Birthday"
57+
58+
#. Queen's Birthday.
59+
msgid "Queen's Birthday"
60+
msgstr "Queen's Birthday"
61+
62+
#. Constitution Day.
63+
msgid "Constitution Day"
64+
msgstr "Constitution Day"
65+
66+
#. Constitution Day Holiday.
67+
msgid "Constitution Day Holiday"
68+
msgstr "Constitution Day Holiday"
69+
70+
#. Annexation Day.
71+
msgid "Annexation Day"
72+
msgstr "Annexation Day"
73+
74+
#. Peniamina Gospel Day.
75+
msgid "Peniamina Gospel Day"
76+
msgstr "Peniamina Gospel Day"
77+
78+
#. Christmas Day.
79+
msgid "Christmas Day"
80+
msgstr "Christmas Day"
81+
82+
#. Boxing Day.
83+
msgid "Boxing Day"
84+
msgstr "Boxing Day"
85+
86+
#. Queen Elizabeth II's Funeral.
87+
msgid "Queen Elizabeth II's Funeral"
88+
msgstr "Queen Elizabeth II's Funeral"

holidays/registry.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@
165165
"nicaragua": ("Nicaragua", "NI", "NIC"),
166166
"niger": ("Niger", "NE", "NER"),
167167
"nigeria": ("Nigeria", "NG", "NGA"),
168+
"niue": ("Niue", "NU", "NIU"),
168169
"norfolk_island": ("NorfolkIsland", "NF", "NFK"),
169170
"north_macedonia": ("NorthMacedonia", "MK", "MKD"),
170171
"northern_mariana_islands": ("NorthernMarianaIslands", "MP", "MNP", "HolidaysMP"),

0 commit comments

Comments
 (0)