holidays 4.7.0 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitmodules +3 -0
- data/CHANGELOG.md +9 -0
- data/CONTRIBUTING.md +21 -11
- data/Makefile +9 -6
- data/holidays.gemspec +1 -1
- data/lib/generated_definitions/MANIFEST +1 -0
- data/lib/generated_definitions/REGIONS.rb +1 -1
- data/lib/generated_definitions/hk.rb +112 -0
- data/lib/generated_definitions/kr.rb +4 -4
- data/lib/holidays/errors.rb +1 -0
- data/lib/holidays/finder/context/parse_options.rb +8 -3
- data/lib/holidays/load_all_definitions.rb +0 -11
- data/lib/holidays/version.rb +1 -1
- data/test/defs/test_defs_hk.rb +38 -0
- data/test/defs/test_defs_jp.rb +1 -0
- data/test/defs/test_defs_kr.rb +1 -1
- data/test/holidays/definition/validator/test_region.rb +4 -0
- data/test/holidays/finder/context/test_parse_options.rb +9 -1
- data/test/integration/test_all_regions.rb +4 -4
- data/test/integration/test_custom_holidays.rb +4 -4
- data/test/integration/test_holidays.rb +6 -6
- metadata +6 -60
- data/definitions/README.md +0 -353
- data/definitions/ar.yaml +0 -93
- data/definitions/at.yaml +0 -72
- data/definitions/au.yaml +0 -378
- data/definitions/be_fr.yaml +0 -69
- data/definitions/be_nl.yaml +0 -69
- data/definitions/bg.yaml +0 -127
- data/definitions/br.yaml +0 -77
- data/definitions/ca.yaml +0 -317
- data/definitions/ch.yaml +0 -193
- data/definitions/cl.yaml +0 -94
- data/definitions/cr.yaml +0 -65
- data/definitions/cz.yaml +0 -73
- data/definitions/de.yaml +0 -209
- data/definitions/dk.yaml +0 -130
- data/definitions/ecb_target.yaml +0 -44
- data/definitions/el.yaml +0 -84
- data/definitions/es.yaml +0 -203
- data/definitions/federal_reserve.yaml +0 -114
- data/definitions/fedex.yaml +0 -62
- data/definitions/fi.yaml +0 -115
- data/definitions/fr.yaml +0 -79
- data/definitions/gb.yaml +0 -151
- data/definitions/hr.yaml +0 -79
- data/definitions/hu.yaml +0 -63
- data/definitions/ie.yaml +0 -89
- data/definitions/index.yaml +0 -61
- data/definitions/is.yaml +0 -146
- data/definitions/it.yaml +0 -67
- data/definitions/jp.yaml +0 -321
- data/definitions/kr.yaml +0 -282
- data/definitions/li.yaml +0 -107
- data/definitions/lt.yaml +0 -89
- data/definitions/lu.yaml +0 -56
- data/definitions/ma.yaml +0 -52
- data/definitions/mx.yaml +0 -106
- data/definitions/my.yaml +0 -51
- data/definitions/nerc.yaml +0 -51
- data/definitions/nl.yaml +0 -73
- data/definitions/no.yaml +0 -90
- data/definitions/north_america_informal.yaml +0 -61
- data/definitions/nyse.yaml +0 -64
- data/definitions/nz.yaml +0 -163
- data/definitions/pe.yaml +0 -119
- data/definitions/ph.yaml +0 -94
- data/definitions/pl.yaml +0 -320
- data/definitions/pt.yaml +0 -89
- data/definitions/ro.yaml +0 -78
- data/definitions/se.yaml +0 -120
- data/definitions/sg.yaml +0 -56
- data/definitions/si.yaml +0 -86
- data/definitions/sk.yaml +0 -80
- data/definitions/united_nations.yaml +0 -189
- data/definitions/ups.yaml +0 -62
- data/definitions/us.yaml +0 -103
- data/definitions/ve.yaml +0 -74
- data/definitions/vi.yaml +0 -29
- data/definitions/za.yaml +0 -80
data/definitions/jp.yaml
DELETED
@@ -1,321 +0,0 @@
|
|
1
|
-
# Japanese holiday definitions for Ruby Holiday gem.
|
2
|
-
# Reference:
|
3
|
-
# - http://www.h3.dion.ne.jp/~sakatsu/holiday_topic.htm
|
4
|
-
# - http://www8.cao.go.jp/chosei/shukujitsu/gaiyou.html
|
5
|
-
# - https://en.wikipedia.org/wiki/Public_holidays_in_Japan
|
6
|
-
#
|
7
|
-
# For Japanese/English translations of each holiday:
|
8
|
-
# - http://www.japanesecalendar.net/holidays/2016/
|
9
|
-
#
|
10
|
-
# This definition can calculate current Japanese holidays,
|
11
|
-
# don't compat with past changes of Japan Holiday Act.
|
12
|
-
#
|
13
|
-
# CHANGES:
|
14
|
-
# 2010-12-25: Initial version by Tatsuki Sugiura <sugi@nemui.org>
|
15
|
-
# 2014-11-09: Added substitute holiday by Yoshiyuki Hirano <yoshiyuki.hirano@henteco-labs.com>
|
16
|
-
# 2015-05-10: Non-Monday substitute holidays by Shuhei Kagawa <shuhei.kagawa@gmail.com>
|
17
|
-
# 2015-12-15: Added mountain day by Tsuyoshi Sano <ttwo32@gmail.com>
|
18
|
-
# 2016-03-26: Updated to match new custom method signature. See below for more. Phil Trimble <philtrimble@gmail.com>
|
19
|
-
#
|
20
|
-
# NOTE: This is the most complex set of custom date methods in the entire
|
21
|
-
# project, mainly surrounding the idea of 'substitute' holidays. Since this is
|
22
|
-
# the only one that is this complex I have settled on a less-than-ideal solution.
|
23
|
-
# It is overly verbose and not easy to follow. It will be a target for refactoring
|
24
|
-
# in the near future.
|
25
|
-
---
|
26
|
-
months:
|
27
|
-
1:
|
28
|
-
- name: 元日
|
29
|
-
regions: [jp]
|
30
|
-
mday: 1
|
31
|
-
- name: 成人の日
|
32
|
-
regions: [jp]
|
33
|
-
wday: 1
|
34
|
-
week: 2
|
35
|
-
- name: 振替休日
|
36
|
-
regions: [jp]
|
37
|
-
mday: 1
|
38
|
-
function: jp_substitute_holiday(year, month, day)
|
39
|
-
2:
|
40
|
-
- name: 建国記念日
|
41
|
-
regions: [jp]
|
42
|
-
mday: 11
|
43
|
-
- name: 振替休日
|
44
|
-
regions: [jp]
|
45
|
-
mday: 11
|
46
|
-
function: jp_substitute_holiday(year, month, day)
|
47
|
-
3:
|
48
|
-
- name: 春分の日
|
49
|
-
regions: [jp]
|
50
|
-
function: jp_vernal_equinox_day(year)
|
51
|
-
- name: 振替休日
|
52
|
-
regions: [jp]
|
53
|
-
function: jp_vernal_equinox_day_substitute(year)
|
54
|
-
4:
|
55
|
-
- name: 昭和の日
|
56
|
-
regions: [jp]
|
57
|
-
mday: 29
|
58
|
-
- name: 振替休日
|
59
|
-
regions: [jp]
|
60
|
-
mday: 29
|
61
|
-
function: jp_substitute_holiday(year, month, day)
|
62
|
-
5:
|
63
|
-
- name: 憲法記念日
|
64
|
-
regions: [jp]
|
65
|
-
mday: 3
|
66
|
-
- name: みどりの日
|
67
|
-
regions: [jp]
|
68
|
-
mday: 4
|
69
|
-
- name: こどもの日
|
70
|
-
regions: [jp]
|
71
|
-
mday: 5
|
72
|
-
- name: 振替休日
|
73
|
-
regions: [jp]
|
74
|
-
mday: 3
|
75
|
-
function: jp_substitute_holiday(year, month, day)
|
76
|
-
- name: 振替休日
|
77
|
-
regions: [jp]
|
78
|
-
mday: 4
|
79
|
-
function: jp_substitute_holiday(year, month, day)
|
80
|
-
- name: 振替休日
|
81
|
-
regions: [jp]
|
82
|
-
mday: 5
|
83
|
-
function: jp_substitute_holiday(year, month, day)
|
84
|
-
7:
|
85
|
-
- name: 海の日
|
86
|
-
regions: [jp]
|
87
|
-
mday: 20
|
88
|
-
year_ranges:
|
89
|
-
- between: 1996..2002
|
90
|
-
- name: 海の日
|
91
|
-
regions: [jp]
|
92
|
-
wday: 1
|
93
|
-
week: 3
|
94
|
-
year_ranges:
|
95
|
-
- after: 2003
|
96
|
-
- name: 振替休日
|
97
|
-
regions: [jp]
|
98
|
-
function: jp_marine_day_substitute(year)
|
99
|
-
year_ranges:
|
100
|
-
- between: 1996..2002
|
101
|
-
8:
|
102
|
-
- name: 山の日
|
103
|
-
regions: [jp]
|
104
|
-
year_ranges:
|
105
|
-
- after: 2016
|
106
|
-
function: jp_mountain_holiday(year)
|
107
|
-
- name: 振替休日
|
108
|
-
regions: [jp]
|
109
|
-
year_ranges:
|
110
|
-
- after: 2016
|
111
|
-
function: jp_mountain_holiday_substitute(year)
|
112
|
-
9:
|
113
|
-
- name: 敬老の日
|
114
|
-
regions: [jp]
|
115
|
-
wday: 1
|
116
|
-
week: 3
|
117
|
-
- name: 振替休日
|
118
|
-
regions: [jp]
|
119
|
-
function: jp_respect_for_aged_holiday_substitute(year)
|
120
|
-
- name: 国民の休日
|
121
|
-
regions: [jp]
|
122
|
-
year_ranges:
|
123
|
-
- after: 2003
|
124
|
-
function: jp_citizens_holiday(year)
|
125
|
-
- name: 秋分の日
|
126
|
-
regions: [jp]
|
127
|
-
function: jp_national_culture_day(year)
|
128
|
-
- name: 振替休日
|
129
|
-
regions: [jp]
|
130
|
-
function: jp_national_culture_day_substitute(year)
|
131
|
-
10:
|
132
|
-
- name: 体育の日
|
133
|
-
regions: [jp]
|
134
|
-
wday: 1
|
135
|
-
week: 2
|
136
|
-
- name: 振替休日
|
137
|
-
regions: [jp]
|
138
|
-
function: jp_health_sports_day_substitute(year)
|
139
|
-
11:
|
140
|
-
- name: 文化の日
|
141
|
-
regions: [jp]
|
142
|
-
mday: 3
|
143
|
-
- name: 振替休日
|
144
|
-
regions: [jp]
|
145
|
-
mday: 3
|
146
|
-
function: jp_substitute_holiday(year, month, day)
|
147
|
-
- name: 勤労感謝の日
|
148
|
-
regions: [jp]
|
149
|
-
mday: 23
|
150
|
-
- name: 振替休日
|
151
|
-
regions: [jp]
|
152
|
-
mday: 23
|
153
|
-
function: jp_substitute_holiday(year, month, day)
|
154
|
-
12:
|
155
|
-
- name: 天皇誕生日
|
156
|
-
regions: [jp]
|
157
|
-
mday: 23
|
158
|
-
- name: 振替休日
|
159
|
-
regions: [jp]
|
160
|
-
mday: 23
|
161
|
-
function: jp_substitute_holiday(year, month, day)
|
162
|
-
|
163
|
-
methods:
|
164
|
-
jp_health_sports_day_substitute:
|
165
|
-
arguments: year
|
166
|
-
source: |
|
167
|
-
Holidays::Factory::Definition.custom_methods_repository.find("jp_substitute_holiday(year, month, day)").call(year, 10, Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 10, 2, 1))
|
168
|
-
jp_vernal_equinox_day:
|
169
|
-
arguments: year
|
170
|
-
source: |
|
171
|
-
day =
|
172
|
-
case year
|
173
|
-
when 1851..1899
|
174
|
-
19.8277
|
175
|
-
when 1900..1979
|
176
|
-
20.8357
|
177
|
-
when 1980..2099
|
178
|
-
20.8431
|
179
|
-
when 2100..2150
|
180
|
-
21.8510
|
181
|
-
else
|
182
|
-
raise IndexError.new("Out of range")
|
183
|
-
end
|
184
|
-
day += 0.242194 * (year - 1980) - ((year - 1980)/4).floor
|
185
|
-
day = day.floor
|
186
|
-
Date.civil(year, 3, day)
|
187
|
-
jp_vernal_equinox_day_substitute:
|
188
|
-
arguments: year
|
189
|
-
source: |
|
190
|
-
date = Holidays::Factory::Definition.custom_methods_repository.find("jp_vernal_equinox_day(year)").call(year)
|
191
|
-
Holidays::Factory::Definition.custom_methods_repository.find("jp_substitute_holiday(year, month, day)").call(year, date.month, date.mday)
|
192
|
-
jp_marine_day_substitute:
|
193
|
-
arguments: year
|
194
|
-
source: |
|
195
|
-
Holidays::Factory::Definition.custom_methods_repository.find("jp_substitute_holiday(year, month, day)").call(year, 7, Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 7, 3, 1))
|
196
|
-
jp_national_culture_day:
|
197
|
-
arguments: year
|
198
|
-
source: |
|
199
|
-
day =
|
200
|
-
case year
|
201
|
-
when 1851..1899
|
202
|
-
22.2588
|
203
|
-
when 1900..1979
|
204
|
-
23.2588
|
205
|
-
when 1980..2099
|
206
|
-
23.2488
|
207
|
-
when 2100..2150
|
208
|
-
24.2488
|
209
|
-
else
|
210
|
-
raise IndexError.new("Out of range")
|
211
|
-
end
|
212
|
-
day += 0.242194 * (year - 1980) - ((year - 1980)/4).floor
|
213
|
-
day = day.floor
|
214
|
-
Date.civil(year, 9, day)
|
215
|
-
jp_national_culture_day_substitute:
|
216
|
-
arguments: year
|
217
|
-
source: |
|
218
|
-
date = Holidays::Factory::Definition.custom_methods_repository.find("jp_national_culture_day(year)").call(year)
|
219
|
-
Holidays::Factory::Definition.custom_methods_repository.find("jp_substitute_holiday(year, month, day)").call(year, date.month, date.mday)
|
220
|
-
jp_citizens_holiday:
|
221
|
-
arguments: year
|
222
|
-
source: |
|
223
|
-
ncd = Holidays::Factory::Definition.custom_methods_repository.find("jp_national_culture_day(year)").call(year)
|
224
|
-
if ncd.wday == 3
|
225
|
-
ncd - 1
|
226
|
-
else
|
227
|
-
nil
|
228
|
-
end
|
229
|
-
jp_mountain_holiday:
|
230
|
-
arguments: year
|
231
|
-
source: |
|
232
|
-
Date.civil(year, 8, 11)
|
233
|
-
jp_mountain_holiday_substitute:
|
234
|
-
arguments: year
|
235
|
-
source: |
|
236
|
-
date = Holidays::Factory::Definition.custom_methods_repository.find("jp_mountain_holiday(year)").call(year)
|
237
|
-
Holidays::Factory::Definition.custom_methods_repository.find("jp_substitute_holiday(year, month, day)").call(year, date.month, date.mday)
|
238
|
-
jp_respect_for_aged_holiday_substitute:
|
239
|
-
arguments: year
|
240
|
-
source: |
|
241
|
-
Holidays::Factory::Definition.custom_methods_repository.find("jp_substitute_holiday(year, month, day)").call(year, 9, Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 9, 3, 1))
|
242
|
-
jp_substitute_holiday:
|
243
|
-
arguments: year, month, day
|
244
|
-
source: |
|
245
|
-
date = Date.civil(year, month, day)
|
246
|
-
date.wday == 0 ? (Holidays::Factory::Definition.custom_methods_repository.find("jp_next_weekday(date)").call(date+1)) : nil
|
247
|
-
jp_next_weekday:
|
248
|
-
arguments: date
|
249
|
-
source: |
|
250
|
-
is_holiday = Holidays::JP.holidays_by_month[date.month].any? do |holiday|
|
251
|
-
holiday[:mday] == date.day
|
252
|
-
end
|
253
|
-
date.wday == 0 || is_holiday ? (Holidays::Factory::Definition.custom_methods_repository.find("jp_next_weekday(date)").call(date+1)) : date
|
254
|
-
|
255
|
-
tests: |
|
256
|
-
{Date.civil(2008,1,1) => '元日',
|
257
|
-
Date.civil(2010,1,11) => '成人の日',
|
258
|
-
Date.civil(2008,2,11) => '建国記念日',
|
259
|
-
Date.civil(2008,4,29) => '昭和の日',
|
260
|
-
Date.civil(2008,5,3) => '憲法記念日',
|
261
|
-
Date.civil(2008,5,5) => 'こどもの日',
|
262
|
-
Date.civil(2010,7,19) => '海の日',
|
263
|
-
Date.civil(2010,9,20) => '敬老の日',
|
264
|
-
Date.civil(2010,10,11) => '体育の日',
|
265
|
-
Date.civil(2008,11,3) => '文化の日',
|
266
|
-
Date.civil(2008,11,23) => '勤労感謝の日',
|
267
|
-
Date.civil(2008,12,23) => '天皇誕生日',
|
268
|
-
Date.civil(2010,3,22) => '振替休日',
|
269
|
-
Date.civil(2008,11,24) => '振替休日',
|
270
|
-
Date.civil(2012,1,2) => '振替休日',
|
271
|
-
Date.civil(2013,5,6) => '振替休日',
|
272
|
-
Date.civil(2014,5,6) => '振替休日',
|
273
|
-
Date.civil(2015,5,6) => '振替休日',
|
274
|
-
Date.civil(2019,8,12) => '振替休日'
|
275
|
-
}.each do |date, name|
|
276
|
-
assert_equal name, (Holidays.on(date, :jp, :informal)[0] || {})[:name]
|
277
|
-
end
|
278
|
-
|
279
|
-
# vernal equinox day
|
280
|
-
[Date.civil(2004,3,20), Date.civil(2005,3,20), Date.civil(2006,3,21),
|
281
|
-
Date.civil(2007,3,21), Date.civil(2008,3,20), Date.civil(2009,3,20),
|
282
|
-
Date.civil(2010,3,21)].each do |date|
|
283
|
-
assert_equal '春分の日', Holidays.on(date, :jp)[0][:name]
|
284
|
-
end
|
285
|
-
|
286
|
-
# national culture day
|
287
|
-
[Date.civil(2004,9,23), Date.civil(2005,9,23), Date.civil(2006,9,23),
|
288
|
-
Date.civil(2007,9,23), Date.civil(2008,9,23), Date.civil(2009,9,23),
|
289
|
-
Date.civil(2010,9,23), Date.civil(2011,9,23), Date.civil(2012,9,22),
|
290
|
-
Date.civil(2013,9,23)].each do |date|
|
291
|
-
assert_equal '秋分の日', Holidays.on(date, :jp)[0][:name]
|
292
|
-
end
|
293
|
-
|
294
|
-
# citizens holiday
|
295
|
-
[Date.civil(2032,9,21), Date.civil(2049,9,21), Date.civil(2009,9,22),
|
296
|
-
Date.civil(2015,9,22), Date.civil(2026,9,22)].each do |date|
|
297
|
-
assert_equal '国民の休日', Holidays.on(date, :jp)[0][:name]
|
298
|
-
end
|
299
|
-
|
300
|
-
# marine day since 1996
|
301
|
-
[Date.civil(1996, 7, 20), Date.civil(2002, 7, 20), Date.civil(2003, 7, 21),
|
302
|
-
Date.civil(2004, 7, 19), Date.civil(2005, 7, 18), Date.civil(2006, 7, 17),
|
303
|
-
Date.civil(2007, 7, 16), Date.civil(2009, 7, 20), Date.civil(2013, 7, 15),
|
304
|
-
Date.civil(2014, 7, 21)].each do |date|
|
305
|
-
assert_equal '海の日', Holidays.on(date, :jp)[0][:name]
|
306
|
-
end
|
307
|
-
|
308
|
-
# mountain holiday start since 2016
|
309
|
-
[Date.civil(2016,8,11), Date.civil(2017,8,11),Date.civil(2018,8,11),
|
310
|
-
Date.civil(2019,8,11), Date.civil(2020,8,11),Date.civil(2021,8,11),
|
311
|
-
Date.civil(2022,8,11)].each do |date|
|
312
|
-
assert_equal '山の日', Holidays.on(date, :jp)[0][:name]
|
313
|
-
end
|
314
|
-
|
315
|
-
# before 2016, there is no mountain holiday.
|
316
|
-
assert_nil Holidays.on(Date.civil(2015,8,11), :jp)[0]
|
317
|
-
|
318
|
-
# before 2003, there is no citizens holiday.
|
319
|
-
# [note] citizens holiday requires that jp_national_culture_day is wednesday.
|
320
|
-
# Before 2003, the closest past year that mathches above condition is 1998.
|
321
|
-
assert_nil Holidays.on(Date.civil(1998,9,22), :jp)[0]
|
data/definitions/kr.yaml
DELETED
@@ -1,282 +0,0 @@
|
|
1
|
-
# Republic of Korea holiday definitions for the Ruby Holiday gem.
|
2
|
-
# Provided by Jonathan Pike
|
3
|
-
#
|
4
|
-
# Updated: 2016-09-23.
|
5
|
-
# Sources:
|
6
|
-
# - https://en.wikipedia.org/wiki/List_of_public_holidays_in_South_Korea
|
7
|
-
# - http://www.hko.gov.hk/gts/time/conversion.htm (for Lunar Calendar Conversions)
|
8
|
-
|
9
|
-
---
|
10
|
-
months:
|
11
|
-
0:
|
12
|
-
- name: Korean New Year
|
13
|
-
regions: [kr]
|
14
|
-
function: kr_new_years(year)
|
15
|
-
- name: Buddah's Birthday
|
16
|
-
regions: [kr]
|
17
|
-
function: kr_buddahs_birthday(year)
|
18
|
-
- name: Korean Thanksgiving
|
19
|
-
regions: [kr]
|
20
|
-
function: kr_thanksgiving(year)
|
21
|
-
1:
|
22
|
-
- name: New Year's Day
|
23
|
-
regions: [kr]
|
24
|
-
mday: 1
|
25
|
-
3:
|
26
|
-
- name: Independence Movement Day
|
27
|
-
regions: [kr]
|
28
|
-
mday: 1
|
29
|
-
5:
|
30
|
-
- name: Children's Day
|
31
|
-
regions: [kr]
|
32
|
-
mday: 5
|
33
|
-
6:
|
34
|
-
- name: Memorial Day
|
35
|
-
regions: [kr]
|
36
|
-
mday: 6
|
37
|
-
7:
|
38
|
-
- name: Constitution Day
|
39
|
-
regions: [kr]
|
40
|
-
mday: 17
|
41
|
-
type: informal
|
42
|
-
8:
|
43
|
-
- name: Liberation Day
|
44
|
-
regions: [kr]
|
45
|
-
mday: 15
|
46
|
-
10:
|
47
|
-
- name: National Foundation Day
|
48
|
-
regions: [kr]
|
49
|
-
mday: 3
|
50
|
-
- name: Hangul Day
|
51
|
-
regions: [kr]
|
52
|
-
mday: 9
|
53
|
-
12:
|
54
|
-
- name: Christmas Day
|
55
|
-
regions: [kr]
|
56
|
-
mday: 25
|
57
|
-
|
58
|
-
methods:
|
59
|
-
kr_new_years:
|
60
|
-
arguments: year
|
61
|
-
source: |
|
62
|
-
month_day = case year
|
63
|
-
when 1941
|
64
|
-
[1, 17]
|
65
|
-
when 1966
|
66
|
-
[1, 21]
|
67
|
-
when 1909, 1947, 2004, 2023, 2042
|
68
|
-
[1, 22]
|
69
|
-
when 1917, 1928, 1974, 1993, 2012, 2031, 2015
|
70
|
-
[1, 23]
|
71
|
-
when 1925, 1936, 1955, 2001, 2039
|
72
|
-
[1, 24]
|
73
|
-
when 1906, 1944, 1963, 1982, 2020
|
74
|
-
[1, 25]
|
75
|
-
when 1914, 1933, 2009, 2028, 2047
|
76
|
-
[1, 26]
|
77
|
-
when 1952, 1971, 1990
|
78
|
-
[1, 27]
|
79
|
-
when 1922, 1960, 1979, 1998, 2017, 2036
|
80
|
-
[1, 28]
|
81
|
-
when 1903, 1949, 1987, 2006, 2025
|
82
|
-
[1, 29]
|
83
|
-
when 1911, 1930, 1968, 2044
|
84
|
-
[1, 30]
|
85
|
-
when 1938, 1957, 1976, 1995, 2014, 2033
|
86
|
-
[1, 31]
|
87
|
-
when 1919, 1948, 2003, 2022, 2041
|
88
|
-
[2, 1]
|
89
|
-
when 1908, 1927, 1946, 1965, 1984, 2049
|
90
|
-
[2, 2]
|
91
|
-
when 1916, 1954, 1973, 2011, 2030
|
92
|
-
[2, 3]
|
93
|
-
when 1905, 1935, 1992, 2038
|
94
|
-
[2, 4]
|
95
|
-
when 1924, 1943, 1962, 1981, 1989, 2000, 2019
|
96
|
-
[2, 5]
|
97
|
-
when 1913, 1932, 1951, 1970, 2027, 2046
|
98
|
-
[2, 6]
|
99
|
-
when 1978, 1997, 2008
|
100
|
-
[2, 7]
|
101
|
-
when 1902, 1921, 1940, 1959, 2016, 2035
|
102
|
-
[2, 8]
|
103
|
-
when 1967, 1986, 2005
|
104
|
-
[2, 9]
|
105
|
-
when 1910, 1929, 1994, 2013, 2024, 2043
|
106
|
-
[2, 10]
|
107
|
-
when 1918, 1937, 1975, 2032
|
108
|
-
[2, 11]
|
109
|
-
when 1956, 2002, 2021, 2040
|
110
|
-
[2, 12]
|
111
|
-
when 1907, 1926, 1945, 1964, 1983, 2029
|
112
|
-
[2, 13]
|
113
|
-
when 1915, 1934, 1953, 2010, 2048
|
114
|
-
[2, 14]
|
115
|
-
when 1942, 1961, 1972, 1991, 2037
|
116
|
-
[2, 15]
|
117
|
-
when 1904, 1923, 1980, 1999, 2018
|
118
|
-
[2, 16]
|
119
|
-
when 1931, 1950, 1969, 1988, 2026, 2045
|
120
|
-
[2, 17]
|
121
|
-
when 1912, 1958, 1977, 2007
|
122
|
-
[2, 18]
|
123
|
-
when 1901, 1939, 1996, 2015, 2034
|
124
|
-
[2, 19]
|
125
|
-
when 1920, 1985
|
126
|
-
[2, 20]
|
127
|
-
end
|
128
|
-
Date.civil(year, month_day[0], month_day[1])
|
129
|
-
|
130
|
-
kr_buddahs_birthday:
|
131
|
-
arguments: year
|
132
|
-
source: |
|
133
|
-
month_day = case year
|
134
|
-
when 2039
|
135
|
-
[4, 30]
|
136
|
-
when 1952, 1963, 1982
|
137
|
-
[5, 1]
|
138
|
-
when 1914, 1933, 1971, 1990, 2009, 2028, 2047
|
139
|
-
[5, 2]
|
140
|
-
when 1941, 1960, 1979, 1998, 2017, 2036
|
141
|
-
[5, 3]
|
142
|
-
when 1901, 1903, 1922, 1968
|
143
|
-
[5, 4]
|
144
|
-
when 1949, 1987, 2006, 2012, 2025, 2044
|
145
|
-
[5, 5]
|
146
|
-
when 1911, 1930, 1976, 2014, 2033
|
147
|
-
[5, 6]
|
148
|
-
when 1908, 1919, 1957, 1995, 2041
|
149
|
-
[5, 7]
|
150
|
-
when 1927, 1946, 1965, 1984, 2003, 2022
|
151
|
-
[5, 8]
|
152
|
-
when 1916, 2030, 2049
|
153
|
-
[5, 9]
|
154
|
-
when 1935, 1954, 1973, 1992, 2011
|
155
|
-
[5, 10]
|
156
|
-
when 1905, 1924, 1943, 1962, 1981, 2000, 2038
|
157
|
-
[5, 11]
|
158
|
-
when 1970, 1989, 2008, 2019
|
159
|
-
[5, 12]
|
160
|
-
when 1913, 1932, 1951, 2027
|
161
|
-
[5, 13]
|
162
|
-
when 1938, 1940, 1978, 1997, 2016
|
163
|
-
[5, 14]
|
164
|
-
when 1902, 1921, 1959, 2005, 2024, 2035
|
165
|
-
[5, 15]
|
166
|
-
when 1910, 1929, 1948, 1967, 1986, 2032, 2043
|
167
|
-
[5, 16]
|
168
|
-
when 1918, 1937, 1956, 2013
|
169
|
-
[5, 17]
|
170
|
-
when 1975, 1994, 2040
|
171
|
-
[5, 18]
|
172
|
-
when 1907, 1926, 1945, 1964, 2002, 2021
|
173
|
-
[5, 19]
|
174
|
-
when 1934, 1953, 1972, 1983, 2029, 2046, 2048
|
175
|
-
[5, 20]
|
176
|
-
when 1915, 1980, 1991, 2010
|
177
|
-
[5, 21]
|
178
|
-
when 1904, 1942, 1961, 1999, 2018, 2037
|
179
|
-
[5, 22]
|
180
|
-
when 1923, 1969, 1988
|
181
|
-
[5, 23]
|
182
|
-
when 1912, 1931, 1950, 1996, 2007, 2026, 2045
|
183
|
-
[5, 24]
|
184
|
-
when 1920, 1977, 2015, 2034
|
185
|
-
[5, 25]
|
186
|
-
when 1909, 1928, 1939, 1947, 1958, 2004, 2023, 2042
|
187
|
-
[5, 26]
|
188
|
-
when 1966, 1985
|
189
|
-
[5, 27]
|
190
|
-
when 1917, 1936, 1993, 2031, 2050
|
191
|
-
[5, 28]
|
192
|
-
when 1925, 1944, 1955, 1974
|
193
|
-
[5, 29]
|
194
|
-
when 1906, 2001, 2020
|
195
|
-
[5, 30]
|
196
|
-
end
|
197
|
-
Date.civil(year, month_day[0], month_day[1])
|
198
|
-
|
199
|
-
kr_thanksgiving:
|
200
|
-
arguments: year
|
201
|
-
source: |
|
202
|
-
month_day = case year
|
203
|
-
when 1905, 1924, 1973
|
204
|
-
[9, 8]
|
205
|
-
when 1913, 1970, 1989, 2000, 2008, 2019, 2038
|
206
|
-
[9, 10]
|
207
|
-
when 1902, 1932, 1938, 1981, 2027
|
208
|
-
[9, 11]
|
209
|
-
when 1929, 1940, 1951, 1978, 2016, 2035
|
210
|
-
[9, 12]
|
211
|
-
when 1921, 1948, 1959, 1997, 2024
|
212
|
-
[9, 13]
|
213
|
-
when 1910, 1975, 2005
|
214
|
-
[9, 14]
|
215
|
-
when 1918, 1937, 1945, 1967, 1986, 2032, 2043
|
216
|
-
[9, 15]
|
217
|
-
when 1907, 1964, 1994, 2013, 2040
|
218
|
-
[9, 16]
|
219
|
-
when 1926, 1956, 1962, 1972, 2046, 2048
|
220
|
-
[9, 17]
|
221
|
-
when 1934, 1953, 2002, 2021
|
222
|
-
[9, 18]
|
223
|
-
when 1904, 1915, 1980, 2010, 2029
|
224
|
-
[9, 19]
|
225
|
-
when 1923, 1969, 1983, 1991, 1999
|
226
|
-
[9, 20]
|
227
|
-
when 1942, 1961, 1988, 2037
|
228
|
-
[9, 21]
|
229
|
-
when 1912, 1977 ,1996, 2007, 2015, 2018, 2026
|
230
|
-
[9, 22]
|
231
|
-
when 1931, 1939, 1950
|
232
|
-
[9, 23]
|
233
|
-
when 1909, 1920, 1947, 1958, 2034, 2045
|
234
|
-
[9, 24]
|
235
|
-
when 1917, 1928, 1936, 1966, 1985, 2050
|
236
|
-
[9, 25]
|
237
|
-
when 2001, 2004, 2023, 2042
|
238
|
-
[9, 26]
|
239
|
-
when 1906, 1925, 1944, 1955, 1974, 1993, 2031
|
240
|
-
[9, 27]
|
241
|
-
when 1914, 1963, 1971, 2009
|
242
|
-
[9, 28]
|
243
|
-
when 1933, 1952, 1982, 2020
|
244
|
-
[9, 29]
|
245
|
-
when 1941, 1979, 1990, 2017, 2028, 2036, 2047
|
246
|
-
[9, 30]
|
247
|
-
when 1901, 1960, 1968, 1987, 2006
|
248
|
-
[10, 1]
|
249
|
-
when 1903, 1922, 1949, 1998
|
250
|
-
[10, 2]
|
251
|
-
when 1911, 1976, 2014, 2033, 2044
|
252
|
-
[10, 3]
|
253
|
-
when 1927, 1930, 2012, 2025, 2041
|
254
|
-
[10, 4]
|
255
|
-
when 1908, 1919, 1935, 1946, 1957, 1995, 2039
|
256
|
-
[10, 5]
|
257
|
-
when 1916, 1965, 2003, 2022, 2030, 2049
|
258
|
-
[10, 6]
|
259
|
-
when 1984
|
260
|
-
[10, 7]
|
261
|
-
when 1943, 1954, 1992
|
262
|
-
[10, 8]
|
263
|
-
when 2011
|
264
|
-
[10, 9]
|
265
|
-
end
|
266
|
-
Date.civil(year, month_day[0], month_day[1])
|
267
|
-
|
268
|
-
tests: |
|
269
|
-
{Date.civil(2016,2,8) => "Korean New Year",
|
270
|
-
Date.civil(2016,5,14) => "Buddah\'s Birthday",
|
271
|
-
Date.civil(2016,9,12) => "Korean Thanksgiving",
|
272
|
-
Date.civil(2016,1,1) => "New Year\'s Day",
|
273
|
-
Date.civil(2016,3,1) => "Independence Movement Day",
|
274
|
-
Date.civil(2016,5,5) => "Children\'s Day",
|
275
|
-
Date.civil(2016,6,6) => "Memorial Day",
|
276
|
-
Date.civil(2016,7,17) => "Constitution Day",
|
277
|
-
Date.civil(2016,8,15) => "Liberation Day",
|
278
|
-
Date.civil(2016,10,3) => "National Foundation Day",
|
279
|
-
Date.civil(2016,10,9) => "Hangul Day",
|
280
|
-
Date.civil(2016,12,25) => "Christmas Day"}.each do |date, name|
|
281
|
-
assert_equal name, (Holidays.on(date, :kr, :informal)[0] || {})[:name]
|
282
|
-
end
|