wombleton-holidays 0.9.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. data/.gitignore +3 -0
  2. data/CHANGELOG +22 -0
  3. data/LICENSE +21 -0
  4. data/README.rdoc +77 -0
  5. data/REFERENCES +16 -0
  6. data/VERSION +1 -0
  7. data/data/SYNTAX +111 -0
  8. data/data/au.yaml +111 -0
  9. data/data/build_defs.rb +152 -0
  10. data/data/ca.yaml +141 -0
  11. data/data/cz.yaml +68 -0
  12. data/data/de.yaml +111 -0
  13. data/data/dk.yaml +117 -0
  14. data/data/es.yaml +161 -0
  15. data/data/fr.yaml +70 -0
  16. data/data/gb.yaml +106 -0
  17. data/data/ie.yaml +58 -0
  18. data/data/index.yaml +26 -0
  19. data/data/is.yaml +136 -0
  20. data/data/it.yaml +66 -0
  21. data/data/mx.yaml +106 -0
  22. data/data/nl.yaml +67 -0
  23. data/data/no.yaml +82 -0
  24. data/data/north_america_informal.yaml +49 -0
  25. data/data/nyse.yaml +63 -0
  26. data/data/nz.yaml +141 -0
  27. data/data/pt.yaml +85 -0
  28. data/data/se.yaml +91 -0
  29. data/data/united_nations.yaml +188 -0
  30. data/data/ups.yaml +56 -0
  31. data/data/us.yaml +81 -0
  32. data/data/za.yaml +78 -0
  33. data/holidays.gemspec +16 -0
  34. data/lib/holidays/MANIFEST +28 -0
  35. data/lib/holidays/au.rb +43 -0
  36. data/lib/holidays/ca.rb +69 -0
  37. data/lib/holidays/cz.rb +36 -0
  38. data/lib/holidays/de.rb +51 -0
  39. data/lib/holidays/dk.rb +48 -0
  40. data/lib/holidays/es.rb +53 -0
  41. data/lib/holidays/europe.rb +236 -0
  42. data/lib/holidays/fr.rb +37 -0
  43. data/lib/holidays/gb.rb +41 -0
  44. data/lib/holidays/ie.rb +33 -0
  45. data/lib/holidays/is.rb +62 -0
  46. data/lib/holidays/it.rb +36 -0
  47. data/lib/holidays/mx.rb +52 -0
  48. data/lib/holidays/nl.rb +37 -0
  49. data/lib/holidays/no.rb +40 -0
  50. data/lib/holidays/north_america.rb +108 -0
  51. data/lib/holidays/nyse.rb +33 -0
  52. data/lib/holidays/nz.rb +69 -0
  53. data/lib/holidays/pt.rb +38 -0
  54. data/lib/holidays/scandinavia.rb +115 -0
  55. data/lib/holidays/se.rb +53 -0
  56. data/lib/holidays/united_nations.rb +25 -0
  57. data/lib/holidays/ups.rb +32 -0
  58. data/lib/holidays/us.rb +49 -0
  59. data/lib/holidays/za.rb +36 -0
  60. data/lib/holidays.rb +408 -0
  61. data/rakefile.rb +103 -0
  62. data/test/defs/test_defs_au.rb +35 -0
  63. data/test/defs/test_defs_ca.rb +28 -0
  64. data/test/defs/test_defs_cz.rb +25 -0
  65. data/test/defs/test_defs_de.rb +48 -0
  66. data/test/defs/test_defs_dk.rb +29 -0
  67. data/test/defs/test_defs_es.rb +56 -0
  68. data/test/defs/test_defs_europe.rb +277 -0
  69. data/test/defs/test_defs_fr.rb +25 -0
  70. data/test/defs/test_defs_gb.rb +35 -0
  71. data/test/defs/test_defs_ie.rb +20 -0
  72. data/test/defs/test_defs_is.rb +32 -0
  73. data/test/defs/test_defs_it.rb +24 -0
  74. data/test/defs/test_defs_mx.rb +21 -0
  75. data/test/defs/test_defs_nl.rb +23 -0
  76. data/test/defs/test_defs_no.rb +28 -0
  77. data/test/defs/test_defs_north_america.rb +53 -0
  78. data/test/defs/test_defs_nyse.rb +21 -0
  79. data/test/defs/test_defs_nz.rb +21 -0
  80. data/test/defs/test_defs_pt.rb +31 -0
  81. data/test/defs/test_defs_scandinavia.rb +75 -0
  82. data/test/defs/test_defs_se.rb +32 -0
  83. data/test/defs/test_defs_ups.rb +20 -0
  84. data/test/defs/test_defs_us.rb +22 -0
  85. data/test/defs/test_defs_za.rb +24 -0
  86. data/test/test_date.rb +101 -0
  87. data/test/test_helper.rb +11 -0
  88. data/test/test_holidays.rb +117 -0
  89. data/test/test_multiple_regions.rb +20 -0
  90. metadata +172 -0
