holidays 4.7.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/.gitmodules +3 -0
  3. data/CHANGELOG.md +9 -0
  4. data/CONTRIBUTING.md +21 -11
  5. data/Makefile +9 -6
  6. data/holidays.gemspec +1 -1
  7. data/lib/generated_definitions/MANIFEST +1 -0
  8. data/lib/generated_definitions/REGIONS.rb +1 -1
  9. data/lib/generated_definitions/hk.rb +112 -0
  10. data/lib/generated_definitions/kr.rb +4 -4
  11. data/lib/holidays/errors.rb +1 -0
  12. data/lib/holidays/finder/context/parse_options.rb +8 -3
  13. data/lib/holidays/load_all_definitions.rb +0 -11
  14. data/lib/holidays/version.rb +1 -1
  15. data/test/defs/test_defs_hk.rb +38 -0
  16. data/test/defs/test_defs_jp.rb +1 -0
  17. data/test/defs/test_defs_kr.rb +1 -1
  18. data/test/holidays/definition/validator/test_region.rb +4 -0
  19. data/test/holidays/finder/context/test_parse_options.rb +9 -1
  20. data/test/integration/test_all_regions.rb +4 -4
  21. data/test/integration/test_custom_holidays.rb +4 -4
  22. data/test/integration/test_holidays.rb +6 -6
  23. metadata +6 -60
  24. data/definitions/README.md +0 -353
  25. data/definitions/ar.yaml +0 -93
  26. data/definitions/at.yaml +0 -72
  27. data/definitions/au.yaml +0 -378
  28. data/definitions/be_fr.yaml +0 -69
  29. data/definitions/be_nl.yaml +0 -69
  30. data/definitions/bg.yaml +0 -127
  31. data/definitions/br.yaml +0 -77
  32. data/definitions/ca.yaml +0 -317
  33. data/definitions/ch.yaml +0 -193
  34. data/definitions/cl.yaml +0 -94
  35. data/definitions/cr.yaml +0 -65
  36. data/definitions/cz.yaml +0 -73
  37. data/definitions/de.yaml +0 -209
  38. data/definitions/dk.yaml +0 -130
  39. data/definitions/ecb_target.yaml +0 -44
  40. data/definitions/el.yaml +0 -84
  41. data/definitions/es.yaml +0 -203
  42. data/definitions/federal_reserve.yaml +0 -114
  43. data/definitions/fedex.yaml +0 -62
  44. data/definitions/fi.yaml +0 -115
  45. data/definitions/fr.yaml +0 -79
  46. data/definitions/gb.yaml +0 -151
  47. data/definitions/hr.yaml +0 -79
  48. data/definitions/hu.yaml +0 -63
  49. data/definitions/ie.yaml +0 -89
  50. data/definitions/index.yaml +0 -61
  51. data/definitions/is.yaml +0 -146
  52. data/definitions/it.yaml +0 -67
  53. data/definitions/jp.yaml +0 -321
  54. data/definitions/kr.yaml +0 -282
  55. data/definitions/li.yaml +0 -107
  56. data/definitions/lt.yaml +0 -89
  57. data/definitions/lu.yaml +0 -56
  58. data/definitions/ma.yaml +0 -52
  59. data/definitions/mx.yaml +0 -106
  60. data/definitions/my.yaml +0 -51
  61. data/definitions/nerc.yaml +0 -51
  62. data/definitions/nl.yaml +0 -73
  63. data/definitions/no.yaml +0 -90
  64. data/definitions/north_america_informal.yaml +0 -61
  65. data/definitions/nyse.yaml +0 -64
  66. data/definitions/nz.yaml +0 -163
  67. data/definitions/pe.yaml +0 -119
  68. data/definitions/ph.yaml +0 -94
  69. data/definitions/pl.yaml +0 -320
  70. data/definitions/pt.yaml +0 -89
  71. data/definitions/ro.yaml +0 -78
  72. data/definitions/se.yaml +0 -120
  73. data/definitions/sg.yaml +0 -56
  74. data/definitions/si.yaml +0 -86
  75. data/definitions/sk.yaml +0 -80
  76. data/definitions/united_nations.yaml +0 -189
  77. data/definitions/ups.yaml +0 -62
  78. data/definitions/us.yaml +0 -103
  79. data/definitions/ve.yaml +0 -74
  80. data/definitions/vi.yaml +0 -29
  81. data/definitions/za.yaml +0 -80
