Skip to content
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

Add Samoa holidays #1914

Merged
merged 9 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 6 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Available Countries
.. _ISO 639-1 code: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
.. _ISO 639-2 code: https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes

We currently support 149 country codes. The standard way to refer to a country
We currently support 150 country codes. The standard way to refer to a country
is by using its `ISO 3166-1 alpha-2 code`_, the same used for domain names, and
for a subdivision its `ISO 3166-2 code`_. Some countries have common or foreign
names or abbreviations as aliases for their subdivisions. These are defined in
Expand Down Expand Up @@ -760,6 +760,11 @@ All other default values are highlighted with bold:
-
- en_US, **ru**
-
* - Samoa
- WS
-
-
-
* - San Marino
- SM
-
Expand Down
1 change: 1 addition & 0 deletions holidays/countries/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
from .puerto_rico import PuertoRico, PR, PRI, HolidaysPR
from .romania import Romania, RO, ROU
from .russia import Russia, RU, RUS
from .samoa import Samoa, WS, WSM
from .san_marino import SanMarino, SM, SMR
from .saudi_arabia import SaudiArabia, SA, SAU
from .serbia import Serbia, RS, SRB
Expand Down
72 changes: 72 additions & 0 deletions holidays/countries/samoa.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# 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 AUTHORS file)
# dr-prodigy <[email protected]> (c) 2017-2023
# ryanss <[email protected]> (c) 2014-2017
# Website: https://github.com/vacanza/python-holidays
# License: MIT (see LICENSE file)

from holidays.groups import ChristianHolidays, InternationalHolidays
from holidays.holiday_base import HolidayBase


class Samoa(HolidayBase, ChristianHolidays, InternationalHolidays):
"""
References:
- https://en.wikipedia.org/wiki/Public_holidays_in_Samoa
- https://www.timeanddate.com/holidays/samoa/
- https://www.mcil.gov.ws/?attachment_id=6336
- https://www.paclii.org/ws/legis/consol_act_2020/pha2008163/
"""

country = "WS"

def __init__(self, *args, **kwargs):
ChristianHolidays.__init__(self)
InternationalHolidays.__init__(self)

super().__init__(*args, **kwargs)

def _populate(self, year):
super()._populate(year)

# New Year's Day.
self._add_new_years_day("New Year's Day")
self._add_new_years_day_two("The Day After New Year's Day")

# Good Friday.
self._add_good_friday("Good Friday")
self._add_holy_saturday("Day After Good Friday")

# Easter Monday.
self._add_easter_monday("Easter Monday")

# Mother's Day.
self._add_holiday_1_day_past_2nd_sun_of_may("Mother's Day")

# Independence Day.
self._add_holiday_jun_1("Independence Day")

# Father's Day.
self._add_holiday_1_day_past_2nd_sun_of_aug("Father's Day")

# White Monday (Lotu a Tamaiti).
self._add_holiday_1_day_past_2nd_sun_of_oct("White Sunday (Lotu a Tamaiti)")

# Christmas Day.
self._add_christmas_day("Christmas Day")

# Boxing Day.
self._add_christmas_day_two("Boxing Day")


class WS(Samoa):
pass


class WSM(Samoa):
pass
1 change: 1 addition & 0 deletions holidays/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
"puerto_rico": ("PuertoRico", "PR", "PRI", "HolidaysPR"),
"romania": ("Romania", "RO", "ROU"),
"russia": ("Russia", "RU", "RUS"),
"samoa": ("Samoa", "WS", "WSM"),
"san_marino": ("SanMarino", "SM", "SMR"),
"saudi_arabia": ("SaudiArabia", "SA", "SAU"),
"serbia": ("Serbia", "RS", "SRB"),
Expand Down
Loading
Loading