0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-09 21:45:25 +08:00
discourse/plugins/discourse-events/vendor/holidays/definitions/us.yaml
2026-07-24 16:39:27 +04:00

631 lines
17 KiB
YAML
Vendored
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# United States holiday definitions for the Ruby Holiday gem.
#
# Updated: 2024-02-05.
#
# Changed: 2024-02-05
# - Remove Lee-Jackson Day
#
# Changed: 2017-06-15 to 2017-06-20
# - Add missing holiday information for a whole bunch of US states
# - Correct some existing holiday information
# - Add custom functions for Georgias State Holiday, Lee-Jackson Day and Election Day
# - Add custom functions for Rosh Hashanah and Yom Kippur with pre-defined dates from 2014 to 2020
# - Add missing tests and correct existing tests
# - Add helpful comments
# - Add a lot of used sources
#
# Common Sources:
# - http://en.wikipedia.org/wiki/Public_holidays_of_the_United_States
# - https://www.timeanddate.com/holidays/us/
# - https://publicholidays.us
# - https://en.wikipedia.org/wiki/List_of_U.S._state_abbreviations
# - https://www.opm.gov/policy-data-oversight/pay-leave/federal-holidays/
# Sources about special state holidays:
# - https://en.wikipedia.org/wiki/Black_Friday_(shopping)#United_States
# - http://www.officeholidays.com/countries/usa/black_friday.php
# - https://publicholidays.us/christmas/
# - https://publicholidays.us/kansas/
# - https://publicholidays.us/Wisconsin/
# - https://publicholidays.us/Arkansas/
# - https://publicholidays.us/Georgia/
# - https://publicholidays.us/Maryland/
# - https://publicholidays.us/Nevada/
# - https://publicholidays.us/Ohio/
# - http://www.sos.ms.gov/education-publications/pages/state-holidays.aspx
# - http://www.leg.state.fl.us/Statutes/index.cfm?App_mode=Display_Statute&Search_String=&URL=0100-0199/0110/Sections/0110.117.html
# - http://www.statutes.legis.state.tx.us/Docs/GV/htm/GV.662.htm
# - https://en.wikipedia.org/wiki/Lincoln%27s_Birthday
# - https://en.wikipedia.org/wiki/Washington%27s_Birthday
# - https://en.wikipedia.org/wiki/Shrove_Tuesday
# - https://en.wikipedia.org/wiki/Town_meeting#Vermont
# - https://en.wikipedia.org/wiki/Seward%27s_Day
# - https://en.wikipedia.org/wiki/Emancipation_Day
# - https://en.wikipedia.org/wiki/Patriots%27_Day
# - https://georgia.gov/popular-topic/observing-state-holidays
# - https://en.wikipedia.org/wiki/Confederate_Memorial_Day
# - http://www.admin.sc.gov/humanresources/employee-information/benefits-and-leave/holiday-leave
# - http://louisiana.gov/Government/For_State_Employees/
# - http://www.leg.state.fl.us/statutes/index.cfm?App_mode=Display_Statute&Search_String=&URL=0600-0699/0683/Sections/0683.01.html
# - http://dhrd.hawaii.gov/state-observed-holidays/
# - https://www.timeanddate.com/holidays/us/kamehameha-day
# - http://www.mass.gov/anf/employment-equal-access-disability/hr-policies/legal-holiday-calendar.html
# - http://www.edd.ca.gov/payroll_taxes/Legal_Holidays.htm
# - https://en.wikipedia.org/wiki/Emancipation_Day#United_States
# - http://www.visuperiorcourt.org/about/holidays.aspx
# - http://www.personnel.wv.gov/employees/benefits/Pages/Holidays.aspx
# - https://www.timeanddate.com/holidays/us/pioneer-day
# - http://sos.ri.gov/divisions/Civics-And-Education/ri-state-holidays
# - http://humanresources.vermont.gov/benefits-wellness/holiday-schedule
# - http://doa.alaska.gov/dop/fileadmin/socc/pdf/bkgrnd_socc10.pdf
# - https://en.wikipedia.org/wiki/Election_Day_(United_States)
# - https://www.timeanddate.com/holidays/us/yom-kippur
# - https://www.timeanddate.com/holidays/us/rosh-hashana
# - http://www.when-is.com/rosh-hashanah-2014.asp
# - https://de.wikipedia.org/wiki/Jom_Kippur#Jom_Kippur-Termine
# - https://de.wikipedia.org/wiki/Rosch_ha-Schana#Zeitpunkt_und_Einbettung_in_den_j.C3.BCdischen_Kalender
# - https://als.wikipedia.org/wiki/Rosch_ha-Schana
# - http://www.kleiner-kalender.de/event/rosch-ha-schana/0651c.html
# - http://www.kaldix.com/united-states/calendar/virginia/holidays/independence-day/year-2017/
# - https://publicholidays.us/independence-day/
---
months:
0:
- name: Mardi Gras Day
regions: [us_la]
function: easter(year)
function_modifier: -47
- name: Good Friday # public holiday in the following states
regions: [us_ct, us_de, us_ga, us_hi, us_in, us_la, us_ky, us_la, us_nj, us_nc, us_nd, us_pr, us_tn]
function: easter(year)
function_modifier: -2
1:
- name: New Year's Day
regions: [us]
mday: 1
observed: to_weekday_if_weekend(date)
- name: Martin Luther King, Jr. Day # Third Monday in January
regions: [us]
week: 3
wday: 1
2:
- name: Lincoln's Birthday
regions: [us_ct, us_il]
mday: 12
observed: to_weekday_if_weekend(date)
- name: Presidents' Day # Third Monday in February
regions: [us]
week: 3
wday: 1
3:
- name: Town Meeting Day # First Tuesday in March
regions: [us_vt]
week: 1
wday: 2
- name: Prince Jonah Kuhio Kalanianaole Day
regions: [us_hi]
observed: to_weekday_if_weekend(date)
mday: 26
- name: Seward's Day # Last Monday in March
regions: [us_ak]
week: -1
wday: 1
- name: César Chávez Day # fixed
regions: [us_ca]
mday: 31
observed: to_weekday_if_weekend(date)
4:
- name: Emancipation Day
regions: [us_dc]
observed: to_weekday_if_weekend(date)
mday: 16
- name: Patriots' Day # Third Monday in April
regions: [us_me, us_ma]
week: 3
wday: 1
- name: Confederate Memorial Day # Last Monday in April
regions: [us_al, us_ms]
week: -1
wday: 1
- name: Arbor Day # Last Friday in April
regions: [us_ne]
week: -1
wday: 5
5:
- name: Truman Day # fixed
regions: [us_mo]
mday: 8
- name: Confederate Memorial Day # fixed
regions: [us_sc]
mday: 10
observed: to_weekday_if_weekend(date)
- name: Memorial Day # Last Monday in May
regions: [us]
week: -1
wday: 1
6:
- name: Jefferson Davis' Birthday # First Monday in June
regions: [us_al]
week: 1
wday: 1
- name: King Kamehameha I Day
regions: [us_hi]
observed: to_weekday_if_weekend(date)
mday: 11
- name: Juneteenth # fixed
regions: [us]
mday: 19
observed: to_weekday_if_weekend(date)
- name: West Virginia Day
regions: [us_wv]
mday: 20
observed: to_weekday_if_weekend(date)
7:
- name: Independence Day # fixed
regions: [us]
mday: 4
function: to_weekday_if_weekend(date)
- name: Pioneer Day # fixed
regions: [us_ut]
mday: 24
8:
- name: Victory Day # Second Monday in August
regions: [us_ri]
week: 2
wday: 1
- name: Bennington Battle Day
regions: [us_vt]
mday: 16
observed: to_weekday_if_weekend(date)
- name: Statehood Day # Third Friday in August
regions: [us_hi]
week: 3
wday: 5
9:
- name: Labor Day
regions: [us]
week: 1
wday: 1
10:
- name: Indigenous Peoples Day
regions: [us]
week: 2
wday: 1
- name: Alaska Day # fixed
regions: [us_ak]
mday: 18
observed: to_weekday_if_weekend(date)
- name: Nevada Day # Last Friday in October
regions: [us_nv]
week: -1
wday: 5
observed: to_weekday_if_weekend(date)
11:
- name: Election Day
regions: [us_il, us_la, us_ny]
mday: 3
- name: Veterans Day
regions: [us]
mday: 11
observed: to_weekday_if_weekend(date)
- name: Thanksgiving
regions: [us]
week: 4
wday: 4
- name: Family Day
function: day_after_thanksgiving(year)
regions: [us_nv]
- name: State Holiday
function: day_after_thanksgiving(year)
regions: [us_ga]
- name: Presidents' Day
function: day_after_thanksgiving(year)
regions: [us_nm]
- name: Lincoln's Birthday
function: day_after_thanksgiving(year)
regions: [us_in]
- name: American Indian Heritage Day
function: day_after_thanksgiving(year)
regions: [us_md]
- name: Day after Thanksgiving (Black Friday)
function: day_after_thanksgiving(year)
regions: [us_ca, us_de, us_fl, us_ga, us_ia, us_il, us_ks, us_ky, us_me, us_mi, us_mn, us_ms, us_ne, us_nh, us_nc, us_ok, us_or, us_pa, us_sc, us_tn, us_tx, us_va, us_wa, us_wv]
12:
- name: Christmas Eve Day
regions: [us_ar, us_ks, us_mi, us_nc, us_sc, us_tx, us_wi]
mday: 24
- name: Christmas Day
regions: [us]
mday: 25
observed: to_weekday_if_weekend(date)
- name: Day after Christmas
regions: [us_nc, us_sc, us_tx]
mday: 28
- name: New Year's Eve
regions: [us_mi, us_wi]
mday: 31
methods:
christmas_eve_holiday:
arguments: date
ruby: |
beginning_of_month = Date.civil(date.year, date.month, 1)
(date.saturday? || date.sunday?) ? date.downto(beginning_of_month).find {|d| d if d.wday == 5} : date
georgia_state_holiday:
# Monday before that holiday
arguments: year, month
ruby: |
beginning_of_month = Date.civil(year, month, 1)
state_holiday = Date.civil(year, month, 26)
state_holiday.downto(beginning_of_month).find {|date| date if date.wday == 1 }
election_day:
# Tuesday after the first Monday of November
arguments: year
ruby: |
Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 11, 1, 1) + 1
us_inauguration_day:
# January 20, every fourth year, following Presidential election
arguments: year
ruby: |
year % 4 == 1 ? 20 : nil
day_after_thanksgiving:
arguments: year
ruby: |
Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 11, 4, 4) + 1
tests:
- given:
date: ['2025-3-4', '2026-2-17', '2027-2-9']
regions: ["us_la"]
expect:
name: 'Mardi Gras Day'
- given:
date: ['2025-3-4', '2026-2-17', '2027-2-9']
regions: ["us"]
expect:
holiday: false
- given:
date: ['2025-4-18', '2026-4-3', '2027-3-26']
regions: ["us_ct","us_de","us_ga","us_hi","us_in","us_ky","us_la","us_nj","us_nc","us_nd","us_pr","us_tn"]
expect:
name: 'Good Friday'
- given:
date: ['2025-4-18', '2026-4-3', '2027-3-26']
regions: ["us"]
expect:
holiday: false
- given:
date: '2028-1-1'
regions: ["us"]
expect:
name: "New Year's Day"
- given:
date: '2027-12-31'
regions: ["us"]
options: ["observed"]
expect:
name: "New Year's Day"
- given:
date: ['2017-1-16', '2018-1-15', '2019-1-21']
regions: ["us"]
expect:
name: "Martin Luther King, Jr. Day"
- given:
date: ['2025-1-20', '2026-1-19', '2027-1-18']
regions: ["us"]
expect:
name: "Martin Luther King, Jr. Day"
- given:
date: ['2025-2-17', '2026-2-16', '2027-2-15']
regions: ["us"]
expect:
name: "Presidents' Day"
- given:
date: ['2025-3-4', '2026-3-3', '2027-3-2']
regions: ["us"]
expect:
holiday: false
- given:
date: ['2025-3-4', '2026-3-3', '2027-3-2']
regions: ["us_vt"]
expect:
name: "Town Meeting Day"
- given:
date: ['2025-3-26', '2026-3-26', '2028-3-27']
regions: ["us"]
options: ["observed"]
expect:
holiday: false
- given:
date: ['2025-3-26', '2026-3-26', '2028-3-27']
regions: ["us_hi"]
options: ["observed"]
expect:
name: "Prince Jonah Kuhio Kalanianaole Day"
- given:
date: ['2028-3-26']
regions: ["us"]
expect:
holiday: false
- given:
date: ['2028-3-26']
regions: ["us_hi"]
expect:
name: "Prince Jonah Kuhio Kalanianaole Day"
- given:
date: ['2025-3-31', '2026-3-30', '2027-3-29']
regions: ["us"]
expect:
holiday: false
- given:
date: ['2025-3-31', '2026-3-30', '2027-3-29']
regions: ["us_ak"]
expect:
name: "Seward's Day"
- given:
date: ['2025-3-31', '2026-3-31', '2027-3-31']
regions: ["us_ca"]
expect:
name: "César Chávez Day"
- given:
date: ['2025-4-16', '2026-4-16', '2027-4-16', '2028-4-17']
regions: ["us_dc"]
options: ["observed"]
expect:
name: "Emancipation Day"
- given:
date: ['2028-4-16']
regions: ["us_dc"]
expect:
name: "Emancipation Day"
- given:
date: ['2025-4-21', '2026-4-20', '2027-4-19']
regions: ["us"]
expect:
holiday: false
- given:
date: ['2025-4-21', '2026-4-20', '2027-4-19']
regions: ["us_me", "us_ma"]
expect:
name: "Patriots' Day"
- given:
date: ['2025-4-28', '2026-4-27', '2027-4-26']
regions: ["us"]
expect:
holiday: false
- given:
date: ['2025-4-28', '2026-4-27', '2027-4-26']
regions: ["us_al", "us_ms"]
expect:
name: "Confederate Memorial Day"
- given:
date: ['2025-4-25']
regions: ["us_ne"]
expect:
name: "Arbor Day"
- given:
date: ['2025-5-8']
regions: ["us_mo"]
expect:
name: "Truman Day"
- given:
date: ['2025-5-10']
regions: ["us_sc"]
expect:
name: "Confederate Memorial Day"
- given:
date: ['2025-5-26', '2026-5-25', '2027-5-31']
regions: ["us"]
expect:
name: "Memorial Day"
- given:
date: ['2025-6-2', '2026-6-1', '2027-6-7']
regions: ["us"]
expect:
holiday: false
- given:
date: ['2025-6-2', '2026-6-1', '2027-6-7']
regions: ["us_al"]
expect:
name: "Jefferson Davis' Birthday"
- given:
date: ['2025-6-11', '2026-6-11', '2027-6-11', '2028-6-11']
regions: ["us"]
expect:
holiday: false
- given:
date: ['2028-6-11']
regions: ["us_hi"]
expect:
name: "King Kamehameha I Day"
- given:
date: ['2025-6-11', '2026-6-11', '2027-6-11', '2028-6-12']
regions: ["us_hi"]
options: ["observed"]
expect:
name: "King Kamehameha I Day"
- given:
date: ['2025-6-20','2027-6-20']
regions: ["us"]
expect:
holiday: false
- given:
date: ['2025-6-20','2027-6-21']
regions: ["us_wv"]
options: ["observed"]
expect:
name: "West Virginia Day"
- given:
date: ['2026-6-20']
regions: ["us_wv"]
expect:
name: "West Virginia Day"
- given:
date: ['2025-7-4', '2026-7-3', '2027-7-5']
regions: ["us"]
options: ["observed"]
expect:
name: "Independence Day"
- given:
date: ['2025-7-24']
regions: ["us_ut"]
expect:
name: "Pioneer Day"
- given:
date: ['2025-8-11', '2026-8-10', '2027-8-9']
regions: ["us"]
expect:
holiday: false
- given:
date: ['2025-8-11', '2026-8-10', '2027-8-9']
regions: ["us_ri"]
expect:
name: "Victory Day"
- given:
date: ['2025-8-15', '2026-8-17', '2027-8-16']
regions: ["us"]
expect:
holiday: false
- given:
date: ['2025-8-15', '2026-8-17', '2027-8-16']
regions: ["us_vt"]
options: ["observed"]
expect:
name: "Bennington Battle Day"
- given:
date: ['2025-8-16', '2026-8-16', '2027-8-16']
regions: ["us_vt"]
expect:
name: "Bennington Battle Day"
- given:
date: ['2025-8-15', '2026-8-21', '2027-8-20']
regions: ["us"]
expect:
holiday: false
- given:
date: ['2025-8-15', '2026-8-21', '2027-8-20']
regions: ["us_hi"]
expect:
name: "Statehood Day"
- given:
date: ['2025-9-1', '2026-9-7', '2027-9-6']
regions: ["us"]
expect:
name: "Labor Day"
- given:
date: ['2025-10-13', '2026-10-12', '2027-10-11']
regions: ["us"]
expect:
name: "Indigenous Peoples Day"
- given:
date: ['2025-10-18']
regions: ["us_ak"]
expect:
name: "Alaska Day"
- given:
date: ['2025-10-17']
regions: ["us_ak"]
options: ["observed"]
expect:
name: "Alaska Day"
- given:
date: ['2025-10-31', '2026-10-30', '2027-10-29']
regions: ["us"]
expect:
holiday: false
- given:
date: ['2025-10-31', '2026-10-30', '2027-10-29']
regions: ["us_nv"]
expect:
name: "Nevada Day"
- given:
date: ['2025-11-11', '2026-11-11', '2027-11-11', '2028-11-10']
regions: ["us"]
options: ["observed"]
expect:
name: "Veterans Day"
- given:
date: ['2028-11-11']
regions: ["us"]
expect:
name: "Veterans Day"
- given:
date: ['2025-11-27', '2026-11-26', '2027-11-25']
regions: ["us"]
expect:
name: "Thanksgiving"
- given:
date: ['2025-11-28', '2026-11-27', '2027-11-26']
regions: ["us"]
expect:
holiday: false
- given:
date: ['2025-11-28', '2026-11-27', '2027-11-26']
regions: ["us_ca", "us_de", "us_fl", "us_ga", "us_ia", "us_il", "us_ks", "us_ky", "us_me", "us_mi", "us_mn", "us_ms", "us_ne", "us_nh", "us_nc", "us_ok", "us_or", "us_pa", "us_sc", "us_tn", "us_tx", "us_va", "us_wa", "us_wv"]
expect:
name: "Day after Thanksgiving (Black Friday)"
- given:
date: ['2025-12-24', '2026-12-24']
regions: ["us_ar", "us_mi", "us_nc", "us_sc", "us_tx", "us_wi"]
expect:
name: "Christmas Eve Day"
- given:
date: ['2025-12-25', '2026-12-25', '2027-12-24']
regions: ["us"]
options: ["observed"]
expect:
name: "Christmas Day"
- given:
date: ['2027-12-25']
regions: ["us"]
expect:
name: "Christmas Day"
- given:
date: ['2025-12-26']
regions: ["us"]
expect:
holiday: false
- given:
date: ['2025-12-26']
regions: ["us_nc", "us_sc", "us_tx"]
expect:
name: "Day after Christmas"
- given:
date: ['2025-12-31']
regions: ["us_mi", "us_wi"]
expect:
name: "New Year's Eve"