2007-11-21 22:08:34 +01:00
|
|
|
# United States holiday definitions for the Ruby Holiday gem.
|
2007-11-22 23:28:38 +01:00
|
|
|
#
|
2007-11-29 03:24:00 +01:00
|
|
|
# Updated: 2008-11-24.
|
2007-11-22 23:28:38 +01:00
|
|
|
# Source: http://en.wikipedia.org/wiki/Public_holidays_of_the_United_States
|
2007-11-21 22:08:34 +01:00
|
|
|
---
|
2007-11-22 23:28:38 +01:00
|
|
|
months:
|
2007-11-29 03:24:00 +01:00
|
|
|
0:
|
|
|
|
- name: Good Friday
|
|
|
|
regions: [us]
|
|
|
|
function: easter(year)-2
|
|
|
|
type: informal
|
2007-11-22 23:28:38 +01:00
|
|
|
1:
|
|
|
|
- name: New Year's Day
|
|
|
|
regions: [us]
|
|
|
|
mday: 1
|
2007-11-30 00:23:35 +01:00
|
|
|
observed: to_weekday_if_weekend
|
2007-11-22 23:28:38 +01:00
|
|
|
- name: Martin Luther King, Jr. Day
|
|
|
|
week: 3
|
|
|
|
regions: [us]
|
|
|
|
wday: 1
|
|
|
|
- name: Inauguration Day
|
2007-11-29 03:24:00 +01:00
|
|
|
function: us_inauguration_day(year)
|
|
|
|
regions: [us_dc]
|
|
|
|
2:
|
2007-11-22 23:28:38 +01:00
|
|
|
- name: Presidents' Day
|
|
|
|
week: 3
|
|
|
|
regions: [us]
|
|
|
|
wday: 1
|
|
|
|
5:
|
|
|
|
- name: Memorial Day
|
|
|
|
week: -1
|
|
|
|
regions: [us]
|
|
|
|
wday: 1
|
|
|
|
7:
|
|
|
|
- name: Independence Day
|
|
|
|
regions: [us]
|
|
|
|
mday: 4
|
2007-11-30 00:23:35 +01:00
|
|
|
observed: to_weekday_if_weekend
|
2007-11-22 23:28:38 +01:00
|
|
|
9:
|
|
|
|
- name: Labor Day
|
|
|
|
week: 1
|
|
|
|
regions: [us]
|
|
|
|
wday: 1
|
|
|
|
10:
|
|
|
|
- name: Columbus Day
|
|
|
|
week: 2
|
|
|
|
regions: [us]
|
|
|
|
wday: 1
|
|
|
|
11:
|
|
|
|
- name: Veterans Day
|
|
|
|
regions: [us]
|
|
|
|
mday: 11
|
2007-11-30 00:23:35 +01:00
|
|
|
observed: to_weekday_if_weekend
|
2007-11-29 03:24:00 +01:00
|
|
|
- name: Thanksgiving
|
2007-11-22 23:28:38 +01:00
|
|
|
week: 4
|
|
|
|
regions: [us]
|
|
|
|
wday: 4
|
|
|
|
12:
|
|
|
|
- name: Christmas Day
|
|
|
|
regions: [us]
|
|
|
|
mday: 25
|
2007-11-30 00:23:35 +01:00
|
|
|
observed: to_weekday_if_weekend
|
2007-11-22 23:28:38 +01:00
|
|
|
methods:
|
|
|
|
us_inauguration_day: |
|
|
|
|
# January 20, every fourth year, following Presidential election
|
|
|
|
def self.us_inauguration_day(year)
|
|
|
|
year % 4 == 1 ? 20 : nil
|
2007-12-05 23:27:05 +01:00
|
|
|
end
|
|
|
|
tests: |
|
|
|
|
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
|
|
|
Date.civil(2008,1,21) => 'Martin Luther King, Jr. Day',
|
|
|
|
Date.civil(2008,2,18) => 'Presidents\' Day',
|
|
|
|
Date.civil(2008,5,26) => 'Memorial Day',
|
|
|
|
Date.civil(2008,7,4) => 'Independence Day',
|
|
|
|
Date.civil(2008,9,1) => 'Labor Day',
|
|
|
|
Date.civil(2008,10,13) => 'Columbus Day',
|
|
|
|
Date.civil(2008,11,11) => 'Veterans Day',
|
|
|
|
Date.civil(2008,11,27) => 'Thanksgiving',
|
|
|
|
Date.civil(2008,12,25) => 'Christmas Day'}.each do |date, name|
|
|
|
|
assert_equal name, Holidays.on(date, :us)[0][:name]
|
2007-11-22 23:28:38 +01:00
|
|
|
end
|