-
Notifications
You must be signed in to change notification settings - Fork 281
/
gb.yaml
124 lines (118 loc) · 4.11 KB
/
gb.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# Great Britain/United Kingdom holiday definitions for the Ruby Holiday gem.
#
# Including England, Wales, Scotland, N. Ireland, the Isle of Man, Guernsey
# and Jersey.
#
# Updated: 2008-11-28.
# Sources:
# - http://en.wikipedia.org/wiki/List_of_holidays_by_country#United_Kingdom_and_Crown_dependencies
#
# Notes:
# - Jersey, Guernsey and the Isle of Man are encode with both their ISO 3166-1 and ISO 3-3166-2 codes.
# - England and Wales together should be encoded as [gb_eng, gb_wls, gb_eaw...]
---
months:
0:
- name: Good Friday
regions: [gb]
function: easter(year)-2
- name: Easter Sunday
regions: [gb]
function: easter(year)
- name: Easter Monday
regions: [gb_eng, gb_wls, gb_eaw, gb_nir]
function: easter(year)+1
1:
- name: New Year's Day
regions: [gb]
mday: 1
observed: to_monday_if_weekend
- name: 2nd January
regions: [gb_sct]
mday: 2
observed: to_weekday_if_boxing_weekend
3:
- name: St. Piran's Day
regions: [gb_con]
mday: 5
- name: St. Patrick's Day
regions: [gb_nir]
mday: 17
5:
- name: May Day
regions: [gb]
week: 1
wday: 1
- name: Liberation Day
regions: [je, gb_jsy, gg, gb_gsy]
mday: 9
- name: Bank Holiday
regions: [gb]
week: -1
wday: 1
7:
- name: Tynwald Day
regions: [im, gb_iom]
mday: 5
- name: Battle of the Boyne
regions: [gb_nir]
mday: 12
8:
- name: Bank Holiday
regions: [gb_sct]
week: 1
wday: 1
- name: Bank Holiday
regions: [gb_eng, gb_wls, gb_eaw, gb_nir]
week: -1
wday: 1
11:
- name: Guy Fawkes Day
regions: [gb]
mday: 5
type: informal
- name: St. Andrew's Day
regions: [gb_sct]
mday: 30
type: informal
observed: to_monday_if_weekend
12:
- name: Christmas Day
regions: [gb]
mday: 25
observed: to_monday_if_weekend
- name: Boxing Day
regions: [gb]
mday: 26
observed: to_weekday_if_boxing_weekend
tests: |
{Date.civil(2008,3,21) => 'Good Friday',
Date.civil(2008,3,23) => 'Easter Sunday',
Date.civil(2008,5,5) => 'May Day',
Date.civil(2008,5,26) => 'Bank Holiday',
Date.civil(2008,11,5) => 'Guy Fawkes Day',
Date.civil(2008,12,25) => 'Christmas Day',
Date.civil(2008,12,26) => 'Boxing Day'}.each do |date, name|
assert_equal name, (Holidays.on(date, :gb, :informal)[0] || {})[:name]
end
assert_equal 'St. Patrick\'s Day', Date.civil(2008,3,17).holidays(:gb_nir, :informal)[0][:name]
assert_equal 'St. Andrew\'s Day', Date.civil(2008,11,30).holidays(:gb_sct, :informal)[0][:name]
assert_equal 'Christmas Day', Date.civil(2008,12,25).holidays(:gb_, :observed)[0][:name]
assert_equal 'Christmas Day', Date.civil(2009,12,25).holidays(:gb_, :observed)[0][:name]
assert_equal 'Christmas Day', Date.civil(2010,12,27).holidays(:gb_, :observed)[0][:name]
assert_equal 'Boxing Day', Date.civil(2008,12,26).holidays(:gb_, :observed)[0][:name]
assert_equal 'Boxing Day', Date.civil(2009,12,28).holidays(:gb_, :observed)[0][:name]
assert_equal 'Boxing Day', Date.civil(2010,12,28).holidays(:gb_, :observed)[0][:name]
assert_equal 'Boxing Day', Date.civil(2011,12,27).holidays(:gb_, :observed)[0][:name]
assert_equal 'New Year\'s Day', Date.civil(2010,1,1).holidays(:gb, :observed)[0][:name]
assert_equal 'New Year\'s Day', Date.civil(2011,1,3).holidays(:gb, :observed)[0][:name]
assert_equal 'New Year\'s Day', Date.civil(2012,1,2).holidays(:gb, :observed)[0][:name]
assert_equal '2nd January', Date.civil(2010,1,4).holidays(:gb_sct, :observed)[0][:name]
assert_equal '2nd January', Date.civil(2011,1,4).holidays(:gb_sct, :observed)[0][:name]
assert_equal '2nd January', Date.civil(2012,1,3).holidays(:gb_sct, :observed)[0][:name]
assert_equal '2nd January', Date.civil(2013,1,2).holidays(:gb_sct, :observed)[0][:name]
assert_equal '2nd January', Date.civil(2014,1,2).holidays(:gb_sct, :observed)[0][:name]
[:gb_wls, :gb_eng, :gb_nir, :gb_eaw, :gb_].each do |r|
assert_equal 'Easter Monday', Date.civil(2008,3,24).holidays(r)[0][:name]
assert_equal 'Bank Holiday', Date.civil(2008,8,25).holidays(r)[0][:name]
end