-
Notifications
You must be signed in to change notification settings - Fork 138
/
Copy pathups.yaml
62 lines (62 loc) · 1.58 KB
/
ups.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# UPS holiday definitions for the Ruby Holiday gem.
#
# By Tim Anglade
#
# Updated: 2008-09-23.
# Source: http://www.ups.com/content/us/en/resources/ship/imp_exp/operation.html
---
months:
1:
- name: New Year's Day
regions: [ups]
mday: 1
observed: to_weekday_if_weekend(date)
5:
- name: Memorial Day
week: -1
regions: [ups]
wday: 1
7:
- name: Independence Day
regions: [ups]
mday: 4
observed: to_weekday_if_weekend(date)
9:
- name: Labor Day
week: 1
regions: [ups]
wday: 1
11:
- name: Thanksgiving
week: 4
regions: [ups]
wday: 4
- name: Day After Thanksgiving
function: day_after_thanksgiving(year)
regions: [ups]
12:
- name: Christmas Day
regions: [ups]
mday: 25
observed: to_weekday_if_weekend(date)
- name: New Year's Eve
regions: [ups]
mday: 31
methods:
day_after_thanksgiving:
arguments: year
source: |
Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 11, 4, 4) + 1
tests: |
{Date.civil(2008,1,1) => 'New Year\'s 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,11,27) => 'Thanksgiving',
Date.civil(2008,11,28) => 'Day After Thanksgiving',
Date.civil(2013,11,28) => 'Thanksgiving',
Date.civil(2013,11,29) => 'Day After Thanksgiving',
Date.civil(2008,12,25) => 'Christmas Day',
Date.civil(2008,12,31) => 'New Year\'s Eve',}.each do |date, name|
assert_equal name, (Holidays.on(date, :ups)[0] || {})[:name]
end