+
Skip to content
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
149 changes: 96 additions & 53 deletions holidays/countries/south_africa.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@ class SouthAfrica(ObservedHolidayBase, ChristianHolidays, InternationalHolidays,

References:
* <https://web.archive.org/web/20250424073852/https://www.gov.za/about-sa/public-holidays>
* [Act No. 36, 1994](https://web.archive.org/web/20250914045710/https://www.gov.za/sites/default/files/gcis_document/201409/act36of1994.pdf)
* <https://web.archive.org/web/20250914050022/https://www.ancestors.co.za/origins-of-public-holidays-in-south-africa/>
* <https://en.wikipedia.org/wiki/Public_holidays_in_South_Africa>
* <https://web.archive.org/web/20240715110800/https://www.gov.za/speeches/president-cyril-ramaphosa-progress-economic-recovery-30-oct-2023-0000>
* <https://web.archive.org/web/20250427184315/https://www.gov.za/documents/notices/public-holidays-act-declaration-29-may-2024-public-holiday-23-feb-2024>
"""

country = "ZA"
# %s (observed).
observed_label = "%s (observed)"
# Observed since 1910, with a few name changes
start_year = 1910
# Public Holidays Act (No. 3 of 1910) came in effect on January 1st, 1911.
start_year = 1911

def __init__(self, *args, **kwargs):
ChristianHolidays.__init__(self)
Expand All @@ -39,75 +42,113 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

def _populate_public_holidays(self):
# New Year's Day.
self._add_observed(self._add_new_years_day("New Year's Day"))

if 1980 <= self._year <= 1994:
# Founder's Day.
self._add_holiday_apr_6("Founder's Day")
elif 1952 <= self._year <= 1973:
# Van Riebeeck's Day.
self._add_holiday_apr_6("Van Riebeeck's Day")

# Good Friday.
self._add_good_friday("Good Friday")

self._add_easter_monday("Family Day" if self._year >= 1980 else "Easter Monday")
if self._year <= 1979:
# Easter Monday.
self._add_easter_monday("Easter Monday")

if self._year <= 1951:
name = "Dingaan's Day"
elif self._year <= 1979:
name = "Day of the Covenant"
elif self._year <= 1994:
name = "Day of the Vow"
else:
name = "Day of Reconciliation"
self._add_observed(self._add_holiday_dec_16(name))
# Family Day.
name = "Family Day"
if self._year >= 1980:
self._add_easter_monday(name)
elif 1961 <= self._year <= 1973:
self._add_holiday_jul_10(name)

self._add_christmas_day("Christmas Day")

self._add_observed(
self._add_christmas_day_two("Day of Goodwill" if self._year >= 1980 else "Boxing Day")
)
# Workers' Day.
name = "Workers' Day"
if self._year >= 1995:
self._add_observed(self._add_labor_day(name))
elif 1987 <= self._year <= 1989:
self._add_holiday_1st_fri_of_may(name)

if self._year >= 1995:
# Human Rights Day.
self._add_observed(self._add_holiday_mar_21("Human Rights Day"))

# Freedom Day.
self._add_observed(self._add_holiday_apr_27("Freedom Day"))

self._add_observed(self._add_labor_day("Workers' Day"))

# Youth Day.
self._add_observed(self._add_holiday_jun_16("Youth Day"))

# National Women's Day.
self._add_observed(self._add_holiday_aug_9("National Women's Day"))

# Heritage Day.
self._add_observed(self._add_holiday_sep_24("Heritage Day"))

# Historic public holidays no longer observed
if 1952 <= self._year <= 1973:
self._add_holiday_apr_6("Van Riebeeck's Day")
elif 1980 <= self._year <= 1994:
self._add_holiday_apr_6("Founder's Day")

if 1987 <= self._year <= 1989:
self._add_holiday_1st_fri_of_may("Workers' Day")

if self._year <= 1993:
elif self._year <= 1993:
self._add_holiday_may_31(
# Republic Day.
"Republic Day"
if self._year >= 1961
# Union Day.
else "Union Day"
)

# Ascension Day.
self._add_ascension_thursday("Ascension Day")

if self._year <= 1951:
self._add_holiday_may_24("Empire Day")
if self._year >= 1952:
# Kruger Day.
self._add_holiday_oct_10("Kruger Day")

if self._year <= 1960:
self._add_holiday_may_31("Union Day")
elif self._year <= 1993:
self._add_holiday_may_31("Republic Day")
if self._year >= 1952:
if self._year <= 1960:
# Queen's Birthday.
self._add_holiday_2nd_mon_of_jul("Queen's Birthday")

if 1952 <= self._year <= 1960:
self._add_holiday_2nd_mon_of_jul("Queen's Birthday")
if self._year <= 1979:
# Settlers' Day.
self._add_holiday_1st_mon_of_sep("Settlers' Day")
else:
# According to our sources, Act No. 3 of 1910 supposedly uses the term "Victoria Day"
# but as we can't find the original document and that Empire Day was supposed
# instituted empire-wide circa 1904 - we'll stick with its latter name for now.

if 1961 <= self._year <= 1973:
self._add_holiday_jul_10("Family Day")
# Empire Day.
self._add_holiday_may_24("Empire Day")

if self._year <= 1951:
# King's Birthday.
self._add_holiday_1st_mon_of_aug("King's Birthday")

if 1952 <= self._year <= 1979:
self._add_holiday_1st_mon_of_sep("Settlers' Day")
if self._year >= 1995:
# Day of Reconciliation.
name = "Day of Reconciliation"
elif self._year >= 1980:
# Day of the Vow.
name = "Day of the Vow"
elif self._year >= 1952:
# Day of the Covenant.
name = "Day of the Covenant"
else:
# Dingaan's Day.
name = "Dingaan's Day"
self._add_observed(self._add_holiday_dec_16(name))

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

if 1952 <= self._year <= 1993:
self._add_holiday_oct_10("Kruger Day")
self._add_observed(
self._add_christmas_day_two(
# Day of Goodwill.
"Day of Goodwill"
if self._year >= 1980
# Boxing Day.
else "Boxing Day"
)
)


class ZA(SouthAfrica):
Expand All @@ -119,11 +160,14 @@ class ZAF(SouthAfrica):


class SouthAfricaStaticHolidays:
local_elections = "Local government elections"
municipal_elections = "Municipal elections"
national_and_provincial_elections = "National and provincial government elections"
presidential_decree_holiday = "Public holiday by presidential decree"
y2k_changeover = "Y2K changeover"
# Local Government Elections.
local_elections = "Local Government Elections"
# National and Provincial Government Elections.
national_and_provincial_elections = "National and Provincial Government Elections"
# Public Holiday by Presidential Decree.
presidential_decree_holiday = "Public Holiday by Presidential Decree"
# Y2K Changeover.
y2k_changeover = "Y2K Changeover"
special_public_holidays = {
1999: (
(JUN, 2, national_and_provincial_elections),
Expand All @@ -144,13 +188,12 @@ class SouthAfricaStaticHolidays:
(DEC, 27, presidential_decree_holiday),
),
2019: (MAY, 8, national_and_provincial_elections),
2021: (NOV, 1, municipal_elections),
# Municipal elections.
2021: (NOV, 1, "Municipal elections"),
2022: (DEC, 27, presidential_decree_holiday),
# Winning the 2023 Rugby World Cup
2023: (DEC, 15, presidential_decree_holiday),
2024: (MAY, 29, national_and_provincial_elections),
}

special_public_holidays_observed = {
# https://web.archive.org/web/20120328122217/http://www.info.gov.za/speeches/1999/991028409p1002.htm
2000: (JAN, 3, y2k_changeover),
Expand Down
34 changes: 17 additions & 17 deletions snapshots/countries/ZA_COMMON.json
Original file line number Diff line number Diff line change
Expand Up @@ -549,18 +549,18 @@
"1999-04-05": "Family Day",
"1999-04-27": "Freedom Day",
"1999-05-01": "Workers' Day",
"1999-06-02": "National and provincial government elections",
"1999-06-02": "National and Provincial Government Elections",
"1999-06-16": "Youth Day",
"1999-08-09": "National Women's Day",
"1999-09-24": "Heritage Day",
"1999-12-16": "Day of Reconciliation",
"1999-12-25": "Christmas Day",
"1999-12-26": "Day of Goodwill",
"1999-12-27": "Day of Goodwill (observed)",
"1999-12-31": "Y2K changeover",
"1999-12-31": "Y2K Changeover",
"2000-01-01": "New Year's Day",
"2000-01-02": "Y2K changeover",
"2000-01-03": "Y2K changeover (observed)",
"2000-01-02": "Y2K Changeover",
"2000-01-03": "Y2K Changeover (observed)",
"2000-03-21": "Human Rights Day",
"2000-04-21": "Good Friday",
"2000-04-24": "Family Day",
Expand Down Expand Up @@ -617,7 +617,7 @@
"2004-03-22": "Human Rights Day (observed)",
"2004-04-09": "Good Friday",
"2004-04-12": "Family Day",
"2004-04-14": "National and provincial government elections",
"2004-04-14": "National and Provincial Government Elections",
"2004-04-27": "Freedom Day",
"2004-05-01": "Workers' Day",
"2004-06-16": "Youth Day",
Expand All @@ -642,7 +642,7 @@
"2005-12-26": "Day of Goodwill",
"2006-01-01": "New Year's Day",
"2006-01-02": "New Year's Day (observed)",
"2006-03-01": "Local government elections",
"2006-03-01": "Local Government Elections",
"2006-03-21": "Human Rights Day",
"2006-04-14": "Good Friday",
"2006-04-17": "Family Day",
Expand Down Expand Up @@ -674,7 +674,7 @@
"2008-04-27": "Freedom Day",
"2008-04-28": "Freedom Day (observed)",
"2008-05-01": "Workers' Day",
"2008-05-02": "Public holiday by presidential decree",
"2008-05-02": "Public Holiday by Presidential Decree",
"2008-06-16": "Youth Day",
"2008-08-09": "National Women's Day",
"2008-09-24": "Heritage Day",
Expand All @@ -685,7 +685,7 @@
"2009-03-21": "Human Rights Day",
"2009-04-10": "Good Friday",
"2009-04-13": "Family Day",
"2009-04-22": "National and provincial government elections",
"2009-04-22": "National and Provincial Government Elections",
"2009-04-27": "Freedom Day",
"2009-05-01": "Workers' Day",
"2009-06-16": "Youth Day",
Expand Down Expand Up @@ -716,14 +716,14 @@
"2011-04-27": "Freedom Day",
"2011-05-01": "Workers' Day",
"2011-05-02": "Workers' Day (observed)",
"2011-05-18": "Local government elections",
"2011-05-18": "Local Government Elections",
"2011-06-16": "Youth Day",
"2011-08-09": "National Women's Day",
"2011-09-24": "Heritage Day",
"2011-12-16": "Day of Reconciliation",
"2011-12-25": "Christmas Day",
"2011-12-26": "Day of Goodwill",
"2011-12-27": "Public holiday by presidential decree",
"2011-12-27": "Public Holiday by Presidential Decree",
"2012-01-01": "New Year's Day",
"2012-01-02": "New Year's Day (observed)",
"2012-03-21": "Human Rights Day",
Expand Down Expand Up @@ -758,7 +758,7 @@
"2014-04-27": "Freedom Day",
"2014-04-28": "Freedom Day (observed)",
"2014-05-01": "Workers' Day",
"2014-05-07": "National and provincial government elections",
"2014-05-07": "National and Provincial Government Elections",
"2014-06-16": "Youth Day",
"2014-08-09": "National Women's Day",
"2014-09-24": "Heritage Day",
Expand Down Expand Up @@ -786,13 +786,13 @@
"2016-05-01": "Workers' Day",
"2016-05-02": "Workers' Day (observed)",
"2016-06-16": "Youth Day",
"2016-08-03": "Local government elections",
"2016-08-03": "Local Government Elections",
"2016-08-09": "National Women's Day",
"2016-09-24": "Heritage Day",
"2016-12-16": "Day of Reconciliation",
"2016-12-25": "Christmas Day",
"2016-12-26": "Day of Goodwill",
"2016-12-27": "Public holiday by presidential decree",
"2016-12-27": "Public Holiday by Presidential Decree",
"2017-01-01": "New Year's Day",
"2017-01-02": "New Year's Day (observed)",
"2017-03-21": "Human Rights Day",
Expand Down Expand Up @@ -826,7 +826,7 @@
"2019-04-22": "Family Day",
"2019-04-27": "Freedom Day",
"2019-05-01": "Workers' Day",
"2019-05-08": "National and provincial government elections",
"2019-05-08": "National and Provincial Government Elections",
"2019-06-16": "Youth Day",
"2019-06-17": "Youth Day (observed)",
"2019-08-09": "National Women's Day",
Expand Down Expand Up @@ -875,7 +875,7 @@
"2022-12-16": "Day of Reconciliation",
"2022-12-25": "Christmas Day",
"2022-12-26": "Day of Goodwill",
"2022-12-27": "Public holiday by presidential decree",
"2022-12-27": "Public Holiday by Presidential Decree",
"2023-01-01": "New Year's Day",
"2023-01-02": "New Year's Day (observed)",
"2023-03-21": "Human Rights Day",
Expand All @@ -887,7 +887,7 @@
"2023-08-09": "National Women's Day",
"2023-09-24": "Heritage Day",
"2023-09-25": "Heritage Day (observed)",
"2023-12-15": "Public holiday by presidential decree",
"2023-12-15": "Public Holiday by Presidential Decree",
"2023-12-16": "Day of Reconciliation",
"2023-12-25": "Christmas Day",
"2023-12-26": "Day of Goodwill",
Expand All @@ -897,7 +897,7 @@
"2024-04-01": "Family Day",
"2024-04-27": "Freedom Day",
"2024-05-01": "Workers' Day",
"2024-05-29": "National and provincial government elections",
"2024-05-29": "National and Provincial Government Elections",
"2024-06-16": "Youth Day",
"2024-06-17": "Youth Day (observed)",
"2024-08-09": "National Women's Day",
Expand Down
2 changes: 1 addition & 1 deletion tests/countries/test_south_africa.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_country_aliases(self):
self.assertAliases(SouthAfrica, ZA, ZAF)

def test_no_holidays(self):
self.assertNoHolidays(SouthAfrica(years=1909))
self.assertNoHolidays(SouthAfrica(years=1910))

def test_special_holidays(self):
self.assertHoliday(
Expand Down
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载