@@ -1,130 +0,0 @@
1
- # Danish holiday definitions for the Ruby Holiday gem.
2
- #
3
- # Updated: 2008-11-22.
4
- # Sources:
5
- # - http://en.wikipedia.org/wiki/Holidays_in_Denmark
6
- # - http://www.amblondon.um.dk/en/menu/AboutDenmark/PublicHolidaysInDK/PublicHolidaysinDenmark-until2010.htm
7
- # - http://borger.dk/forside/kirke-og-tro/folkekirken/officielle-helligdage
8
- ---
9
- months:
10
- 0:
11
- - name: Fastelavn
12
- regions: [dk]
13
- function: easter(year)
14
- function_modifier: -49
15
- type: informal
16
- - name: Palmesøndag
17
- regions: [dk]
18
- function: easter(year)
19
- function_modifier: -7
20
- type: informal
21
- - name: Skærtorsdag
22
- regions: [dk]
23
- function: easter(year)
24
- function_modifier: -3
25
- - name: Langfredag
26
- regions: [dk]
27
- function: easter(year)
28
- function_modifier: -2
29
- - name: Påskedag
30
- regions: [dk]
31
- function: easter(year)
32
- - name: 2. påskedag
33
- regions: [dk]
34
- function: easter(year)
35
- function_modifier: 1
36
- - name: Store Bededag
37
- regions: [dk]
38
- function: easter(year)
39
- function_modifier: 26
40
- - name: Kristi Himmelfartsdag
41
- regions: [dk]
42
- function: easter(year)
43
- function_modifier: 39
44
- - name: Pinsedag
45
- regions: [dk]
46
- function: easter(year)
47
- function_modifier: 49
48
- - name: 2. Pinsedag
49
- regions: [dk]
50
- function: easter(year)
51
- function_modifier: 50
52
- 1:
53
- - name: Nytårsdag
54
- regions: [dk]
55
- mday: 1
56
- 4:
57
- - name: 1. april
58
- regions: [dk]
59
- mday: 1
60
- type: informal
61
- - name: Danmarks besættelse
62
- regions: [dk]
63
- mday: 9
64
- type: informal
65
- - name: Dronningens fødselsdag
66
- regions: [dk]
67
- mday: 16
68
- type: informal
69
- 5:
70
- - name: Arbejdernes kampdag
71
- regions: [dk]
72
- mday: 1
73
- type: informal
74
- - name: Danmarks befrielse
75
- regions: [dk]
76
- mday: 5
77
- type: informal
78
- 6:
79
- - name: Grundlovsdag
80
- regions: [dk]
81
- mday: 5
82
- type: informal
83
- - name: Valdemarsdag og Genforeningsdag
84
- regions: [dk]
85
- mday: 15
86
- type: informal
87
- - name: Sankt Hans aften
88
- regions: [dk]
89
- mday: 23
90
- type: informal
91
- 11:
92
- - name: Mortensaften
93
- regions: [dk]
94
- mday: 10
95
- type: informal
96
- 12:
97
- - name: Sankt Lucia
98
- regions: [dk]
99
- mday: 13
100
- type: informal
101
- - name: Juleaftensdag
102
- regions: [dk]
103
- mday: 24
104
- type: informal
105
- - name: 1. juledag
106
- regions: [dk]
107
- mday: 25
108
- - name: 2. juledag
109
- regions: [dk]
110
- mday: 26
111
- tests: |
112
- {Date.civil(2007,1,1) => 'Nytårsdag',
113
- Date.civil(2007,2,18) => 'Fastelavn',
114
- Date.civil(2007,4,9) => 'Danmarks besættelse',
115
- Date.civil(2007,4,16) => 'Dronningens fødselsdag',
116
- Date.civil(2007,4,5) => 'Skærtorsdag',
117
- Date.civil(2007,4,6) => 'Langfredag',
118
- Date.civil(2007,4,8) => 'Påskedag',
119
- Date.civil(2007,4,9) => '2. påskedag',
120
- Date.civil(2007,5,1) => 'Arbejdernes kampdag',
121
- Date.civil(2007,5,4) => 'Store Bededag',
122
- Date.civil(2007,5,17) => 'Kristi Himmelfartsdag',
123
- Date.civil(2007,5,27) => 'Pinsedag',
124
- Date.civil(2007,5,28) => '2. Pinsedag',
125
- Date.civil(2007,6,5) => 'Grundlovsdag',
126
- Date.civil(2007,12,24) => 'Juleaftensdag',
127
- Date.civil(2007,12,25) => '1. juledag',
128
- Date.civil(2007,12,26) => '2. juledag'}.each do |date, name|
129
- assert_equal name, (Holidays.on(date, :dk, :informal)[0] || {})[:name]
130
- end
@@ -1,44 +0,0 @@
1
- # ECB TARGET Closing Days
2
- #
3
- # Updated: 2014-01-04.
4
- # Sources:
5
- # - http://www.ecb.europa.eu/home/html/holidays.en.html
6
- # - http://www.ecb.europa.eu/press/pr/date/2000/html/pr001214_4.en.html
7
- ---
8
- months:
9
- 0:
10
- - name: Good Friday
11
- regions: [ecb_target]
12
- function: easter(year)
13
- function_modifier: -2
14
- - name: Easter Monday
15
- regions: [ecb_target]
16
- function: easter(year)
17
- function_modifier: 1
18
- 1:
19
- - name: New Year's Day
20
- regions: [ecb_target]
21
- mday: 1
22
- 5:
23
- - name: Labour Day
24
- regions: [ecb_target]
25
- mday: 1
26
- 12:
27
- - name: Christmas Day
28
- regions: [ecb_target]
29
- mday: 25
30
- - name: Christmas Holiday
31
- regions: [ecb_target]
32
- mday: 26
33
- tests: |
34
- {Date.civil(2013,1,1) => 'New Year\'s Day',
35
- Date.civil(2013,5,1) => 'Labour Day',
36
- Date.civil(2013,3,29) => 'Good Friday',
37
- Date.civil(2013,4,1) => 'Easter Monday',
38
- Date.civil(2013,12,25) => 'Christmas Day',
39
- Date.civil(2013,12,26) => 'Christmas Holiday'}.each do |date, name|
40
- assert_equal name, (Holidays.on(date, :ecb_target)[0] || {})[:name]
41
- end
42
-
43
- assert_equal 'Good Friday', Holidays.on(Date.civil(2013,3,29), :ecb_target)[0][:name]
44
- assert_equal 'Easter Monday', Holidays.on(Date.civil(2013,4,1), :ecb_target)[0][:name]
@@ -1,84 +0,0 @@
1
- # Greek holiday definitions for the Ruby Holiday gem.
2
- #
3
- # Created: 2011-05-11.
4
- # Sources:
5
- # http://www.assa.org.au/edm.html
6
- # http://fotios.org/node/1104
7
- # http://www.faqs.org/faqs/calendars/faq/
8
- # http://5dspace-time.org/Calendar/Algorithm.html - for offsets
9
- # http://el.wikipedia.org/wiki/Επίσημες_αργίες_στην_Ελλάδα - for holidays
10
- # http://www.eortologio.gr/arthra/pasxa.php - for holidays
11
- ---
12
- months:
13
- 0:
14
- - name: Μεγάλη Παρασκευή
15
- regions: [el]
16
- function: orthodox_easter(year)
17
- function_modifier: -2
18
- - name: Μεγάλο Σάββατο
19
- regions: [el]
20
- function: orthodox_easter(year)
21
- function_modifier: -1
22
- - name: Κυριακή του Πάσχα
23
- regions: [el]
24
- function: orthodox_easter(year)
25
- - name: Δευτέρα του Πάσχα
26
- regions: [el]
27
- function: orthodox_easter(year)
28
- function_modifier: 1
29
- - name: Καθαρά Δευτέρα
30
- regions: [el]
31
- function: orthodox_easter(year)
32
- function_modifier: -48
33
- - name: Αγίου Πνεύματος
34
- regions: [el]
35
- function: orthodox_easter(year)
36
- function_modifier: 50
37
- 1:
38
- - name: Πρωτοχρονιά
39
- regions: [el]
40
- mday: 1
41
- - name: Θεοφάνεια
42
- regions: [el]
43
- mday: 6
44
- 3:
45
- - name: Επέτειος της Επανάστασης του 1821
46
- regions: [el]
47
- mday: 25
48
- 5:
49
- - name: Πρωτομαγιά
50
- regions: [el]
51
- mday: 1
52
- 8:
53
- - name: Κοίμηση της Θεοτόκου
54
- regions: [el]
55
- mday: 15
56
- 10:
57
- - name: Επέτειος του Όχι
58
- regions: [el]
59
- mday: 28
60
- 12:
61
- - name: Χριστούγεννα
62
- regions: [el]
63
- mday: 25
64
- - name: Δεύτερη ημέρα των Χριστουγέννων
65
- regions: [el]
66
- mday: 26
67
- tests: |
68
- {Date.civil(2011,1,1) => 'Πρωτοχρονιά',
69
- Date.civil(2011,1,6) => 'Θεοφάνεια',
70
- Date.civil(2011,4,22) => 'Μεγάλη Παρασκευή',
71
- Date.civil(1970,4,25) => 'Μεγάλο Σάββατο',
72
- Date.civil(1985,4,14) => 'Κυριακή του Πάσχα',
73
- Date.civil(2011,4,24) => 'Κυριακή του Πάσχα',
74
- Date.civil(2027,5,2) => 'Κυριακή του Πάσχα',
75
- Date.civil(2046,4,30) => 'Δευτέρα του Πάσχα',
76
- Date.civil(2011,5,1) => 'Πρωτομαγιά',
77
- Date.civil(2011,6,13) => 'Αγίου Πνεύματος',
78
- Date.civil(2012,6,4) => 'Αγίου Πνεύματος',
79
- Date.civil(2011,3,7) => 'Καθαρά Δευτέρα',
80
- Date.civil(2012,2,27) => 'Καθαρά Δευτέρα',
81
- Date.civil(2011,12,25) => 'Χριστούγεννα',
82
- Date.civil(2011,12,26) => 'Δεύτερη ημέρα των Χριστουγέννων'}.each do |date, name|
83
- assert_equal name, (Holidays.on(date, :el, :informal)[0] || {})[:name]
84
- end
@@ -1,203 +0,0 @@
1
- # Spanish holiday definitions for the Ruby Holiday gem.
2
- #
3
- # Including the Balearic Islands and the Canary Islands.
4
- #
5
- # Updated: 2008-11-29.
6
- #
7
- # Sources:
8
- # - http://en.wikipedia.org/wiki/Public_holidays_in_Spain
9
- # - http://www.timeanddate.com/calendar/index.html?country=16
10
- #
11
- # Notes:
12
- # - Valencia is encoded as both es_v and es_vc
13
- months:
14
- 0:
15
- - name: Jueves Santo
16
- regions: [es_pv, es_na, es_an, es_ib, es_cm, es_mu, es_m, es_ar, es_cl, es_cn, es_lo, es_ga, es_ce, es_o, es_ex]
17
- function: easter(year)
18
- function_modifier: -3
19
- - name: Viernes Santo
20
- regions: [es]
21
- function: easter(year)
22
- function_modifier: -2
23
- - name: Lunes de Pascua
24
- regions: [es_pv, es_ct, es_na, es_v, es_vc]
25
- function: easter(year)
26
- function_modifier: 1
27
- 1:
28
- - name: Año Nuevo
29
- regions: [es]
30
- mday: 1
31
- observed: to_monday_if_sunday(date)
32
- - name: Día de Reyes
33
- regions: [es]
34
- mday: 6
35
- observed: to_monday_if_sunday(date)
36
- 2:
37
- - name: Día de Andalucía
38
- regions: [es_an]
39
- mday: 28
40
- observed: to_monday_if_sunday(date)
41
- 3:
42
- - name: Día de las Islas Baleares
43
- regions: [es_ib]
44
- mday: 1
45
- observed: to_monday_if_sunday(date)
46
- - name: San José
47
- regions: [es_v, es_vc, es_cm, es_mu, es_m]
48
- mday: 19
49
- observed: to_monday_if_sunday(date)
50
- 4:
51
- - name: Día de Castilla y León
52
- regions: [es_cl]
53
- mday: 23
54
- observed: to_monday_if_sunday(date)
55
- - name: San Jorge, Día de Aragón
56
- regions: [es_ar]
57
- mday: 23
58
- observed: to_monday_if_sunday(date)
59
- 5:
60
- - name: Día del Trabajador
61
- regions: [es]
62
- mday: 1
63
- observed: to_monday_if_sunday(date)
64
- - name: Fiesta de la Comunidad
65
- regions: [es_m]
66
- mday: 2
67
- observed: to_monday_if_sunday(date)
68
- - name: Día de las Canarias
69
- regions: [es_cn]
70
- mday: 30
71
- observed: to_monday_if_sunday(date)
72
- - name: Día de la Región Castilla-La Mancha
73
- regions: [es_cm]
74
- mday: 31
75
- observed: to_monday_if_sunday(date)
76
- 6:
77
- - name: Día de la Región de Murcia
78
- regions: [es_mu]
79
- mday: 9
80
- observed: to_monday_if_sunday(date)
81
- - name: Día de La Rioja
82
- regions: [es_lo]
83
- mday: 9
84
- observed: to_monday_if_sunday(date)
85
- 7:
86
- - name: Santiago Apostol
87
- regions: [es_ga]
88
- mday: 23
89
- observed: to_monday_if_sunday(date)
90
- 8:
91
- - name: Asunción
92
- regions: [es]
93
- mday: 15
94
- observed: to_monday_if_sunday(date)
95
- 9:
96
- - name: Día de Ceuta
97
- regions: [es_ce]
98
- mday: 2
99
- observed: to_monday_if_sunday(date)
100
- - name: Día de Asturias
101
- regions: [es_o]
102
- mday: 8
103
- observed: to_monday_if_sunday(date)
104
- - name: Día de Extremadura
105
- regions: [es_ex]
106
- mday: 8
107
- - name: Fiesta Nacional de Cataluña
108
- regions: [es_ct]
109
- mday: 11
110
- observed: to_monday_if_sunday(date)
111
- 10:
112
- - name: Día de Valencia
113
- regions: [es_vc, es_v]
114
- mday: 9
115
- observed: to_monday_if_sunday(date)
116
- - name: Día de la Hispanidad
117
- regions: [es]
118
- mday: 12
119
- observed: to_monday_if_sunday(date)
120
- 11:
121
- - name: Todos los Santos
122
- regions: [es]
123
- mday: 1
124
- observed: to_monday_if_sunday(date)
125
- 12:
126
- - name: Día de la Constitución
127
- regions: [es]
128
- mday: 6
129
- observed: to_monday_if_sunday(date)
130
- - name: Inmaculada Concepción
131
- regions: [es]
132
- mday: 8
133
- observed: to_monday_if_sunday(date)
134
- - name: Navidad del Señor
135
- regions: [es]
136
- mday: 25
137
- observed: to_monday_if_sunday(date)
138
- - name: San Esteban
139
- regions: [es_ib, es_ct]
140
- mday: 26
141
- observed: to_monday_if_sunday(date)
142
- tests: |
143
- {Date.civil(2009,1,1) => 'Año Nuevo',
144
- Date.civil(2009,1,6) => 'Día de Reyes',
145
- Date.civil(2009,4,10) => 'Viernes Santo',
146
- Date.civil(2009,5,1) => 'Día del Trabajador',
147
- Date.civil(2009,8,15) => 'Asunción',
148
- Date.civil(2009,10,12) => 'Día de la Hispanidad',
149
- Date.civil(2009,11,1) => 'Todos los Santos',
150
- Date.civil(2009,12,6) => 'Día de la Constitución',
151
- Date.civil(2009,12,8) => 'Inmaculada Concepción',
152
- Date.civil(2009,12,25) => 'Navidad del Señor'}.each do |date, name|
153
- assert_equal name, (Holidays.on(date, :es, :informal)[0] || {})[:name]
154
- end
155
-
156
- [:es_pv, :es_na, :es_an, :es_ib, :es_cm, :es_mu, :es_m, :es_ar, :es_cl, :es_cn, :es_lo, :es_ga, :es_ce, :es_o, :es_ex, :es_].each do |r|
157
- assert_equal 'Jueves Santo', Holidays.on(Date.civil(2009,4,9), r)[0][:name]
158
- end
159
- [:es_pv, :es_ct, :es_na, :es_v, :es_vc, :es_].each do |r|
160
- assert_equal 'Lunes de Pascua', Holidays.on(Date.civil(2009,4,13), r)[0][:name]
161
- end
162
-
163
- assert_equal 'Jueves Santo', Holidays.on(Date.civil(2009,4,9), :es_an)[0][:name]
164
-
165
- [:es_v, :es_vc, :es_cm, :es_mu, :es_m, :es_].each do |r|
166
- assert_equal 'San José', Holidays.on(Date.civil(2009,3,19), r)[0][:name]
167
- end
168
-
169
- [:es_cl].each do |r|
170
- assert_equal 'Día de Castilla y León', Holidays.on(Date.civil(2009,4,23), r)[0][:name]
171
- end
172
-
173
- [:es_ar].each do |r|
174
- assert_equal 'San Jorge, Día de Aragón', Holidays.on(Date.civil(2009,4,23), r)[0][:name]
175
- end
176
-
177
- [:es_].each do |r|
178
- assert_equal 'Día de Castilla y León', Holidays.on(Date.civil(2009,4,23), r)[0][:name]
179
- assert_equal 'San Jorge, Día de Aragón', Holidays.on(Date.civil(2009,4,23), r)[1][:name]
180
- end
181
-
182
- [:es_vc, :es_v, :es_].each do |r|
183
- assert_equal 'Día de Valencia', Holidays.on(Date.civil(2009,10,9), r)[0][:name]
184
- end
185
-
186
- [:es_ib, :es_ct, :es_].each do |r|
187
- assert_equal 'San Esteban', Holidays.on(Date.civil(2009,12,26), r)[0][:name]
188
- end
189
-
190
- assert_equal 'Año Nuevo', Holidays.on(Date.civil(2012,1,1), :es)[0][:name]
191
- assert_equal 'Año Nuevo', Holidays.on(Date.civil(2012,1,2), :es, :observed)[0][:name]
192
- assert_equal 'Día de Andalucía', Holidays.on(Date.civil(2009,2,28), :es_an)[0][:name]
193
- assert_equal 'Día de las Islas Baleares', Holidays.on(Date.civil(2009,3,1), :es_ib)[0][:name]
194
- assert_equal 'Fiesta de la Comunidad', Holidays.on(Date.civil(2006,5,2), :es_m)[0][:name]
195
- assert_equal 'Día de las Canarias', Holidays.on(Date.civil(2006,5,30), :es_cn)[0][:name]
196
- assert_equal 'Día de la Región Castilla-La Mancha', Holidays.on(Date.civil(2009,5,31), :es_cm)[0][:name]
197
- assert_equal 'Día de la Región de Murcia', Holidays.on(Date.civil(2009,6,9), :es_mu)[0][:name]
198
- assert_equal 'Día de La Rioja', Holidays.on(Date.civil(2009,6,9), :es_lo)[0][:name]
199
- assert_equal 'Santiago Apostol', Holidays.on(Date.civil(2009,7,23), :es_ga)[0][:name]
200
- assert_equal 'Día de Ceuta', Holidays.on(Date.civil(2009,9,2), :es_ce)[0][:name]
201
- assert_equal 'Día de Asturias', Holidays.on(Date.civil(2009,9,8), :es_o)[0][:name]
202
- assert_equal 'Día de Extremadura', Holidays.on(Date.civil(2009,9,8), :es_ex)[0][:name]
203
- assert_equal 'Fiesta Nacional de Cataluña', Holidays.on(Date.civil(2009,9,11), :es_ct)[0][:name]