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,79 +0,0 @@
1
- # Croatian holiday definitions for the Ruby Holiday gem.
2
- #
3
- # Updated: 2012-08-29.
4
- # Sources:
5
- # http://en.wikipedia.org/wiki/Public_holidays_in_Croatia
6
- ---
7
- months:
8
- 0:
9
- - name: Uskrs
10
- regions: [hr]
11
- function: easter(year)
12
- - name: Uskrsni ponedjeljak
13
- regions: [hr]
14
- function: easter(year)
15
- function_modifier: 1
16
- - name: Tijelovo
17
- regions: [hr]
18
- function: easter(year)
19
- function_modifier: 60
20
- 1:
21
- - name: Nova godina
22
- regions: [hr]
23
- mday: 1
24
- - name: Sveta tri kralja
25
- regions: [hr]
26
- mday: 6
27
- 5:
28
- - name: Međunarodni praznik rada
29
- regions: [hr]
30
- mday: 1
31
- 6:
32
- - name: Dan antifašističke borbe
33
- regions: [hr]
34
- mday: 22
35
- - name: Dan državnosti
36
- regions: [hr]
37
- mday: 25
38
- 8:
39
- - name: Dan pobjede i domovinske zahvalnosti i dan hrvatskih branitelja
40
- regions: [hr]
41
- mday: 5
42
- - name: Velika Gospa
43
- regions: [hr]
44
- mday: 15
45
- 10:
46
- - name: Dan neovisnosti
47
- regions: [hr]
48
- mday: 8
49
- 11:
50
- - name: Dan svih svetih
51
- regions: [hr]
52
- mday: 1
53
- 12:
54
- - name: Božić
55
- regions: [hr]
56
- mday: 25
57
- - name: Sveti Stjepan
58
- regions: [hr]
59
- mday: 26
60
- tests: |
61
- {Date.civil(2012,1,1) => 'Nova godina',
62
- Date.civil(2012,1,6) => 'Sveta tri kralja',
63
- Date.civil(2012,5,1) => 'Međunarodni praznik rada',
64
- Date.civil(2012,6,22) => 'Dan antifašističke borbe',
65
- Date.civil(2012,6,25) => 'Dan državnosti',
66
- Date.civil(2012,8,5) => 'Dan pobjede i domovinske zahvalnosti i dan hrvatskih branitelja',
67
- Date.civil(2012,8,15) => 'Velika Gospa',
68
- Date.civil(2012,10,8) => 'Dan neovisnosti',
69
- Date.civil(2012,11,1) => 'Dan svih svetih',
70
- Date.civil(2012,12,25) => 'Božić',
71
- Date.civil(2012,12,26) => 'Sveti Stjepan'}.each do |date, name|
72
- assert_equal name, (Holidays.on(date, :hr, :informal)[0] || {})[:name]
73
- end
74
-
75
- # Tijelovo
76
- [Date.civil(2008,5,22), Date.civil(2009,6,11), Date.civil(2010,6,3),
77
- Date.civil(2012,6,7), Date.civil(2013,5,30), Date.civil(2014,6,19)].each do |date|
78
- assert_equal 'Tijelovo', Holidays.on(date, :hr)[0][:name]
79
- end
@@ -1,63 +0,0 @@
1
- # Hungarian holiday definitions for the Ruby Holiday gem.
2
- #
3
- # Updated: 2012-03-01 by spap
4
- ---
5
- months:
6
- 0:
7
- - name: Húsvét hétfő
8
- regions: [hu]
9
- function: easter(year)
10
- function_modifier: 1
11
- - name: Pünkösd hétfő
12
- regions: [hu]
13
- function: easter(year)
14
- function_modifier: 50
15
- 1:
16
- - name: Újév
17
- regions: [hu]
18
- mday: 1
19
- 3:
20
- - name: 1848/49-es forradalom és szabadságharc ünnepe
21
- regions: [hu]
22
- mday: 15
23
- 5:
24
- - name: A munka ünnepe
25
- regions: [hu]
26
- mday: 1
27
- 8:
28
- - name: Az államalapítás ünnepe
29
- regions: [hu]
30
- mday: 20
31
- 10:
32
- - name: 1956-os forradalom és szabadságharc ünnepe
33
- regions: [hu]
34
- mday: 23
35
- 11:
36
- - name: Mindenszentek
37
- regions: [hu]
38
- mday: 1
39
- 12:
40
- - name: Karácsony
41
- regions: [hu]
42
- mday: 25
43
- - name: Karácsony
44
- regions: [hu]
45
- mday: 26
46
- tests: |
47
- {Date.civil(2012,1,1) => 'Újév',
48
- Date.civil(2011,1,1) => 'Újév',
49
- Date.civil(2012,3,15) => '1848/49-es forradalom és szabadságharc ünnepe',
50
- Date.civil(2011,4,25) => 'Húsvét hétfő',
51
- Date.civil(2012,4,9) => 'Húsvét hétfő',
52
- Date.civil(2012,5,1) => 'A munka ünnepe',
53
- Date.civil(2011,6,13) => 'Pünkösd hétfő',
54
- Date.civil(2012,5,28) => 'Pünkösd hétfő',
55
- Date.civil(2012,8,20) => 'Az államalapítás ünnepe',
56
- Date.civil(2012,10,23) => '1956-os forradalom és szabadságharc ünnepe',
57
- Date.civil(2012,11,1) => 'Mindenszentek',
58
- Date.civil(2012,12,25) => 'Karácsony',
59
- Date.civil(2012,12,26) => 'Karácsony',}.each do |date, name|
60
- assert_equal name, (Holidays.on(date, :hu, :informal)[0] || {})[:name]
61
- end
62
-
63
- assert_equal [], Holidays.on(Date.civil(2012,3,14), :hu), '2012-03-14 is not a holiday in Hungary'
@@ -1,89 +0,0 @@
1
- # Ireland holiday definitions for the Ruby Holiday gem.
2
- #
3
- # Updated: 2012-03-16.
4
- # Sources:
5
- # - http://en.wikipedia.org/wiki/Public_holidays_in_the_Republic_of_Ireland
6
- # - http://www.citizensinformation.ie/categories/employment/employment-rights-and-conditions/leave-and-holidays/public-holidays-in-ireland
7
- # While there is mention that Jan 2 2012 was not officially a bank holiday, in reality very few businesses will not observe that date as a bank holiday
8
- ---
9
- months:
10
- 0:
11
- - name: Easter Monday
12
- regions: [ie]
13
- function: easter(year)
14
- function_modifier: 1
15
- 1:
16
- - name: New Year's Day
17
- regions: [ie]
18
- mday: 1
19
- observed: to_monday_if_weekend(date)
20
- 3:
21
- - name: St. Patrick's Day
22
- regions: [ie]
23
- mday: 17
24
- observed: to_monday_if_weekend(date)
25
- 5:
26
- - name: May Day
27
- regions: [ie]
28
- week: 1
29
- wday: 1
30
- 6:
31
- - name: June Bank Holiday
32
- regions: [ie]
33
- week: 1
34
- wday: 1
35
- 8:
36
- - name: August Bank Holiday
37
- regions: [ie]
38
- week: 1
39
- wday: 1
40
- 10:
41
- - name: October Bank Holiday
42
- regions: [ie]
43
- week: -1
44
- wday: 1
45
- 12:
46
- - name: Christmas Day
47
- regions: [ie]
48
- mday: 25
49
- observed: to_monday_if_weekend(date)
50
- - name: St. Stephen's Day
51
- regions: [ie]
52
- mday: 26
53
- observed: ie_st_stephens_day(date)
54
- methods:
55
- ie_st_stephens_day:
56
- # Ireland - Stephens Day is always the day after christmas day
57
- arguments: date
58
- source: |
59
- case date.wday
60
- when 6, 0 then date + 2
61
- when 1 then date + 1
62
- else date
63
- end
64
- tests: |
65
- {Date.civil(2008,1,1) => 'New Year\'s Day',
66
- Date.civil(2008,3,17) => 'St. Patrick\'s Day',
67
- Date.civil(2008,3,24) => 'Easter Monday',
68
- Date.civil(2008,5,5) => 'May Day',
69
- Date.civil(2008,6,2) => 'June Bank Holiday',
70
- Date.civil(2008,8,4) => 'August Bank Holiday',
71
- Date.civil(2008,10,27) => 'October Bank Holiday',
72
- Date.civil(2008,12,25) => 'Christmas Day',
73
- Date.civil(2008,12,26) => 'St. Stephen\'s Day'}.each do |date, name|
74
- assert_equal name, (Holidays.on(date, :ie)[0] || {})[:name]
75
- end
76
- {Date.civil(2012,1,2) => 'New Year\'s Day',
77
- Date.civil(2012,3,19) => 'St. Patrick\'s Day',
78
- Date.civil(2012,4,9) => 'Easter Monday',
79
- Date.civil(2012,5,7) => 'May Day',
80
- Date.civil(2012,6,4) => 'June Bank Holiday',
81
- Date.civil(2012,8,6) => 'August Bank Holiday',
82
- Date.civil(2012,10,29) => 'October Bank Holiday',
83
- Date.civil(2011,12,26) => 'Christmas Day',
84
- Date.civil(2011,12,27) => 'St. Stephen\'s Day',
85
- Date.civil(2012,12,25) => 'Christmas Day',
86
- Date.civil(2012,12,26) => 'St. Stephen\'s Day',
87
- Date.civil(2015,12,28) => 'St. Stephen\'s Day'}.each do |date, name|
88
- assert_equal name, (Holidays.on(date, :ie, :observed)[0] || {})[:name]
89
- end
@@ -1,61 +0,0 @@
1
- # Definition build list
2
- ---
3
- defs:
4
- AR: ['ar.yaml']
5
- AT: ['at.yaml']
6
- AU: ['au.yaml']
7
- BE_FR: ['be_fr.yaml']
8
- BE_NL: ['be_nl.yaml']
9
- BR: ['br.yaml']
10
- BG: ['bg.yaml']
11
- CA: ['ca.yaml', 'north_america_informal.yaml']
12
- CH: ['ch.yaml']
13
- CL: ['cl.yaml']
14
- CR: ['cr.yaml']
15
- CZ: ['cz.yaml']
16
- DK: ['dk.yaml']
17
- DE: ['de.yaml']
18
- ECB_TARGET: ['ecb_target.yaml']
19
- EL: ['el.yaml']
20
- ES: ['es.yaml']
21
- Federal_Reserve: ['federal_reserve.yaml']
22
- FedEx: ['fedex.yaml']
23
- FI: ['fi.yaml']
24
- FR: ['fr.yaml']
25
- GB: ['gb.yaml']
26
- HR: ['hr.yaml']
27
- HU: ['hu.yaml']
28
- IE: ['ie.yaml']
29
- IS: ['is.yaml']
30
- IT: ['it.yaml']
31
- KR: ['kr.yaml']
32
- LI: ['li.yaml']
33
- LT: ['lt.yaml']
34
- MA: ['ma.yaml']
35
- MX: ['mx.yaml', 'north_america_informal.yaml']
36
- NERC: ['nerc.yaml']
37
- NL: ['nl.yaml']
38
- LU: ['lu.yaml']
39
- "NO": ['no.yaml']
40
- NYSE: ['nyse.yaml']
41
- NZ: ['nz.yaml']
42
- PE: ['pe.yaml']
43
- PH: ['ph.yaml']
44
- PL: ['pl.yaml']
45
- PT: ['pt.yaml']
46
- RO: ['ro.yaml']
47
- SE: ['se.yaml']
48
- US: ['us.yaml', 'north_america_informal.yaml']
49
- United_Nations: ['united_nations.yaml']
50
- UPS: ['ups.yaml']
51
- ZA: ['za.yaml']
52
- North_America: ['ca.yaml', 'mx.yaml', 'us.yaml', 'north_america_informal.yaml']
53
- Scandinavia: ['dk.yaml', 'is.yaml', 'no.yaml', 'se.yaml', 'fi.yaml']
54
- Europe: ['at.yaml', 'be_fr.yaml', 'be_nl.yaml', 'ch.yaml', 'cz.yaml', 'dk.yaml', 'de.yaml', 'el.yaml', 'es.yaml', 'fr.yaml', 'gb.yaml', 'hr.yaml', 'hu.yaml', 'ie.yaml', 'is.yaml', 'it.yaml', 'li.yaml', 'lt.yaml', 'nl.yaml', 'no.yaml', 'pl.yaml', 'pt.yaml', 'ro.yaml', 'sk.yaml', 'si.yaml', 'bg.yaml']
55
- JP: ['jp.yaml']
56
- VE: ['ve.yaml']
57
- VI: ['vi.yaml']
58
- SK: ['sk.yaml']
59
- SI: ['si.yaml']
60
- SG: ['sg.yaml']
61
- MY: ['my.yaml']
@@ -1,146 +0,0 @@
1
- # Icelandic holiday definitions for the Ruby Holiday gem.
2
- #
3
- # Updated: 2008-11-29.
4
- # Sources:
5
- # - http://www.simnet.is/gardarj/folk/days.htm#days
6
- # - http://www.iceland.is/history-and-culture/Traditions/IcelandicHolidays/
7
- # - http://en.wikipedia.org/wiki/Public_holidays_in_Iceland
8
- # - http://www.qppstudio.net/publicholidays2007/iceland.htm
9
- ---
10
- months:
11
- 0:
12
- - name: Bolludagur
13
- regions: [is]
14
- function: easter(year)
15
- function_modifier: -48
16
- - name: Sprengidagur
17
- regions: [is]
18
- function: easter(year)
19
- function_modifier: -47
20
- - name: Öskudagur
21
- regions: [is]
22
- function: easter(year)
23
- function_modifier: -46
24
- - name: Pálmasunnudagur
25
- regions: [is]
26
- function: easter(year)
27
- function_modifier: -7
28
- - name: Skírdagur
29
- regions: [is]
30
- function: easter(year)
31
- function_modifier: -3
32
- - name: Föstudaginn langi
33
- regions: [is]
34
- function: easter(year)
35
- function_modifier: -2
36
- - name: Páskadagur
37
- regions: [is]
38
- function: easter(year)
39
- - name: Annar í páskum
40
- regions: [is]
41
- function: easter(year)
42
- function_modifier: 1
43
- - name: Uppstigningardagur
44
- regions: [is]
45
- function: easter(year)
46
- function_modifier: 39
47
- - name: Hvítasunnudagur
48
- regions: [is]
49
- function: easter(year)
50
- function_modifier: 49
51
- - name: Annar í hvítasunnu
52
- regions: [is]
53
- function: easter(year)
54
- function_modifier: 50
55
- 1:
56
- - name: Nýársdagur
57
- regions: [is]
58
- mday: 1
59
- - name: Þrettándinn
60
- regions: [is]
61
- mday: 6
62
- - name: Bóndadagur
63
- regions: [is]
64
- mday: 19
65
- type: informal
66
- 2:
67
- - name: Konudagur
68
- regions: [is]
69
- mday: 18
70
- type: informal
71
- 4:
72
- - name: Sumardagurinn fyrsti
73
- regions: [is]
74
- function: is_sumardagurinn_fyrsti(year)
75
- 5:
76
- - name: Verkalýðsdagurinn
77
- regions: [is]
78
- mday: 1
79
- - name: Mæðradagurinn
80
- regions: [is]
81
- mday: 13
82
- 6:
83
- - name: Sjómannadagurinn
84
- regions: [is]
85
- mday: 3
86
- type: informal
87
- - name: Lýðveldisdagurinn
88
- regions: [is]
89
- mday: 17
90
- 8:
91
- - name: Frídagur verslunarmanna
92
- regions: [is]
93
- week: 1
94
- wday: 1
95
- 11:
96
- - name: Dagur íslenskrar tungu
97
- regions: [is]
98
- mday: 16
99
- 12:
100
- - name: Jól
101
- regions: [is]
102
- mday: 24
103
- - name: Jól
104
- regions: [is]
105
- mday: 25
106
- - name: Jól
107
- regions: [is]
108
- mday: 26
109
- - name: Gamlárskvöld
110
- regions: [is]
111
- mday: 31
112
- methods:
113
- is_sumardagurinn_fyrsti:
114
- # Iceland: first day of summer (Thursday after 18 April)
115
- arguments: year
116
- source: |
117
- date = Date.civil(year,4,18)
118
- if date.wday < 4
119
- date += (4 - date.wday)
120
- else
121
- date += (11 - date.wday)
122
- end
123
- date
124
- tests: |
125
- {Date.civil(2007,1,1) => 'Nýársdagur',
126
- Date.civil(2007,1,6) => 'Þrettándinn',
127
- Date.civil(2007,1,19) => 'Bóndadagur',
128
- Date.civil(2007,2,18) => 'Konudagur',
129
- Date.civil(2007,4,5) => 'Skírdagur',
130
- Date.civil(2007,4,6) => 'Föstudaginn langi',
131
- Date.civil(2007,4,8) => 'Páskadagur',
132
- Date.civil(2007,4,9) => 'Annar í páskum',
133
- Date.civil(2007,4,19) => 'Sumardagurinn fyrsti',
134
- Date.civil(2007,5,1) => 'Verkalýðsdagurinn',
135
- Date.civil(2007,5,17) => 'Uppstigningardagur',
136
- Date.civil(2007,5,27) => 'Hvítasunnudagur',
137
- Date.civil(2007,5,28) => 'Annar í hvítasunnu',
138
- Date.civil(2007,6,3) => 'Sjómannadagurinn',
139
- Date.civil(2007,6,17) => 'Lýðveldisdagurinn',
140
- Date.civil(2007,8,6) => 'Frídagur verslunarmanna',
141
- Date.civil(2007,12,24) => 'Jól',
142
- Date.civil(2007,12,25) => 'Jól',
143
- Date.civil(2007,12,26) => 'Jól',
144
- Date.civil(2007,12,31) => 'Gamlárskvöld'}.each do |date, name|
145
- assert_equal name, (Holidays.on(date, :is, :informal)[0] || {})[:name]
146
- end
@@ -1,67 +0,0 @@
1
- # Italian holiday definitions for the Ruby Holiday gem.
2
- #
3
- # Updated: 2008-11-23.
4
- # Sources:
5
- # - http://en.wikipedia.org/wiki/Holidays_in_Italy
6
- ---
7
- months:
8
- 0:
9
- - name: Pasqua
10
- regions: [it]
11
- function: easter(year)
12
- - name: Lunedì dell'Angelo
13
- regions: [it]
14
- function: easter(year)
15
- function_modifier: 1
16
- 1:
17
- - name: Capodanno
18
- regions: [it]
19
- mday: 1
20
- - name: Epifania
21
- regions: [it]
22
- mday: 6
23
- 4:
24
- - name: Festa della Liberazione
25
- regions: [it]
26
- mday: 25
27
- 5:
28
- - name: Festa dei Lavoratori
29
- regions: [it]
30
- mday: 1
31
- 6:
32
- - name: Festa della Repubblica
33
- regions: [it]
34
- mday: 2
35
- 8:
36
- - name: Assunzione
37
- regions: [it]
38
- mday: 15
39
- 11:
40
- - name: Ognissanti
41
- regions: [it]
42
- mday: 1
43
- 12:
44
- - name: Immacolata Concezione
45
- regions: [it]
46
- mday: 8
47
- - name: Natale
48
- regions: [it]
49
- mday: 25
50
- - name: Santo Stefano
51
- regions: [it]
52
- mday: 26
53
- tests: |
54
- {Date.civil(2007,1,1) => 'Capodanno',
55
- Date.civil(2007,1,6) => 'Epifania',
56
- Date.civil(2007,4,8) => 'Pasqua',
57
- Date.civil(2007,4,9) => 'Lunedì dell\'Angelo',
58
- Date.civil(2007,4,25) => 'Festa della Liberazione',
59
- Date.civil(2007,5,1) => 'Festa dei Lavoratori',
60
- Date.civil(2007,6,2) => 'Festa della Repubblica',
61
- Date.civil(2007,8,15) => 'Assunzione',
62
- Date.civil(2007,11,1) => 'Ognissanti',
63
- Date.civil(2007,12,8) => 'Immacolata Concezione',
64
- Date.civil(2007,12,25) => 'Natale',
65
- Date.civil(2007,12,26) => 'Santo Stefano'}.each do |date, name|
66
- assert_equal name, (Holidays.on(date, :it, :informal)[0] || {})[:name]
67
- end