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

Update Thailand holidays in 2025 #2081

Merged
merged 8 commits into from
Oct 29, 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
41 changes: 19 additions & 22 deletions holidays/countries/thailand.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
from holidays.observed_holiday_base import (
ObservedHolidayBase,
SAT_TO_NEXT_MON,
SAT_TO_NEXT_TUE,
THU_FRI_TO_NEXT_MON,
THU_FRI_TO_NEXT_WORKDAY,
SAT_SUN_TO_NEXT_MON,
SAT_SUN_TO_NEXT_TUE,
SAT_SUN_TO_NEXT_MON_TUE,
SAT_SUN_TO_NEXT_WORKDAY,
)


Expand All @@ -39,6 +39,7 @@ class Thailand(ObservedHolidayBase, InternationalHolidays, StaticHolidays, ThaiC
- https://resolution.soc.go.th/?prep_id=99159317
- https://resolution.soc.go.th/?prep_id=196007
- https://github.com/vacanza/holidays/pull/929
- https://www.thairath.co.th/lifestyle/life/2812118
- [New Year's Day]
`wikisource.org <http://tiny.cc/wa_wiki_thai_newyear_2483>`_
- [National Children's Day]
Expand Down Expand Up @@ -95,6 +96,7 @@ class Thailand(ObservedHolidayBase, InternationalHolidays, StaticHolidays, ThaiC
https://dl.parliament.go.th/handle/20.500.13072/92816
https://e-manage.mju.ac.th/timeline_detail.aspx?key=MTk4
https://resolution.soc.go.th/PDF_UPLOAD/2510/932141.pdf
https://www.myhora.com/ปฏิทิน/วันพืชมงคล.aspx
- [Royal Thai Armed Forces Day]
`<https://th.wikipedia.org/wiki/วันกองทัพไทย>`_
- [Teacher's Day]
Expand All @@ -115,7 +117,7 @@ class Thailand(ObservedHolidayBase, InternationalHolidays, StaticHolidays, ThaiC
Applied Automatically for Workday if on Weekends: 2001-Present

Limitations:
- This is only 100% accurate for 1997-2024; any future dates are up to the
- This is only 100% accurate for 1997-2025; any future dates are up to the
Royal Thai Government Gazette which updates on a year-by-year basis.

- Approx. date only goes as far back as 1941 (B.E. 2484) as the Thai
Expand All @@ -129,8 +131,6 @@ class Thailand(ObservedHolidayBase, InternationalHolidays, StaticHolidays, ThaiC
- Royal Ploughing Ceremony Day is date is announced on an annual basis
by the Court Astrologers, thus need an annual update to the library here

- This doesn't cover Thai regional public holidays yet, only stubs added

Country created by: `arkid15r <https://github.com/arkid15r>`__

Country maintained by: `PPsyrius <https://github.com/PPsyrius>`__
Expand Down Expand Up @@ -221,15 +221,16 @@ def _populate_public_holidays(self):

# วันหยุดชดเชยวันสงกรานต์
# If Songkran happened to be held on the weekends, only one in-lieu
# public holiday is added, No in lieus for SUN-MON-TUE case.
# public holiday is added.
# - CASE 1: THU-FRI-SAT -> 1 in-lieu on MON
# - CASE 2: FRI-SAT-SUN -> 1 in-lieu on MON
# - CASE 3: SAT-SUN-MON -> 1 in-lieu on TUE
# - CASE 4: SUN-MON-TUE -> 1 in-lieu on WED
# See in lieu logic in `_add_observed(dt: date)`.
# Status: In Use.

if self._year >= 1995:
self._add_observed(dt, rule=THU_FRI_TO_NEXT_MON + SAT_TO_NEXT_TUE)
self._add_observed(dt, rule=THU_FRI_TO_NEXT_WORKDAY + SAT_SUN_TO_NEXT_WORKDAY)

# วันแรงงานแห่งชาติ
# Status: In-Use.
Expand Down Expand Up @@ -433,17 +434,13 @@ def _populate_public_holidays(self):
# Status: In-Use.

# Makha Bucha.
makha_bucha_date = self._add_makha_bucha(tr("วันมาฆบูชา"))
if makha_bucha_date:
self._add_observed(makha_bucha_date)
self._add_observed(self._add_makha_bucha(tr("วันมาฆบูชา")))

# วันวิสาขบูชา
# Status: In-Use.

# Visakha Bucha.
visakha_bucha_date = self._add_visakha_bucha(tr("วันวิสาขบูชา"))
if visakha_bucha_date:
self._add_observed(visakha_bucha_date)
self._add_observed(self._add_visakha_bucha(tr("วันวิสาขบูชา")))

# วันอาสาฬหบูชา
# Status: In-Use.
Expand All @@ -452,9 +449,9 @@ def _populate_public_holidays(self):
# - CASE 3: SUN-MON -> 1 in-lieu on TUE

# Asarnha Bucha.
asarnha_bucha_date = self._add_asarnha_bucha(tr("วันอาสาฬหบูชา"))
if asarnha_bucha_date:
self._add_observed(asarnha_bucha_date, rule=SAT_SUN_TO_NEXT_MON_TUE)
self._add_observed(
self._add_asarnha_bucha(tr("วันอาสาฬหบูชา")), rule=SAT_SUN_TO_NEXT_MON_TUE
)

# วันเข้าพรรษา
# Status: In-Use.
Expand All @@ -463,9 +460,7 @@ def _populate_public_holidays(self):
# - CASE 3: SUN-MON -> 1 in-lieu on TUE

# Buddhist Lent Day.
khao_phansa_date = self._add_khao_phansa(tr("วันเข้าพรรษา"))
if khao_phansa_date:
self._add_observed(khao_phansa_date, rule=SAT_TO_NEXT_MON)
self._add_observed(self._add_khao_phansa(tr("วันเข้าพรรษา")), rule=SAT_TO_NEXT_MON)

def _populate_armed_forces_holidays(self):
# วันกองทัพไทย
Expand Down Expand Up @@ -525,8 +520,9 @@ def _populate_government_holidays(self):
# Is dated on an annual basis by the Royal Palace, always on weekdays.
# For historic research, วันเกษตรแห่งชาติ (National Agricultural Day) also concides with
# this from 1966 onwards. For earlier records the date was refered as วันแรกนาขวัญ.
# This isn't even fixed even by the Thai Lunar Calendar, but instead
# by Court Astrologers; All chosen dates are all in the first three weeks of May.
# This isn't even fixed even by the Thai Lunar Calendar besides being in Month 6
# to concides with the rainy season, but instead by Court Astrologers; All chosen dates
# so far are all in the first three weeks of May.
# *** NOTE: only observed by government sectors.
# TODO: Update this annually around Dec of each year.

Expand Down Expand Up @@ -597,8 +593,9 @@ def _populate_government_holidays(self):
2022: (MAY, 13),
2023: (MAY, 17),
2024: (MAY, 10),
2025: (MAY, 9),
}
if 1960 <= self._year <= 2024 and self._year != 1999:
if 1960 <= self._year <= 2025 and self._year != 1999:
self._add_observed(
# Royal Ploughing Ceremony.
self._add_holiday(tr("วันพืชมงคล"), raeknakhwan_dates.get(self._year, (MAY, 13)))
Expand Down
8 changes: 8 additions & 0 deletions snapshots/countries/TH_COMMON.json
Original file line number Diff line number Diff line change
Expand Up @@ -1287,6 +1287,7 @@
"2003-04-13": "Songkran Festival",
"2003-04-14": "Songkran Festival",
"2003-04-15": "Songkran Festival",
"2003-04-16": "Songkran Festival (in lieu)",
"2003-05-01": "National Labor Day",
"2003-05-05": "Coronation Day",
"2003-05-08": "Royal Ploughing Ceremony",
Expand Down Expand Up @@ -1463,6 +1464,7 @@
"2008-04-13": "Songkran Festival",
"2008-04-14": "Songkran Festival",
"2008-04-15": "Songkran Festival",
"2008-04-16": "Songkran Festival (in lieu)",
"2008-05-01": "National Labor Day",
"2008-05-05": "Coronation Day",
"2008-05-09": "Royal Ploughing Ceremony",
Expand Down Expand Up @@ -1677,6 +1679,7 @@
"2014-04-13": "Songkran Festival",
"2014-04-14": "Songkran Festival",
"2014-04-15": "Songkran Festival",
"2014-04-16": "Songkran Festival (in lieu)",
"2014-05-01": "National Labor Day",
"2014-05-05": "Coronation Day",
"2014-05-09": "Royal Ploughing Ceremony",
Expand Down Expand Up @@ -2087,9 +2090,11 @@
"2025-04-13": "Songkran Festival",
"2025-04-14": "Songkran Festival",
"2025-04-15": "Songkran Festival",
"2025-04-16": "Songkran Festival (in lieu)",
"2025-05-01": "National Labor Day",
"2025-05-04": "Coronation Day",
"2025-05-05": "Coronation Day (in lieu)",
"2025-05-09": "Royal Ploughing Ceremony",
"2025-05-11": "Visakha Bucha",
"2025-05-12": "Visakha Bucha (in lieu)",
"2025-06-03": "HM Queen Suthida's Birthday",
Expand Down Expand Up @@ -2301,6 +2306,7 @@
"2031-04-13": "Songkran Festival",
"2031-04-14": "Songkran Festival",
"2031-04-15": "Songkran Festival",
"2031-04-16": "Songkran Festival (in lieu)",
"2031-05-01": "National Labor Day",
"2031-05-04": "Coronation Day",
"2031-05-05": "Coronation Day (in lieu)",
Expand Down Expand Up @@ -2480,6 +2486,7 @@
"2036-04-13": "Songkran Festival",
"2036-04-14": "Songkran Festival",
"2036-04-15": "Songkran Festival",
"2036-04-16": "Songkran Festival (in lieu)",
"2036-05-01": "National Labor Day",
"2036-05-04": "Coronation Day",
"2036-05-05": "Coronation Day (in lieu)",
Expand Down Expand Up @@ -2691,6 +2698,7 @@
"2042-04-13": "Songkran Festival",
"2042-04-14": "Songkran Festival",
"2042-04-15": "Songkran Festival",
"2042-04-16": "Songkran Festival (in lieu)",
"2042-05-01": "National Labor Day",
"2042-05-04": "Coronation Day",
"2042-05-05": "Coronation Day (in lieu)",
Expand Down
64 changes: 64 additions & 0 deletions tests/calendars/test_thai.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,26 @@ def test_asarnha_bucha_date(self):
asarnha_bucha_year_date = {
self.calendar.START_YEAR - 1: None,
self.calendar.END_YEAR + 1: None,
2010: date(2010, JUL, 26),
2011: date(2011, JUL, 15),
2012: date(2012, AUG, 2),
2013: date(2013, JUL, 22),
2014: date(2014, JUL, 11),
2015: date(2015, JUL, 30),
2016: date(2016, JUL, 19),
2017: date(2017, JUL, 8),
2018: date(2018, JUL, 27),
2019: date(2019, JUL, 16),
2020: date(2020, JUL, 5),
2021: date(2021, JUL, 24),
2022: date(2022, JUL, 13),
2023: date(2023, AUG, 1),
2024: date(2024, JUL, 20),
2025: date(2025, JUL, 10),
2026: date(2026, JUL, 29),
2027: date(2027, JUL, 18),
2028: date(2028, JUL, 6),
2029: date(2029, JUL, 25),
2030: date(2030, JUL, 14),
2040: date(2040, JUL, 23),
2050: date(2050, AUG, 2),
Expand Down Expand Up @@ -148,10 +164,26 @@ def test_khao_phansa_date(self):
khao_phansa_year_date = {
self.calendar.START_YEAR - 1: None,
self.calendar.END_YEAR + 1: None,
2010: date(2010, JUL, 27),
2011: date(2011, JUL, 16),
2012: date(2012, AUG, 3),
2013: date(2013, JUL, 23),
2014: date(2014, JUL, 12),
2015: date(2015, JUL, 31),
2016: date(2016, JUL, 20),
2017: date(2017, JUL, 9),
2018: date(2018, JUL, 28),
2019: date(2019, JUL, 17),
2020: date(2020, JUL, 6),
2021: date(2021, JUL, 25),
2022: date(2022, JUL, 14),
2023: date(2023, AUG, 2),
2024: date(2024, JUL, 21),
2025: date(2025, JUL, 11),
2026: date(2026, JUL, 30),
2027: date(2027, JUL, 19),
2028: date(2028, JUL, 7),
2029: date(2029, JUL, 26),
2030: date(2030, JUL, 15),
2040: date(2040, JUL, 24),
2050: date(2050, AUG, 3),
Expand Down Expand Up @@ -205,10 +237,26 @@ def test_makha_bucha_date(self):
makha_bucha_year_date = {
self.calendar.START_YEAR - 1: None,
self.calendar.END_YEAR + 1: None,
2010: date(2010, FEB, 28),
2011: date(2011, FEB, 18),
2012: date(2012, MAR, 7),
2013: date(2013, FEB, 25),
2014: date(2014, FEB, 14),
2015: date(2015, MAR, 4),
2016: date(2016, FEB, 22),
2017: date(2017, FEB, 11),
2018: date(2018, MAR, 1),
2019: date(2019, FEB, 19),
2020: date(2020, FEB, 8),
2021: date(2021, FEB, 26),
2022: date(2022, FEB, 16),
2023: date(2023, MAR, 6),
2024: date(2024, FEB, 24),
2025: date(2025, FEB, 12),
2026: date(2026, MAR, 3),
2027: date(2027, FEB, 21),
2028: date(2028, FEB, 10),
2029: date(2029, FEB, 27),
2030: date(2030, FEB, 17),
2040: date(2040, FEB, 26),
2050: date(2050, MAR, 7),
Expand Down Expand Up @@ -303,10 +351,26 @@ def test_visakha_bucha_date(self):
visakha_bucha_year_date = {
self.calendar.START_YEAR - 1: None,
self.calendar.END_YEAR + 1: None,
2010: date(2010, MAY, 28),
2011: date(2011, MAY, 17),
2012: date(2012, JUN, 4),
2013: date(2013, MAY, 24),
2014: date(2014, MAY, 13),
2015: date(2015, JUN, 1),
2016: date(2016, MAY, 20),
2017: date(2017, MAY, 10),
2018: date(2018, MAY, 29),
2019: date(2019, MAY, 18),
2020: date(2020, MAY, 6),
2021: date(2021, MAY, 26),
2022: date(2022, MAY, 15),
2023: date(2023, JUN, 3),
2024: date(2024, MAY, 22),
2025: date(2025, MAY, 11),
2026: date(2026, MAY, 31),
2027: date(2027, MAY, 20),
2028: date(2028, MAY, 8),
2029: date(2029, MAY, 27),
2030: date(2030, MAY, 16),
2040: date(2040, MAY, 25),
2050: date(2050, JUN, 4),
Expand Down
Loading