data/data/nz.yaml ADDED
@@ -0,0 +1,141 @@
1
+ # New Zealand holiday definitions for the Ruby Holiday gem.
2
+ # Updated: 2010-03-28.
3
+ # Sources:
4
+ # - http://en.wikipedia.org/wiki/Public_holidays_in_New_Zealand
5
+ ---
6
+ months:
7
+ 0:
8
+ - name: Good Friday
9
+ regions: [nz]
10
+ function: easter(year)-2
11
+ - name: Easter Saturday
12
+ regions: [nz]
13
+ function: easter(year)-1
14
+ - name: Easter Monday
15
+ regions: [nz]
16
+ function: easter(year)+1
17
+ 1:
18
+ - name: New Year's Day
19
+ regions: [nz]
20
+ mday: 1
21
+ observed: to_monday_if_weekend
22
+ - name: Day after New Year's Day
23
+ regions: [nz]
24
+ mday: 2
25
+ observed: to_weekday_if_boxing_weekend
26
+ - name: Southland Anniversary Day
27
+ regions: [nz_sl]
28
+ mday: 17
29
+ - name: Wellington Anniversary Day
30
+ regions: [nz_we]
31
+ mday: 22
32
+ observed: closest_monday
33
+ - name: Auckland Anniversary Day
34
+ regions: [nz_ak]
35
+ mday: 29
36
+ observed: closest_monday
37
+ - name: Northland Anniversary Day
38
+ regions: [nz_nl]
39
+ mday: 29
40
+ observed: closest_monday
41
+ 2:
42
+ - name: Nelson Anniversary Day
43
+ regions: [nz_ak]
44
+ mday: 1
45
+ observed: closest_monday
46
+ - name: Waitangi Day
47
+ regions: [nz]
48
+ mday: 6
49
+ 3:
50
+ - name: Otago Anniversary Day
51
+ regions: [nz_ot]
52
+ mday: 23
53
+ observed: closest_monday
54
+ - name: Taranaki Anniversary Day
55
+ regions: [nz_ak]
56
+ week: 2
57
+ wday: 1
58
+ 4:
59
+ - name: ANZAC Day
60
+ regions: [nz]
61
+ mday: 25
62
+ 6:
63
+ - name: Queen's Birthday
64
+ regions: [nz]
65
+ week: 1
66
+ wday: 1
67
+ 9:
68
+ - name: Dominion Day
69
+ regions: [nz_sc]
70
+ week: 4
71
+ wday: 1
72
+ 10:
73
+ - name: Hawke's bay Anniversary Day
74
+ regions: [nz_hb]
75
+ week: 1
76
+ wday: 1
77
+ observed: previous_friday
78
+ - name: Labour Day
79
+ regions: [nz]
80
+ week: 4
81
+ wday: 1
82
+ - name: Marlborough Anniversary Day
83
+ regions: [nz_mb]
84
+ week: 4
85
+ wday: 1
86
+ observed: next_week
87
+ 11:
88
+ - name: Canterbury Anniversary Day
89
+ regions: [nz_ca]
90
+ week: 2
91
+ wday: 5
92
+ - name: Chatham Island Anniversary Day
93
+ regions: [nz_ch]
94
+ mday: 30
95
+ observed: closest_monday
96
+ 12:
97
+ - name: Westland Anniversary Day
98
+ regions: [nz_wl]
99
+ mday: 1
100
+ observed: closest_monday
101
+ - name: Christmas Day
102
+ regions: [nz]
103
+ mday: 25
104
+ observed: to_monday_if_weekend
105
+ - name: Boxing Day
106
+ regions: [nz]
107
+ mday: 26
108
+ observed: to_weekday_if_boxing_weekend
109
+ tests: |
110
+ {Date.civil(2007,1,1) => 'New Year\'s Day',
111
+ Date.civil(2007,1,2) => 'Day after New Year\'s Day',
112
+ Date.civil(2007,2,6) => 'Waitangi Day',
113
+ Date.civil(2007,4,6) => 'Good Friday',
114
+ Date.civil(2007,4,9) => 'Easter Monday',
115
+ Date.civil(2007,4,25) => 'ANZAC Day',
116
+ Date.civil(2007,12,25) => 'Christmas Day',
117
+ Date.civil(2007,12,26) => 'Boxing Day'}.each do |date, name|
118
+ assert_equal name, (Holidays.on(date, :nz, :informal)[0] || {})[:name]
119
+ end
120
+ methods:
121
+ closest_monday: |
122
+ def self.closest_monday(date)
123
+ if [1, 2, 3, 4].include?(date.wday)
124
+ date -= (date.wday - 1)
125
+ elsif 0 == date.wday
126
+ date += 1
127
+ else
128
+ date += 8 - date.wday
129
+ end
130
+ date
131
+ end
132
+
133
+ previous_friday: |
134
+ def self.previous_friday(date)
135
+ date - 3
136
+ end
137
+
138
+ next_week: |
139
+ def self.next_week(date)
140
+ date + 7
141
+ end
data/data/pt.yaml ADDED
@@ -0,0 +1,85 @@
1
+ # Portugese holiday definitions for the Ruby Holiday gem.
2
+ #
3
+ # Updated: 2008-11-28.
4
+ # Sources:
5
+ # - http://en.wikipedia.org/wiki/Holidays_in_Portugal
6
+ # - http://www.kidlink.org/KIDPROJ/MCC/mcc0006.html
7
+ # - http://www.worldtravelguide.net/country/227/public_holidays/Europe/Portugal.html
8
+ # - http://en.wikipedia.org/wiki/Portugal_Day
9
+ # - http://www.timeanddate.com/calendar/custom.html?year=2008&country=15
10
+ ---
11
+ months:
12
+ 0:
13
+ - name: Carnaval # same as Shrove Tuesday
14
+ regions: [pt]
15
+ function: easter(year)-47
16
+ type: informal
17
+ - name: Sexta-feira Santa
18
+ regions: [pt]
19
+ function: easter(year)-2
20
+ - name: Páscoa
21
+ regions: [pt]
22
+ function: easter(year)
23
+ - name: Corpo de Deus
24
+ regions: [pt]
25
+ function: easter(year)+60
26
+ 1:
27
+ - name: Ano Novo
28
+ regions: [pt]
29
+ mday: 1
30
+ 4:
31
+ - name: Dia da Liberdade
32
+ regions: [pt]
33
+ mday: 25
34
+ 5:
35
+ - name: Dia do Trabalhador
36
+ regions: [pt]
37
+ mday: 1
38
+ 6:
39
+ - name: Dia de Portugal
40
+ regions: [pt]
41
+ mday: 10
42
+ 8:
43
+ - name: Assunção de Nossa Senhora
44
+ regions: [pt]
45
+ mday: 15
46
+ 10:
47
+ - name: Implantação da República
48
+ regions: [pt]
49
+ mday: 5
50
+ 11:
51
+ - name: Todos os Santos
52
+ regions: [pt]
53
+ mday: 1
54
+ 12:
55
+ - name: Restauração da Independência
56
+ regions: [pt]
57
+ mday: 1
58
+ - name: Imaculada Conceição
59
+ regions: [pt]
60
+ mday: 8
61
+ - name: Natal
62
+ regions: [pt]
63
+ mday: 25
64
+ tests: |
65
+ {Date.civil(2008,1,1) => 'Ano Novo',
66
+ Date.civil(2005,2,8) => 'Carnaval',
67
+ Date.civil(2006,2,28) => 'Carnaval',
68
+ Date.civil(2007,2,20) => 'Carnaval',
69
+ Date.civil(2008,2,5) => 'Carnaval',
70
+ Date.civil(2008,3,21) => 'Sexta-feira Santa',
71
+ Date.civil(2008,3,23) => 'Páscoa',
72
+ Date.civil(2008,4,25) => 'Dia da Liberdade',
73
+ Date.civil(2008,5,1) => 'Dia do Trabalhador',
74
+ Date.civil(2005,5,26) => 'Corpo de Deus',
75
+ Date.civil(2007,6,7) => 'Corpo de Deus',
76
+ Date.civil(2008,5,22) => 'Corpo de Deus',
77
+ Date.civil(2008,6,10) => 'Dia de Portugal',
78
+ Date.civil(2008,8,15) => 'Assunção de Nossa Senhora',
79
+ Date.civil(2008,10,5) => 'Implantação da República',
80
+ Date.civil(2008,11,1) => 'Todos os Santos',
81
+ Date.civil(2008,12,1) => 'Restauração da Independência',
82
+ Date.civil(2008,12,8) => 'Imaculada Conceição',
83
+ Date.civil(2008,12,25) => 'Natal'}.each do |date, name|
84
+ assert_equal name, (Holidays.on(date, :pt, :informal)[0] || {})[:name]
85
+ end
data/data/se.yaml ADDED
@@ -0,0 +1,91 @@
1
+ # Swedish holiday definitions for the Ruby Holiday gem.
2
+ #
3
+ # Updated: 2008-11-28.
4
+ # Sources:
5
+ # - http://en.wikipedia.org/wiki/Holidays_in_Sweden
6
+ # - http://www.worldtravelguide.net/country/269/public_holidays/Europe/Sweden.html
7
+ # - http://hem.passagen.se/farila/midsum.htm
8
+ # - http://www.timeanddate.com/calendar/?country=21
9
+ ---
10
+ months:
11
+ 0:
12
+ - name: Långfredagen
13
+ regions: [se]
14
+ function: easter(year)-2
15
+ - name: Påskdagen
16
+ regions: [se]
17
+ function: easter(year)
18
+ - name: Annandag påsk
19
+ regions: [se]
20
+ function: easter(year)+1
21
+ - name: Kristi himmelsfärdsdag # Ascension Day
22
+ regions: [se]
23
+ function: easter(year)+39
24
+ - name: Pingstdagen # Whitsunday
25
+ regions: [se]
26
+ function: easter(year)+49
27
+ - name: Alla helgons dag # All Saint's Day
28
+ regions: [se]
29
+ function: se_alla_helgons_dag(year)
30
+ 1:
31
+ - name: Nyårsdagen
32
+ regions: [se]
33
+ mday: 1
34
+ - name: Trettondedag jul
35
+ regions: [se]
36
+ mday: 6
37
+ 5:
38
+ - name: Första maj
39
+ regions: [se]
40
+ mday: 1
41
+ 6:
42
+ - name: Nationaldagen
43
+ regions: [se]
44
+ mday: 6
45
+ - name: Midsommardagen
46
+ regions: [se]
47
+ function: se_midsommardagen(year)
48
+ 12:
49
+ - name: Juldagen
50
+ regions: [se]
51
+ mday: 25
52
+ - name: Annandag jul
53
+ regions: [se]
54
+ mday: 26
55
+ methods:
56
+ se_midsommardagen: |
57
+ # Sweden: Mid-summer (Saturday between June 20–26)
58
+ def self.se_midsommardagen(year)
59
+ date = Date.civil(year,6,20)
60
+ date += (6 - date.wday)
61
+ date
62
+ end
63
+ se_alla_helgons_dag: |
64
+ # Sweden: All Saint's Day (Saturday between Oct 31 and Nov 6)
65
+ def self.se_alla_helgons_dag(year)
66
+ date = Date.civil(year,10,31)
67
+ date += (6 - date.wday)
68
+ date
69
+ end
70
+ tests: |
71
+ {Date.civil(2008,1,1) => 'Nyårsdagen',
72
+ Date.civil(2008,1,6) => 'Trettondedag jul',
73
+ Date.civil(2008,3,21) => 'Långfredagen',
74
+ Date.civil(2008,3,23) => 'Påskdagen',
75
+ Date.civil(2008,3,24) => 'Annandag påsk',
76
+ Date.civil(2008,5,1) => 'Första maj',
77
+ Date.civil(2008,5,1) => 'Kristi himmelsfärdsdag',
78
+ Date.civil(2008,5,11) => 'Pingstdagen',
79
+ Date.civil(2008,6,6) => 'Nationaldagen',
80
+ Date.civil(2005,6,25) => 'Midsommardagen',
81
+ Date.civil(2006,6,24) => 'Midsommardagen',
82
+ Date.civil(2007,6,23) => 'Midsommardagen',
83
+ Date.civil(2008,6,21) => 'Midsommardagen',
84
+ Date.civil(2005,11,5) => 'Alla helgons dag',
85
+ Date.civil(2006,11,4) => 'Alla helgons dag',
86
+ Date.civil(2007,11,3) => 'Alla helgons dag',
87
+ Date.civil(2008,11,1) => 'Alla helgons dag',
88
+ Date.civil(2008,12,25) => 'Juldagen',
89
+ Date.civil(2008,12,26) => 'Annandag jul'}.each do |date, name|
90
+ assert_equal name, (Holidays.on(date, :se, :informal)[0] || {})[:name]
91
+ end
@@ -0,0 +1,188 @@
1
+ # United Nationas holiday definitions for the Ruby Holiday gem.
2
+ # Updated 2008-11-21.
3
+ ---
4
+ 2:
5
+ - name: International Mother Language Day
6
+ regions: [un]
7
+ mday: 2
8
+ 3:
9
+ - name: United Nations Day for Women's Rights and International Peace
10
+ regions: [un]
11
+ mday: 8
12
+ - name: International Day for the Elimination of Racial Discrimination
13
+ regions: [un]
14
+ mday: 21
15
+ - name: Beginning of the Week of Solidarity with the Peoples Struggling against Racism and Racial Discrimination
16
+ regions: [un]
17
+ mday: 21
18
+ - name: World Day for Water
19
+ regions: [un]
20
+ mday: 22
21
+ - name: World Meteorological Day
22
+ regions: [un]
23
+ mday: 23
24
+ 4:
25
+ - name: World Health Day
26
+ regions: [un]
27
+ mday: 7
28
+ - name: World Book and Copyright Day
29
+ regions: [un]
30
+ mday: 23
31
+ 5:
32
+ - name: World Press Freedom Day
33
+ regions: [un]
34
+ mday: 3
35
+ - name: International Day of Families
36
+ regions: [un]
37
+ mday: 15
38
+ - name: World Telecommunication Day
39
+ regions: [un]
40
+ mday: 17
41
+ - name: World Day for Cultural Diversity for Dialogue and Development
42
+ regions: [un]
43
+ mday: 21
44
+ - name: International Day for Biological Diversity
45
+ regions: [un]
46
+ mday: 22
47
+ - name: Beginning of the Week of Solidarity with the Peoples of Non-Self-Governing Territories
48
+ regions: [un]
49
+ mday: 25
50
+ - name: International Day of United Nations Peacekeepers
51
+ regions: [un]
52
+ mday: 29
53
+ - name: World No-Tobacco Day
54
+ regions: [un]
55
+ mday: 31
56
+ 6:
57
+ - name: International Day of Innocent Children Victims of Aggression
58
+ regions: [un]
59
+ mday: 4
60
+ - name: World Environment Day
61
+ regions: [un]
62
+ mday: 5
63
+ - name: World Day to Combat Desertification and Drought
64
+ regions: [un]
65
+ mday: 17
66
+ - name: World Refugee Day
67
+ regions: [un]
68
+ mday: 20
69
+ - name: United Nations Public Service Day
70
+ regions: [un]
71
+ mday: 23
72
+ - name: International Day against Drug Abuse and Illicit Trafficking
73
+ regions: [un]
74
+ mday: 26
75
+ - name: International Day in Support of Victims of Torture
76
+ regions: [un]
77
+ mday: 26
78
+ 7:
79
+ - name: International Day of Cooperatives
80
+ week: 1
81
+ regions: [un]
82
+ wday: 6
83
+ - name: World Population Day
84
+ regions: [un]
85
+ mday: 11
86
+ 8:
87
+ - name: International Day of the World's Indigenous People
88
+ regions: [un]
89
+ mday: 9
90
+ - name: International Youth Day
91
+ regions: [un]
92
+ mday: 12
93
+ - name: International Day for the Remembrance of the Slave Trade and Its Abolition
94
+ regions: [un]
95
+ mday: 23
96
+ 9:
97
+ - name: International Literacy Day
98
+ regions: [un]
99
+ mday: 8
100
+ - name: International Day for the Preservation of the Ozone Layer
101
+ regions: [un]
102
+ mday: 16
103
+ - name: International Day of Peace
104
+ regions: [un]
105
+ mday: 21
106
+ - name: International Day of Older Persons
107
+ regions: [un]
108
+ mday: 1
109
+ 10:
110
+ - name: World Space Week
111
+ regions: [un]
112
+ mday: 4
113
+ - name: World Teachers' Day
114
+ regions: [un]
115
+ mday: 5
116
+ - name: World Habitat Day
117
+ week: 1
118
+ regions: [un]
119
+ wday: 1
120
+ - name: International Day for Natural Disaster Reduction
121
+ week: 2
122
+ regions: [un]
123
+ wday: 3
124
+ - name: World Post Day
125
+ regions: [un]
126
+ mday: 9
127
+ - name: World Mental Health Day
128
+ regions: [un]
129
+ mday: 10
130
+ - name: World Food Day
131
+ regions: [un]
132
+ mday: 16
133
+ - name: International Day for the Eradication of Poverty
134
+ regions: [un]
135
+ mday: 17
136
+ - name: United Nations Day
137
+ regions: [un]
138
+ mday: 24
139
+ - name: World Development Information Day
140
+ regions: [un]
141
+ mday: 24
142
+ - name: Disarmament Week
143
+ regions: [un]
144
+ mday: 24
145
+ 11:
146
+ - name: International Day for Preventing the Exploitation of the Environment in War and Armed Conflict
147
+ regions: [un]
148
+ mday: 6
149
+ - name: International Day for Tolerance
150
+ regions: [un]
151
+ mday: 16
152
+ - name: Africa Industrialization Day
153
+ regions: [un]
154
+ mday: 20
155
+ - name: Universal Children's Day
156
+ regions: [un]
157
+ mday: 20
158
+ - name: World Television Day
159
+ regions: [un]
160
+ mday: 21
161
+ - name: International Day for the Elimination of Violence against Women
162
+ regions: [un]
163
+ mday: 25
164
+ - name: International Day of Solidarity with the Palestinian People
165
+ regions: [un]
166
+ mday: 29
167
+ 12:
168
+ - name: World AIDS Day
169
+ regions: [un]
170
+ mday: 1
171
+ - name: International Day for the Abolition of Slavery
172
+ regions: [un]
173
+ mday: 2
174
+ - name: International Day of Disabled Persons
175
+ regions: [un]
176
+ mday: 3
177
+ - name: International Volunteer Day for Economic and Social Development
178
+ regions: [un]
179
+ mday: 5
180
+ - name: International Civil Aviation Day
181
+ regions: [un]
182
+ mday: 7
183
+ - name: Human Rights Day
184
+ regions: [un]
185
+ mday: 10
186
+ - name: International Migrants Day
187
+ regions: [un]
188
+ mday: 18
data/data/ups.yaml ADDED
@@ -0,0 +1,56 @@
1
+ # UPS holiday definitions for the Ruby Holiday gem.
2
+ #
3
+ # By Tim Anglade
4
+ #
5
+ # Updated: 2008-09-23.
6
+ # Source: http://www.ups.com/content/us/en/resources/ship/imp_exp/operation.html
7
+ ---
8
+ months:
9
+ 1:
10
+ - name: New Year's Day
11
+ regions: [ups]
12
+ mday: 1
13
+ observed: to_weekday_if_weekend
14
+ 5:
15
+ - name: Memorial Day
16
+ week: -1
17
+ regions: [ups]
18
+ wday: 1
19
+ 7:
20
+ - name: Independence Day
21
+ regions: [ups]
22
+ mday: 4
23
+ observed: to_weekday_if_weekend
24
+ 9:
25
+ - name: Labor Day
26
+ week: 1
27
+ regions: [ups]
28
+ wday: 1
29
+ 11:
30
+ - name: Thanksgiving
31
+ week: 4
32
+ regions: [ups]
33
+ wday: 4
34
+ - name: Day After Thanksgiving
35
+ week: 4
36
+ regions: [ups]
37
+ wday: 5
38
+ 12:
39
+ - name: Christmas Day
40
+ regions: [ups]
41
+ mday: 25
42
+ observed: to_weekday_if_weekend
43
+ - name: New Year's Eve
44
+ regions: [ups]
45
+ mday: 31
46
+ tests: |
47
+ {Date.civil(2008,1,1) => 'New Year\'s Day',
48
+ Date.civil(2008,5,26) => 'Memorial Day',
49
+ Date.civil(2008,7,4) => 'Independence Day',
50
+ Date.civil(2008,9,1) => 'Labor Day',
51
+ Date.civil(2008,11,27) => 'Thanksgiving',
52
+ Date.civil(2008,11,28) => 'Day After Thanksgiving',
53
+ Date.civil(2008,12,25) => 'Christmas Day',
54
+ Date.civil(2008,12,31) => 'New Year\'s Eve',}.each do |date, name|
55
+ assert_equal name, (Holidays.on(date, :ups)[0] || {})[:name]
56
+ end
data/data/us.yaml ADDED
@@ -0,0 +1,81 @@
1
+ # United States holiday definitions for the Ruby Holiday gem.
2
+ #
3
+ # Updated: 2008-11-24.
4
+ # Source: http://en.wikipedia.org/wiki/Public_holidays_of_the_United_States
5
+ ---
6
+ months:
7
+ 0:
8
+ - name: Good Friday
9
+ regions: [us]
10
+ function: easter(year)-2
11
+ type: informal
12
+ 1:
13
+ - name: New Year's Day
14
+ regions: [us]
15
+ mday: 1
16
+ observed: to_weekday_if_weekend
17
+ - name: Martin Luther King, Jr. Day
18
+ week: 3
19
+ regions: [us]
20
+ wday: 1
21
+ - name: Inauguration Day
22
+ function: us_inauguration_day(year)
23
+ regions: [us_dc]
24
+ 2:
25
+ - name: Presidents' Day
26
+ week: 3
27
+ regions: [us]
28
+ wday: 1
29
+ 5:
30
+ - name: Memorial Day
31
+ week: -1
32
+ regions: [us]
33
+ wday: 1
34
+ 7:
35
+ - name: Independence Day
36
+ regions: [us]
37
+ mday: 4
38
+ observed: to_weekday_if_weekend
39
+ 9:
40
+ - name: Labor Day
41
+ week: 1
42
+ regions: [us]
43
+ wday: 1
44
+ 10:
45
+ - name: Columbus Day
46
+ week: 2
47
+ regions: [us]
48
+ wday: 1
49
+ 11:
50
+ - name: Veterans Day
51
+ regions: [us]
52
+ mday: 11
53
+ observed: to_weekday_if_weekend
54
+ - name: Thanksgiving
55
+ week: 4
56
+ regions: [us]
57
+ wday: 4
58
+ 12:
59
+ - name: Christmas Day
60
+ regions: [us]
61
+ mday: 25
62
+ observed: to_weekday_if_weekend
63
+ methods:
64
+ us_inauguration_day: |
65
+ # January 20, every fourth year, following Presidential election
66
+ def self.us_inauguration_day(year)
67
+ year % 4 == 1 ? 20 : nil
68
+ end
69
+ tests: |
70
+ {Date.civil(2008,1,1) => 'New Year\'s Day',
71
+ Date.civil(2008,1,21) => 'Martin Luther King, Jr. Day',
72
+ Date.civil(2008,2,18) => 'Presidents\' Day',
73
+ Date.civil(2008,5,26) => 'Memorial Day',
74
+ Date.civil(2008,7,4) => 'Independence Day',
75
+ Date.civil(2008,9,1) => 'Labor Day',
76
+ Date.civil(2008,10,13) => 'Columbus Day',
77
+ Date.civil(2008,11,11) => 'Veterans Day',
78
+ Date.civil(2008,11,27) => 'Thanksgiving',
79
+ Date.civil(2008,12,25) => 'Christmas Day'}.each do |date, name|
80
+ assert_equal name, (Holidays.on(date, :us)[0] || {})[:name]
81
+ end
data/data/za.yaml ADDED
@@ -0,0 +1,78 @@
1
+ # South African holiday definitions for the Ruby Holiday gem.
2
+ #
3
+ # Updated: 2008-11-29.
4
+ # Sources:
5
+ # - http://en.wikipedia.org/wiki/Public_holidays_in_South_Africa
6
+ # - http://www.info.gov.za/aboutsa/holidays.htm
7
+ ---
8
+ months:
9
+ 0:
10
+ - name: Good Friday
11
+ regions: [za]
12
+ function: easter(year)-2
13
+ - name: Family Day
14
+ regions: [za]
15
+ function: easter(year)+1
16
+ 1:
17
+ - name: New Year's Day
18
+ regions: [za]
19
+ mday: 1
20
+ observed: to_monday_if_sunday
21
+ 3:
22
+ - name: Human Rights Day
23
+ regions: [za]
24
+ mday: 21
25
+ observed: to_monday_if_sunday
26
+ 4:
27
+ - name: Freedom Day
28
+ regions: [za]
29
+ mday: 27
30
+ observed: to_monday_if_sunday
31
+ 5:
32
+ - name: Workers Day
33
+ regions: [za]
34
+ mday: 1
35
+ observed: to_monday_if_sunday
36
+ 6:
37
+ - name: Youth Day
38
+ regions: [za]
39
+ mday: 16
40
+ observed: to_monday_if_sunday
41
+ 8:
42
+ - name: National Women's Day
43
+ regions: [za]
44
+ mday: 9
45
+ observed: to_monday_if_sunday
46
+ 9:
47
+ - name: Heritage Day
48
+ regions: [za]
49
+ mday: 24
50
+ observed: to_monday_if_sunday
51
+ 12:
52
+ - name: Day of Reconciliation
53
+ regions: [za]
54
+ mday: 16
55
+ observed: to_monday_if_sunday
56
+ - name: Christmas Day
57
+ regions: [za]
58
+ mday: 25
59
+ observed: to_monday_if_sunday
60
+ - name: Day of Goodwill
61
+ regions: [za]
62
+ mday: 26
63
+ observed: to_weekday_if_boxing_weekend
64
+ tests: |
65
+ {Date.civil(2007,1,1) => 'New Year\'s Day',
66
+ Date.civil(2007,3,21) => 'Human Rights Day',
67
+ Date.civil(2007,4,6) => 'Good Friday',
68
+ Date.civil(2007,4,9) => 'Family Day',
69
+ Date.civil(2007,4,27) => 'Freedom Day',
70
+ Date.civil(2007,5,1) => 'Workers Day',
71
+ Date.civil(2007,6,16) => 'Youth Day',
72
+ Date.civil(2007,8,9) => 'National Women\'s Day',
73
+ Date.civil(2007,9,24) => 'Heritage Day',
74
+ Date.civil(2007,12,16) => 'Day of Reconciliation',
75
+ Date.civil(2007,12,25) => 'Christmas Day',
76
+ Date.civil(2007,12,26) => 'Day of Goodwill'}.each do |date, name|
77
+ assert_equal name, (Holidays.on(date, :za, :informal)[0] || {})[:name]
78
+ end