holidays 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/definitions/bg.yaml +121 -0
- data/definitions/ie.yaml +9 -7
- data/definitions/index.yaml +2 -1
- data/definitions/jp.yaml +30 -5
- data/holidays.gemspec +3 -3
- data/lib/generated_definitions/MANIFEST +1 -0
- data/lib/generated_definitions/REGIONS.rb +1 -1
- data/lib/generated_definitions/bg.rb +58 -0
- data/lib/generated_definitions/europe.rb +44 -13
- data/lib/generated_definitions/ie.rb +5 -4
- data/lib/generated_definitions/jp.rb +9 -0
- data/lib/holidays.rb +6 -2
- data/lib/holidays/date_calculator/easter.rb +78 -45
- data/lib/holidays/date_calculator_factory.rb +17 -3
- data/lib/holidays/version.rb +1 -1
- data/test/defs/test_defs_bg.rb +29 -0
- data/test/defs/test_defs_europe.rb +24 -4
- data/test/defs/test_defs_ie.rb +4 -3
- data/test/defs/test_defs_jp.rb +14 -3
- data/test/holidays/date_calculator/{test_easter.rb → test_easter_gregorian.rb} +3 -2
- data/test/holidays/date_calculator/test_easter_julian.rb +36 -0
- data/test/holidays/test_date_calculator_factory.rb +8 -2
- metadata +13 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8163efff2a1958efde569df594a88eff3591a29
|
4
|
+
data.tar.gz: bade55a0a1439014f2e72672234616be869d8850
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e6774064fe5a174bbc967c8803e9dc082ae4f7222982e72605c03614d6403bdbcb7685837242bda435abe228d8e26d4a64316cd9971a641b9c9080c13d1727b
|
7
|
+
data.tar.gz: 72fe72dca4258d0a559d63de3651528c8d4e781fe366a5829dad46d510ad393fd0fbb7c9dd4f3b2590cf31f11ec4ea2315267c234fc72fc81214c3e0261a6744
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Ruby Holidays Gem CHANGELOG
|
2
2
|
|
3
|
+
## 3.1.0
|
4
|
+
|
5
|
+
* Fix St. Stephen observance holiday for Ireland (https://github.com/gumchum)
|
6
|
+
* Add Bulgarian holidays (https://github.com/thekazak)
|
7
|
+
* Add new mountain holiday for Japan (https://github.com/ttwo32)
|
8
|
+
* Add ability to calculate Easter in either Gregorian (existing) or Julian (new) dates
|
9
|
+
|
3
10
|
## 3.0.0
|
4
11
|
|
5
12
|
* Major refactor! Lots of code moved around and some methods were removed from the public api (they were never intended to be public).
|
data/definitions/bg.yaml
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
# Bulgaria holiday definitions for the Ruby Holiday gem.
|
2
|
+
#
|
3
|
+
# Updated: 2015-04-01.
|
4
|
+
# Source: http://en.wikipedia.org/wiki/Public_holidays_in_Bulgaria
|
5
|
+
---
|
6
|
+
months:
|
7
|
+
0:
|
8
|
+
- name: Good Friday
|
9
|
+
regions: [bg_en]
|
10
|
+
function: orthodox_easter_julian(year)-2
|
11
|
+
- name: Разпети петък
|
12
|
+
regions: [bg_bg]
|
13
|
+
function: orthodox_easter_julian(year)-2
|
14
|
+
- name: Holy Saturday
|
15
|
+
regions: [bg_en]
|
16
|
+
function: orthodox_easter_julian(year)-1
|
17
|
+
- name: Велика събота
|
18
|
+
regions: [bg_bg]
|
19
|
+
function: orthodox_easter_julian(year)-1
|
20
|
+
- name: Easter Sunday
|
21
|
+
regions: [bg_en]
|
22
|
+
function: orthodox_easter_julian(year)
|
23
|
+
- name: Възкресение Христово. Великден
|
24
|
+
regions: [bg_bg]
|
25
|
+
function: orthodox_easter_julian(year)
|
26
|
+
- name: Easter Monday
|
27
|
+
regions: [bg_en]
|
28
|
+
function: orthodox_easter_julian(year)+1
|
29
|
+
- name: Възкресение Христово. Великден
|
30
|
+
regions: [bg_bg]
|
31
|
+
function: orthodox_easter_julian(year)+1
|
32
|
+
1:
|
33
|
+
- name: New Year's Day
|
34
|
+
regions: [bg_en]
|
35
|
+
mday: 1
|
36
|
+
- name: Нова година
|
37
|
+
regions: [bg_bg]
|
38
|
+
mday: 1
|
39
|
+
3:
|
40
|
+
- name: Liberation Day
|
41
|
+
regions: [bg_en]
|
42
|
+
mday: 3
|
43
|
+
- name: Освобожението на България
|
44
|
+
regions: [bg_bg]
|
45
|
+
mday: 3
|
46
|
+
5:
|
47
|
+
- name: Labour Day
|
48
|
+
regions: [bg_en]
|
49
|
+
mday: 1
|
50
|
+
- name: Ден на труда
|
51
|
+
regions: [bg_bg]
|
52
|
+
mday: 1
|
53
|
+
- name: St. George's Day
|
54
|
+
regions: [bg_en]
|
55
|
+
mday: 6
|
56
|
+
- name: Гергьовден. Ден на храбростта
|
57
|
+
regions: [bg_bg]
|
58
|
+
mday: 6
|
59
|
+
- name: Slavic Literacy Day
|
60
|
+
regions: [bg_en]
|
61
|
+
mday: 24
|
62
|
+
- name: Ден на славянската писменост
|
63
|
+
regions: [bg_bg]
|
64
|
+
mday: 24
|
65
|
+
9:
|
66
|
+
- name: Unification Day
|
67
|
+
regions: [bg_en]
|
68
|
+
mday: 6
|
69
|
+
- name: Ден на Съединението
|
70
|
+
regions: [bg_bg]
|
71
|
+
mday: 6
|
72
|
+
- name: The Independence Day
|
73
|
+
regions: [bg_en]
|
74
|
+
mday: 22
|
75
|
+
- name: Ден на Независимостта
|
76
|
+
regions: [bg_bg]
|
77
|
+
mday: 22
|
78
|
+
11:
|
79
|
+
- name: Revival Leader's Day
|
80
|
+
regions: [bg_en]
|
81
|
+
mday: 1
|
82
|
+
- name: Ден на Народните будители
|
83
|
+
regions: [bg_bg]
|
84
|
+
mday: 1
|
85
|
+
12:
|
86
|
+
- name: Christmas Eve
|
87
|
+
regions: [bg_en]
|
88
|
+
mday: 24
|
89
|
+
- name: Бъдни вечер
|
90
|
+
regions: [bg_bg]
|
91
|
+
mday: 24
|
92
|
+
- name: Christmas
|
93
|
+
regions: [bg_en]
|
94
|
+
mday: 25
|
95
|
+
- name: Рождество Христово. Коледа
|
96
|
+
regions: [bg_bg]
|
97
|
+
mday: 25
|
98
|
+
- name: Christmas
|
99
|
+
regions: [bg_en]
|
100
|
+
mday: 26
|
101
|
+
- name: Рождество Христово. Коледа
|
102
|
+
regions: [bg_bg]
|
103
|
+
mday: 26
|
104
|
+
tests: |
|
105
|
+
{Date.civil(2015,1,1) => "New Year's Day",
|
106
|
+
Date.civil(2015,3,3) => "Liberation Day",
|
107
|
+
Date.civil(2015,3,28) => "Good Friday",
|
108
|
+
Date.civil(2015,3,29) => "Holy Saturday",
|
109
|
+
Date.civil(2015,3,30) => "Easter Sunday",
|
110
|
+
Date.civil(2015,3,31) => "Easter Monday",
|
111
|
+
Date.civil(2015,5,1) => "Labour Day",
|
112
|
+
Date.civil(2015,5,6) => "St. George's Day",
|
113
|
+
Date.civil(2015,5,24) => "Slavic Literacy Day",
|
114
|
+
Date.civil(2015,9,6) => "Unification Day",
|
115
|
+
Date.civil(2015,9,22) => "The Independence Day",
|
116
|
+
Date.civil(2015,11,1) => "Revival Leader's Day",
|
117
|
+
Date.civil(2015,12,24) => "Christmas Eve",
|
118
|
+
Date.civil(2015,12,25) => "Christmas",
|
119
|
+
Date.civil(2015,12,26) => "Christmas"}.each do |date, name|
|
120
|
+
assert_equal name, (Holidays.on(date, :bg_en)[0] || {})[:name]
|
121
|
+
end
|
data/definitions/ie.yaml
CHANGED
@@ -54,13 +54,14 @@ methods:
|
|
54
54
|
ie_st_stephens_day: |
|
55
55
|
# Ireland - Stephens Day is always the day after christmas day
|
56
56
|
def self.ie_st_stephens_day(date)
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
date
|
57
|
+
case date.wday
|
58
|
+
when 6, 0 then date + 2
|
59
|
+
when 1 then date + 1
|
60
|
+
else date
|
61
|
+
end
|
61
62
|
end
|
62
63
|
tests: |
|
63
|
-
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
64
|
+
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
64
65
|
Date.civil(2008,3,17) => 'St. Patrick\'s Day',
|
65
66
|
Date.civil(2008,3,24) => 'Easter Monday',
|
66
67
|
Date.civil(2008,5,5) => 'May Day',
|
@@ -71,7 +72,7 @@ tests: |
|
|
71
72
|
Date.civil(2008,12,26) => 'St. Stephen\'s Day'}.each do |date, name|
|
72
73
|
assert_equal name, (Holidays.on(date, :ie)[0] || {})[:name]
|
73
74
|
end
|
74
|
-
{Date.civil(2012,1,2) => 'New Year\'s Day',
|
75
|
+
{Date.civil(2012,1,2) => 'New Year\'s Day',
|
75
76
|
Date.civil(2012,3,19) => 'St. Patrick\'s Day',
|
76
77
|
Date.civil(2012,4,9) => 'Easter Monday',
|
77
78
|
Date.civil(2012,5,7) => 'May Day',
|
@@ -81,6 +82,7 @@ tests: |
|
|
81
82
|
Date.civil(2011,12,26) => 'Christmas Day',
|
82
83
|
Date.civil(2011,12,27) => 'St. Stephen\'s Day',
|
83
84
|
Date.civil(2012,12,25) => 'Christmas Day',
|
84
|
-
Date.civil(2012,12,26) => 'St. Stephen\'s Day'
|
85
|
+
Date.civil(2012,12,26) => 'St. Stephen\'s Day',
|
86
|
+
Date.civil(2015,12,28) => 'St. Stephen\'s Day'}.each do |date, name|
|
85
87
|
assert_equal name, (Holidays.on(date, :ie, :observed)[0] || {})[:name]
|
86
88
|
end
|
data/definitions/index.yaml
CHANGED
@@ -6,6 +6,7 @@ defs:
|
|
6
6
|
AU: ['au.yaml']
|
7
7
|
BE: ['be.yaml']
|
8
8
|
BR: ['br.yaml']
|
9
|
+
BG: ['bg.yaml']
|
9
10
|
CA: ['ca.yaml', 'north_america_informal.yaml']
|
10
11
|
CH: ['ch.yaml']
|
11
12
|
CL: ['cl.yaml']
|
@@ -46,7 +47,7 @@ defs:
|
|
46
47
|
ZA: ['za.yaml']
|
47
48
|
North_America: ['ca.yaml', 'mx.yaml', 'us.yaml', 'north_america_informal.yaml']
|
48
49
|
Scandinavia: ['dk.yaml', 'is.yaml', 'no.yaml', 'se.yaml', 'fi.yaml']
|
49
|
-
Europe: ['at.yaml', 'be.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']
|
50
|
+
Europe: ['at.yaml', 'be.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']
|
50
51
|
JP: ['jp.yaml']
|
51
52
|
VE: ['ve.yaml']
|
52
53
|
VI: ['vi.yaml']
|
data/definitions/jp.yaml
CHANGED
@@ -10,7 +10,8 @@
|
|
10
10
|
# 2010-12-25: Initial version by Tatsuki Sugiura <sugi@nemui.org>
|
11
11
|
# 2014-11-09: Added substitute holiday by Yoshiyuki Hirano <yoshiyuki.hirano@henteco-labs.com>
|
12
12
|
# 2015-05-10: Non-Monday substitute holidays by Shuhei Kagawa <shuhei.kagawa@gmail.com>
|
13
|
-
#
|
13
|
+
# 2015-12-15: Added mountain day by Tsuyoshi Sano <ttwo32@gmail.com>
|
14
|
+
#
|
14
15
|
---
|
15
16
|
months:
|
16
17
|
1:
|
@@ -72,6 +73,13 @@ months:
|
|
72
73
|
- name: 振替休日
|
73
74
|
regions: [jp]
|
74
75
|
function: jp_substitute_holiday(year, 7, Holidays.calculate_day_of_month(year, 7, 3, 1))
|
76
|
+
8:
|
77
|
+
- name: 山の日
|
78
|
+
regions: [jp]
|
79
|
+
function: jp_mountain_holiday(year)
|
80
|
+
- name: 振替休日
|
81
|
+
regions: [jp]
|
82
|
+
function: jp_substitute_holiday(Holidays.jp_mountain_holiday(year))
|
75
83
|
9:
|
76
84
|
- name: 敬老の日
|
77
85
|
regions: [jp]
|
@@ -166,8 +174,14 @@ methods:
|
|
166
174
|
nil
|
167
175
|
end
|
168
176
|
end
|
177
|
+
jp_mountain_holiday: |
|
178
|
+
def self.jp_mountain_holiday(year)
|
179
|
+
return nil if year < 2016
|
180
|
+
Date.civil(year, 8, 11)
|
181
|
+
end
|
169
182
|
jp_substitute_holiday: |
|
170
183
|
def self.jp_substitute_holiday(*date)
|
184
|
+
return nil unless date[0]
|
171
185
|
date = date[0].kind_of?(Date) ? date.first : Date.civil(*date)
|
172
186
|
date.wday == 0 ? Holidays.jp_next_weekday(date+1) : nil
|
173
187
|
end
|
@@ -179,8 +193,8 @@ methods:
|
|
179
193
|
date.wday == 0 || is_holiday ? Holidays.jp_next_weekday(date+1) : date
|
180
194
|
end
|
181
195
|
tests: |
|
182
|
-
{Date.civil(2008,1,1) => '元日',
|
183
|
-
Date.civil(2010,1,11) => '成人の日',
|
196
|
+
{Date.civil(2008,1,1) => '元日',
|
197
|
+
Date.civil(2010,1,11) => '成人の日',
|
184
198
|
Date.civil(2008,2,11) => '建国記念日',
|
185
199
|
Date.civil(2008,4,29) => '昭和の日',
|
186
200
|
Date.civil(2008,5,3) => '憲法記念日',
|
@@ -196,11 +210,12 @@ tests: |
|
|
196
210
|
Date.civil(2012,1,2) => '振替休日',
|
197
211
|
Date.civil(2013,5,6) => '振替休日',
|
198
212
|
Date.civil(2014,5,6) => '振替休日',
|
199
|
-
Date.civil(2015,5,6) => '振替休日'
|
213
|
+
Date.civil(2015,5,6) => '振替休日',
|
214
|
+
Date.civil(2019,8,12) => '振替休日'
|
200
215
|
}.each do |date, name|
|
201
216
|
assert_equal name, (Holidays.on(date, :jp, :informal)[0] || {})[:name]
|
202
217
|
end
|
203
|
-
|
218
|
+
|
204
219
|
# vernal equinox day
|
205
220
|
[Date.civil(2004,3,20), Date.civil(2005,3,20), Date.civil(2006,3,21),
|
206
221
|
Date.civil(2007,3,21), Date.civil(2008,3,20), Date.civil(2009,3,20),
|
@@ -221,3 +236,13 @@ tests: |
|
|
221
236
|
Date.civil(2015,9,22), Date.civil(2026,9,22)].each do |date|
|
222
237
|
assert_equal '国民の休日', Holidays.on(date, :jp)[0][:name]
|
223
238
|
end
|
239
|
+
|
240
|
+
# mountain holiday start since 2016
|
241
|
+
[Date.civil(2016,8,11), Date.civil(2017,8,11),Date.civil(2018,8,11),
|
242
|
+
Date.civil(2019,8,11), Date.civil(2020,8,11),Date.civil(2021,8,11),
|
243
|
+
Date.civil(2022,8,11)].each do |date|
|
244
|
+
assert_equal '山の日', Holidays.on(date, :jp)[0][:name]
|
245
|
+
end
|
246
|
+
|
247
|
+
# before 2016, there is no mountain holiday.
|
248
|
+
assert_nil Date.civil(2015,8,11).holidays(:jp)[0]
|
data/holidays.gemspec
CHANGED
@@ -7,9 +7,9 @@ require 'holidays/version'
|
|
7
7
|
Gem::Specification.new do |gem|
|
8
8
|
gem.name = 'holidays'
|
9
9
|
gem.version = Holidays::VERSION
|
10
|
-
gem.authors = ['Alex Dunae']
|
11
|
-
gem.email = ['code@dunae.ca']
|
12
|
-
gem.homepage = 'https://github.com/
|
10
|
+
gem.authors = ['Alex Dunae', 'Phil Trimble']
|
11
|
+
gem.email = ['code@dunae.ca', 'holidaysgem@gmail.com']
|
12
|
+
gem.homepage = 'https://github.com/holidays/holidays'
|
13
13
|
gem.description = %q(A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!)
|
14
14
|
gem.summary = %q(A collection of Ruby methods to deal with statutory and other holidays.)
|
15
15
|
gem.files = `git ls-files`.split("\n") - ['.gitignore', '.travis.yml', '.coveralls.yml']
|
@@ -6,6 +6,7 @@ The following definition files are included in this installation:
|
|
6
6
|
* generated_definitions/at
|
7
7
|
* generated_definitions/au
|
8
8
|
* generated_definitions/be
|
9
|
+
* generated_definitions/bg
|
9
10
|
* generated_definitions/br
|
10
11
|
* generated_definitions/ca
|
11
12
|
* generated_definitions/ch
|
@@ -1,4 +1,4 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
module Holidays
|
3
|
-
REGIONS = [:ar, :at, :au, :au_nsw, :au_vic, :au_qld, :au_nt, :au_act, :au_sa, :au_tas_south, :au_wa, :au_tas, :au_qld_cairns, :au_qld_brisbane, :au_tas_north, :au_vic_melbourne, :be, :br, :ca, :ca_qc, :ca_ab, :ca_on, :ca_sk, :ca_mb, :ca_ns, :ca_pe, :ca_bc, :ca_nf, :ca_nt, :ca_nu, :ca_nb, :ca_yk, :us, :ch_zh, :ch_be, :ch_lu, :ch_ur, :ch_sz, :ch_ow, :ch_nw, :ch_gl, :ch_zg, :ch_fr, :ch_so, :ch_bs, :ch_bl, :ch_sh, :ch_ar, :ch_ai, :ch_sg, :ch_gr, :ch_ag, :ch_tg, :ch_ti, :ch_vd, :ch_ne, :ch_ge, :ch_ju, :ch_vs, :ch, :cl, :cr, :cz, :dk, :de, :de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_st, :de_by_aux, :de_bb, :de_mv, :de_sn, :de_th, :ecb_target, :el, :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, :es_ct, :es_v, :es_vc, :federal_reserve, :fedex, :fi, :fr, :gb, :gb_eng, :gb_wls, :gb_eaw, :gb_nir, :gb_sct, :gb_con, :je, :gb_jsy, :gg, :gb_gsy, :im, :gb_iom, :hr, :hu, :ie, :is, :it, :li, :lt, :ma, :mx, :mx_pue, :us, :ca, :nerc, :nl, :no, :nyse, :nz, :nz_sl, :nz_we, :nz_ak, :nz_nl, :nz_ne, :nz_ot, :nz_ta, :nz_sc, :nz_hb, :nz_mb, :nz_ca, :nz_ch, :nz_wl, :ph, :pl, :pt, :ro, :se, :us, :us_dc, :us_ca, :ca, :united_nations, :ups, :za, :ca, :ca_qc, :ca_ab, :ca_on, :ca_sk, :ca_mb, :ca_ns, :ca_pe, :ca_bc, :ca_nf, :ca_nt, :ca_nu, :ca_nb, :ca_yk, :mx, :mx_pue, :us, :us_dc, :us_ca, :dk, :is, :no, :se, :fi, :at, :be, :ch_zh, :ch_be, :ch_lu, :ch_ur, :ch_sz, :ch_ow, :ch_nw, :ch_gl, :ch_zg, :ch_fr, :ch_so, :ch_bs, :ch_bl, :ch_sh, :ch_ar, :ch_ai, :ch_sg, :ch_gr, :ch_ag, :ch_tg, :ch_ti, :ch_vd, :ch_ne, :ch_ge, :ch_ju, :ch_vs, :ch, :cz, :dk, :de, :de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_st, :de_by_aux, :de_bb, :de_mv, :de_sn, :de_th, :el, :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, :es_ct, :es_v, :es_vc, :fr, :gb, :gb_eng, :gb_wls, :gb_eaw, :gb_nir, :gb_sct, :gb_con, :je, :gb_jsy, :gg, :gb_gsy, :im, :gb_iom, :hr, :hu, :ie, :is, :it, :li, :lt, :nl, :no, :pl, :pt, :ro, :sk, :si, :jp, :ve, :vi, :sk, :si, :sg]
|
3
|
+
REGIONS = [:ar, :at, :au, :au_nsw, :au_vic, :au_qld, :au_nt, :au_act, :au_sa, :au_tas_south, :au_wa, :au_tas, :au_qld_cairns, :au_qld_brisbane, :au_tas_north, :au_vic_melbourne, :be, :br, :bg_en, :bg_bg, :ca, :ca_qc, :ca_ab, :ca_on, :ca_sk, :ca_mb, :ca_ns, :ca_pe, :ca_bc, :ca_nf, :ca_nt, :ca_nu, :ca_nb, :ca_yk, :us, :ch_zh, :ch_be, :ch_lu, :ch_ur, :ch_sz, :ch_ow, :ch_nw, :ch_gl, :ch_zg, :ch_fr, :ch_so, :ch_bs, :ch_bl, :ch_sh, :ch_ar, :ch_ai, :ch_sg, :ch_gr, :ch_ag, :ch_tg, :ch_ti, :ch_vd, :ch_ne, :ch_ge, :ch_ju, :ch_vs, :ch, :cl, :cr, :cz, :dk, :de, :de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_st, :de_by_aux, :de_bb, :de_mv, :de_sn, :de_th, :ecb_target, :el, :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, :es_ct, :es_v, :es_vc, :federal_reserve, :fedex, :fi, :fr, :gb, :gb_eng, :gb_wls, :gb_eaw, :gb_nir, :gb_sct, :gb_con, :je, :gb_jsy, :gg, :gb_gsy, :im, :gb_iom, :hr, :hu, :ie, :is, :it, :li, :lt, :ma, :mx, :mx_pue, :us, :ca, :nerc, :nl, :no, :nyse, :nz, :nz_sl, :nz_we, :nz_ak, :nz_nl, :nz_ne, :nz_ot, :nz_ta, :nz_sc, :nz_hb, :nz_mb, :nz_ca, :nz_ch, :nz_wl, :ph, :pl, :pt, :ro, :se, :us, :us_dc, :us_ca, :ca, :united_nations, :ups, :za, :ca, :ca_qc, :ca_ab, :ca_on, :ca_sk, :ca_mb, :ca_ns, :ca_pe, :ca_bc, :ca_nf, :ca_nt, :ca_nu, :ca_nb, :ca_yk, :mx, :mx_pue, :us, :us_dc, :us_ca, :dk, :is, :no, :se, :fi, :at, :be, :ch_zh, :ch_be, :ch_lu, :ch_ur, :ch_sz, :ch_ow, :ch_nw, :ch_gl, :ch_zg, :ch_fr, :ch_so, :ch_bs, :ch_bl, :ch_sh, :ch_ar, :ch_ai, :ch_sg, :ch_gr, :ch_ag, :ch_tg, :ch_ti, :ch_vd, :ch_ne, :ch_ge, :ch_ju, :ch_vs, :ch, :cz, :dk, :de, :de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_st, :de_by_aux, :de_bb, :de_mv, :de_sn, :de_th, :el, :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, :es_ct, :es_v, :es_vc, :fr, :gb, :gb_eng, :gb_wls, :gb_eaw, :gb_nir, :gb_sct, :gb_con, :je, :gb_jsy, :gg, :gb_gsy, :im, :gb_iom, :hr, :hu, :ie, :is, :it, :li, :lt, :nl, :no, :pl, :pt, :ro, :sk, :si, :bg_en, :bg_bg, :jp, :ve, :vi, :sk, :si, :sg]
|
4
4
|
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module Holidays
|
3
|
+
# This file is generated by the Ruby Holidays gem.
|
4
|
+
#
|
5
|
+
# Definitions loaded: definitions/bg.yaml
|
6
|
+
#
|
7
|
+
# To use the definitions in this file, load it right after you load the
|
8
|
+
# Holiday gem:
|
9
|
+
#
|
10
|
+
# require 'holidays'
|
11
|
+
# require 'generated_definitions/bg'
|
12
|
+
#
|
13
|
+
# All the definitions are available at https://github.com/alexdunae/holidays
|
14
|
+
module BG # :nodoc:
|
15
|
+
def self.defined_regions
|
16
|
+
[:bg_en, :bg_bg]
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.holidays_by_month
|
20
|
+
{
|
21
|
+
0 => [{:function => lambda { |year| Holidays.orthodox_easter_julian(year)-2 }, :function_id => "orthodox_easter_julian(year)-2", :name => "Good Friday", :regions => [:bg_en]},
|
22
|
+
{:function => lambda { |year| Holidays.orthodox_easter_julian(year)-2 }, :function_id => "orthodox_easter_julian(year)-2", :name => "Разпети петък", :regions => [:bg_bg]},
|
23
|
+
{:function => lambda { |year| Holidays.orthodox_easter_julian(year)-1 }, :function_id => "orthodox_easter_julian(year)-1", :name => "Holy Saturday", :regions => [:bg_en]},
|
24
|
+
{:function => lambda { |year| Holidays.orthodox_easter_julian(year)-1 }, :function_id => "orthodox_easter_julian(year)-1", :name => "Велика събота", :regions => [:bg_bg]},
|
25
|
+
{:function => lambda { |year| Holidays.orthodox_easter_julian(year) }, :function_id => "orthodox_easter_julian(year)", :name => "Easter Sunday", :regions => [:bg_en]},
|
26
|
+
{:function => lambda { |year| Holidays.orthodox_easter_julian(year) }, :function_id => "orthodox_easter_julian(year)", :name => "Възкресение Христово. Великден", :regions => [:bg_bg]},
|
27
|
+
{:function => lambda { |year| Holidays.orthodox_easter_julian(year)+1 }, :function_id => "orthodox_easter_julian(year)+1", :name => "Easter Monday", :regions => [:bg_en]},
|
28
|
+
{:function => lambda { |year| Holidays.orthodox_easter_julian(year)+1 }, :function_id => "orthodox_easter_julian(year)+1", :name => "Възкресение Христово. Великден", :regions => [:bg_bg]}],
|
29
|
+
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:bg_en]},
|
30
|
+
{:mday => 1, :name => "Нова година", :regions => [:bg_bg]}],
|
31
|
+
3 => [{:mday => 3, :name => "Liberation Day", :regions => [:bg_en]},
|
32
|
+
{:mday => 3, :name => "Освобожението на България", :regions => [:bg_bg]}],
|
33
|
+
5 => [{:mday => 1, :name => "Labour Day", :regions => [:bg_en]},
|
34
|
+
{:mday => 1, :name => "Ден на труда", :regions => [:bg_bg]},
|
35
|
+
{:mday => 6, :name => "St. George's Day", :regions => [:bg_en]},
|
36
|
+
{:mday => 6, :name => "Гергьовден. Ден на храбростта", :regions => [:bg_bg]},
|
37
|
+
{:mday => 24, :name => "Slavic Literacy Day", :regions => [:bg_en]},
|
38
|
+
{:mday => 24, :name => "Ден на славянската писменост", :regions => [:bg_bg]}],
|
39
|
+
9 => [{:mday => 6, :name => "Unification Day", :regions => [:bg_en]},
|
40
|
+
{:mday => 6, :name => "Ден на Съединението", :regions => [:bg_bg]},
|
41
|
+
{:mday => 22, :name => "The Independence Day", :regions => [:bg_en]},
|
42
|
+
{:mday => 22, :name => "Ден на Независимостта", :regions => [:bg_bg]}],
|
43
|
+
11 => [{:mday => 1, :name => "Revival Leader's Day", :regions => [:bg_en]},
|
44
|
+
{:mday => 1, :name => "Ден на Народните будители", :regions => [:bg_bg]}],
|
45
|
+
12 => [{:mday => 24, :name => "Christmas Eve", :regions => [:bg_en]},
|
46
|
+
{:mday => 24, :name => "Бъдни вечер", :regions => [:bg_bg]},
|
47
|
+
{:mday => 25, :name => "Christmas", :regions => [:bg_en]},
|
48
|
+
{:mday => 25, :name => "Рождество Христово. Коледа", :regions => [:bg_bg]},
|
49
|
+
{:mday => 26, :name => "Christmas", :regions => [:bg_en]},
|
50
|
+
{:mday => 26, :name => "Рождество Христово. Коледа", :regions => [:bg_bg]}]
|
51
|
+
}
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
Holidays.merge_defs(Holidays::BG.defined_regions, Holidays::BG.holidays_by_month)
|
@@ -2,7 +2,7 @@
|
|
2
2
|
module Holidays
|
3
3
|
# This file is generated by the Ruby Holidays gem.
|
4
4
|
#
|
5
|
-
# Definitions loaded: definitions/at.yaml, definitions/be.yaml, definitions/ch.yaml, definitions/cz.yaml, definitions/dk.yaml, definitions/de.yaml, definitions/el.yaml, definitions/es.yaml, definitions/fr.yaml, definitions/gb.yaml, definitions/hr.yaml, definitions/hu.yaml, definitions/ie.yaml, definitions/is.yaml, definitions/it.yaml, definitions/li.yaml, definitions/lt.yaml, definitions/nl.yaml, definitions/no.yaml, definitions/pl.yaml, definitions/pt.yaml, definitions/ro.yaml, definitions/sk.yaml, definitions/si.yaml
|
5
|
+
# Definitions loaded: definitions/at.yaml, definitions/be.yaml, definitions/ch.yaml, definitions/cz.yaml, definitions/dk.yaml, definitions/de.yaml, definitions/el.yaml, definitions/es.yaml, definitions/fr.yaml, definitions/gb.yaml, definitions/hr.yaml, definitions/hu.yaml, definitions/ie.yaml, definitions/is.yaml, definitions/it.yaml, definitions/li.yaml, definitions/lt.yaml, definitions/nl.yaml, definitions/no.yaml, definitions/pl.yaml, definitions/pt.yaml, definitions/ro.yaml, definitions/sk.yaml, definitions/si.yaml, definitions/bg.yaml
|
6
6
|
#
|
7
7
|
# To use the definitions in this file, load it right after you load the
|
8
8
|
# Holiday gem:
|
@@ -13,7 +13,7 @@ module Holidays
|
|
13
13
|
# All the definitions are available at https://github.com/alexdunae/holidays
|
14
14
|
module EUROPE # :nodoc:
|
15
15
|
def self.defined_regions
|
16
|
-
[:at, :be, :ch_zh, :ch_be, :ch_lu, :ch_ur, :ch_sz, :ch_ow, :ch_nw, :ch_gl, :ch_zg, :ch_fr, :ch_so, :ch_bs, :ch_bl, :ch_sh, :ch_ar, :ch_ai, :ch_sg, :ch_gr, :ch_ag, :ch_tg, :ch_ti, :ch_vd, :ch_ne, :ch_ge, :ch_ju, :ch_vs, :ch, :cz, :dk, :de, :de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_st, :de_by_aux, :de_bb, :de_mv, :de_sn, :de_th, :el, :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, :es_ct, :es_v, :es_vc, :fr, :gb, :gb_eng, :gb_wls, :gb_eaw, :gb_nir, :gb_sct, :gb_con, :je, :gb_jsy, :gg, :gb_gsy, :im, :gb_iom, :hr, :hu, :ie, :is, :it, :li, :lt, :nl, :no, :pl, :pt, :ro, :sk, :si]
|
16
|
+
[:at, :be, :ch_zh, :ch_be, :ch_lu, :ch_ur, :ch_sz, :ch_ow, :ch_nw, :ch_gl, :ch_zg, :ch_fr, :ch_so, :ch_bs, :ch_bl, :ch_sh, :ch_ar, :ch_ai, :ch_sg, :ch_gr, :ch_ag, :ch_tg, :ch_ti, :ch_vd, :ch_ne, :ch_ge, :ch_ju, :ch_vs, :ch, :cz, :dk, :de, :de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_st, :de_by_aux, :de_bb, :de_mv, :de_sn, :de_th, :el, :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, :es_ct, :es_v, :es_vc, :fr, :gb, :gb_eng, :gb_wls, :gb_eaw, :gb_nir, :gb_sct, :gb_con, :je, :gb_jsy, :gg, :gb_gsy, :im, :gb_iom, :hr, :hu, :ie, :is, :it, :li, :lt, :nl, :no, :pl, :pt, :ro, :sk, :si, :bg_en, :bg_bg]
|
17
17
|
end
|
18
18
|
|
19
19
|
def self.holidays_by_month
|
@@ -132,7 +132,15 @@ module Holidays
|
|
132
132
|
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Veľký piatok", :regions => [:sk]},
|
133
133
|
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "velikonočna nedelja", :regions => [:si]},
|
134
134
|
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "velikonočni ponedeljek", :regions => [:si]},
|
135
|
-
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "binkošti", :regions => [:si]}
|
135
|
+
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "binkošti", :regions => [:si]},
|
136
|
+
{:function => lambda { |year| Holidays.orthodox_easter_julian(year)-2 }, :function_id => "orthodox_easter_julian(year)-2", :name => "Good Friday", :regions => [:bg_en]},
|
137
|
+
{:function => lambda { |year| Holidays.orthodox_easter_julian(year)-2 }, :function_id => "orthodox_easter_julian(year)-2", :name => "Разпети петък", :regions => [:bg_bg]},
|
138
|
+
{:function => lambda { |year| Holidays.orthodox_easter_julian(year)-1 }, :function_id => "orthodox_easter_julian(year)-1", :name => "Holy Saturday", :regions => [:bg_en]},
|
139
|
+
{:function => lambda { |year| Holidays.orthodox_easter_julian(year)-1 }, :function_id => "orthodox_easter_julian(year)-1", :name => "Велика събота", :regions => [:bg_bg]},
|
140
|
+
{:function => lambda { |year| Holidays.orthodox_easter_julian(year) }, :function_id => "orthodox_easter_julian(year)", :name => "Easter Sunday", :regions => [:bg_en]},
|
141
|
+
{:function => lambda { |year| Holidays.orthodox_easter_julian(year) }, :function_id => "orthodox_easter_julian(year)", :name => "Възкресение Христово. Великден", :regions => [:bg_bg]},
|
142
|
+
{:function => lambda { |year| Holidays.orthodox_easter_julian(year)+1 }, :function_id => "orthodox_easter_julian(year)+1", :name => "Easter Monday", :regions => [:bg_en]},
|
143
|
+
{:function => lambda { |year| Holidays.orthodox_easter_julian(year)+1 }, :function_id => "orthodox_easter_julian(year)+1", :name => "Възкресение Христово. Великден", :regions => [:bg_bg]}],
|
136
144
|
1 => [{:mday => 1, :name => "Neujahrstag", :regions => [:at]},
|
137
145
|
{:mday => 6, :name => "Heilige Drei Könige", :regions => [:at]},
|
138
146
|
{:mday => 1, :name => "Jour de l'an", :regions => [:be]},
|
@@ -174,7 +182,9 @@ module Holidays
|
|
174
182
|
{:mday => 2, :name => "Anul nou", :regions => [:ro]},
|
175
183
|
{:mday => 1, :name => "Nový rok", :regions => [:sk]},
|
176
184
|
{:mday => 6, :name => "Zjavenie Pána (Traja králi)", :regions => [:sk]},
|
177
|
-
{:mday => 1, :name => "novo leto", :regions => [:si]}
|
185
|
+
{:mday => 1, :name => "novo leto", :regions => [:si]},
|
186
|
+
{:mday => 1, :name => "New Year's Day", :regions => [:bg_en]},
|
187
|
+
{:mday => 1, :name => "Нова година", :regions => [:bg_bg]}],
|
178
188
|
5 => [{:mday => 1, :name => "Staatsfeiertag", :regions => [:at]},
|
179
189
|
{:mday => 1, :name => "Fête du travail", :regions => [:be]},
|
180
190
|
{:mday => 1, :name => "Tag der Arbeit", :regions => [:ch_zh, :ch_bs, :ch_bl, :ch_sh, :ch_ag, :ch_tg, :ch_ti, :ch_ne, :ch_ju]},
|
@@ -213,7 +223,13 @@ module Holidays
|
|
213
223
|
{:mday => 1, :name => "Sviatok práce", :regions => [:sk]},
|
214
224
|
{:mday => 8, :name => "Deň víťazstva nad fašizmom", :regions => [:sk]},
|
215
225
|
{:mday => 1, :name => "praznik dela", :regions => [:si]},
|
216
|
-
{:mday => 2, :name => "praznik dela", :regions => [:si]}
|
226
|
+
{:mday => 2, :name => "praznik dela", :regions => [:si]},
|
227
|
+
{:mday => 1, :name => "Labour Day", :regions => [:bg_en]},
|
228
|
+
{:mday => 1, :name => "Ден на труда", :regions => [:bg_bg]},
|
229
|
+
{:mday => 6, :name => "St. George's Day", :regions => [:bg_en]},
|
230
|
+
{:mday => 6, :name => "Гергьовден. Ден на храбростта", :regions => [:bg_bg]},
|
231
|
+
{:mday => 24, :name => "Slavic Literacy Day", :regions => [:bg_en]},
|
232
|
+
{:mday => 24, :name => "Ден на славянската писменост", :regions => [:bg_bg]}],
|
217
233
|
8 => [{:mday => 15, :name => "Mariä Himmelfahrt", :regions => [:at]},
|
218
234
|
{:mday => 15, :name => "Assomption", :regions => [:be]},
|
219
235
|
{:mday => 1, :name => "Bundesfeiertag", :regions => [:ch]},
|
@@ -277,7 +293,9 @@ module Holidays
|
|
277
293
|
{:mday => 30, :name => "Sfântul Apostol Andrei", :regions => [:ro]},
|
278
294
|
{:mday => 1, :name => "Sviatok všetkých svätých", :regions => [:sk]},
|
279
295
|
{:mday => 17, :name => "Deň boja za slobodu a demokraciu", :regions => [:sk]},
|
280
|
-
{:mday => 1, :name => "dan spomina na mrtve", :regions => [:si]}
|
296
|
+
{:mday => 1, :name => "dan spomina na mrtve", :regions => [:si]},
|
297
|
+
{:mday => 1, :name => "Revival Leader's Day", :regions => [:bg_en]},
|
298
|
+
{:mday => 1, :name => "Ден на Народните будители", :regions => [:bg_bg]}],
|
281
299
|
12 => [{:mday => 8, :name => "Mariä Empfägnis", :regions => [:at]},
|
282
300
|
{:mday => 25, :name => "1. Weihnachtstag", :regions => [:at]},
|
283
301
|
{:mday => 26, :name => "2. Weihnachtstag", :regions => [:at]},
|
@@ -347,7 +365,13 @@ module Holidays
|
|
347
365
|
{:mday => 25, :name => "1. sviatok vianočný", :regions => [:sk]},
|
348
366
|
{:mday => 26, :name => "2. sviatok vianočný", :regions => [:sk]},
|
349
367
|
{:mday => 25, :name => "božič", :regions => [:si]},
|
350
|
-
{:mday => 26, :name => "dan samostojnosti in enotnosti", :regions => [:si]}
|
368
|
+
{:mday => 26, :name => "dan samostojnosti in enotnosti", :regions => [:si]},
|
369
|
+
{:mday => 24, :name => "Christmas Eve", :regions => [:bg_en]},
|
370
|
+
{:mday => 24, :name => "Бъдни вечер", :regions => [:bg_bg]},
|
371
|
+
{:mday => 25, :name => "Christmas", :regions => [:bg_en]},
|
372
|
+
{:mday => 25, :name => "Рождество Христово. Коледа", :regions => [:bg_bg]},
|
373
|
+
{:mday => 26, :name => "Christmas", :regions => [:bg_en]},
|
374
|
+
{:mday => 26, :name => "Рождество Христово. Коледа", :regions => [:bg_bg]}],
|
351
375
|
7 => [{:mday => 21, :name => "Fête nationale", :regions => [:be]},
|
352
376
|
{:mday => 5, :name => "Den slovanských věrozvěstů Cyrila a Metoděje", :regions => [:cz]},
|
353
377
|
{:mday => 6, :name => "Den upálení mistra Jana Husa", :regions => [:cz]},
|
@@ -369,7 +393,9 @@ module Holidays
|
|
369
393
|
{:mday => 19, :name => "St. Josef", :regions => [:li]},
|
370
394
|
{:mday => 11, :name => "Nepriklausomybės atkūrimo diena", :regions => [:lt]},
|
371
395
|
{:mday => 8, :type => :informal, :name => "Dzień Kobiet", :regions => [:pl]},
|
372
|
-
{:mday => 10, :type => :informal, :name => "Dzień Mężczyzn", :regions => [:pl]}
|
396
|
+
{:mday => 10, :type => :informal, :name => "Dzień Mężczyzn", :regions => [:pl]},
|
397
|
+
{:mday => 3, :name => "Liberation Day", :regions => [:bg_en]},
|
398
|
+
{:mday => 3, :name => "Освобожението на България", :regions => [:bg_bg]}],
|
373
399
|
4 => [{:function => lambda { |year| Holidays.ch_gl_naefelser_fahrt(year) }, :function_id => "ch_gl_naefelser_fahrt(year)", :name => "Näfelser Fahrt", :regions => [:ch_gl]},
|
374
400
|
{:mday => 1, :type => :informal, :name => "1. april", :regions => [:dk]},
|
375
401
|
{:mday => 9, :type => :informal, :name => "Danmarks besættelse", :regions => [:dk]},
|
@@ -410,7 +436,11 @@ module Holidays
|
|
410
436
|
{:mday => 8, :name => "Maria Geburt", :regions => [:li]},
|
411
437
|
{:mday => 30, :type => :informal, :name => "Dzień Chłopaka", :regions => [:pl]},
|
412
438
|
{:mday => 1, :name => "Deň Ústavy Slovenskej republiky", :regions => [:sk]},
|
413
|
-
{:mday => 15, :name => "Sedembolestná Panna Mária", :regions => [:sk]}
|
439
|
+
{:mday => 15, :name => "Sedembolestná Panna Mária", :regions => [:sk]},
|
440
|
+
{:mday => 6, :name => "Unification Day", :regions => [:bg_en]},
|
441
|
+
{:mday => 6, :name => "Ден на Съединението", :regions => [:bg_bg]},
|
442
|
+
{:mday => 22, :name => "The Independence Day", :regions => [:bg_en]},
|
443
|
+
{:mday => 22, :name => "Ден на Независимостта", :regions => [:bg_bg]}],
|
414
444
|
2 => [{:mday => 28, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Día de Andalucía", :regions => [:es_an]},
|
415
445
|
{:mday => 18, :type => :informal, :name => "Konudagur", :regions => [:is]},
|
416
446
|
{:mday => 2, :name => "Maria Lichtmess", :regions => [:li]},
|
@@ -475,10 +505,11 @@ end
|
|
475
505
|
|
476
506
|
# Ireland - Stephens Day is always the day after christmas day
|
477
507
|
def self.ie_st_stephens_day(date)
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
date
|
508
|
+
case date.wday
|
509
|
+
when 6, 0 then date + 2
|
510
|
+
when 1 then date + 1
|
511
|
+
else date
|
512
|
+
end
|
482
513
|
end
|
483
514
|
|
484
515
|
|
@@ -33,10 +33,11 @@ module Holidays
|
|
33
33
|
|
34
34
|
# Ireland - Stephens Day is always the day after christmas day
|
35
35
|
def self.ie_st_stephens_day(date)
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
date
|
36
|
+
case date.wday
|
37
|
+
when 6, 0 then date + 2
|
38
|
+
when 1 then date + 1
|
39
|
+
else date
|
40
|
+
end
|
40
41
|
end
|
41
42
|
|
42
43
|
|
@@ -35,6 +35,8 @@ module Holidays
|
|
35
35
|
{:function => lambda { |year| Holidays.jp_substitute_holiday(year, 5, 5) }, :function_id => "jp_substitute_holiday(year, 5, 5)", :name => "振替休日", :regions => [:jp]}],
|
36
36
|
7 => [{:wday => 1, :week => 3, :name => "海の日", :regions => [:jp]},
|
37
37
|
{:function => lambda { |year| Holidays.jp_substitute_holiday(year, 7, Holidays.calculate_day_of_month(year, 7, 3, 1)) }, :function_id => "jp_substitute_holiday(year, 7, Holidays.calculate_day_of_month(year, 7, 3, 1))", :name => "振替休日", :regions => [:jp]}],
|
38
|
+
8 => [{:function => lambda { |year| Holidays.jp_mountain_holiday(year) }, :function_id => "jp_mountain_holiday(year)", :name => "山の日", :regions => [:jp]},
|
39
|
+
{:function => lambda { |year| Holidays.jp_substitute_holiday(Holidays.jp_mountain_holiday(year)) }, :function_id => "jp_substitute_holiday(Holidays.jp_mountain_holiday(year))", :name => "振替休日", :regions => [:jp]}],
|
38
40
|
9 => [{:wday => 1, :week => 3, :name => "敬老の日", :regions => [:jp]},
|
39
41
|
{:function => lambda { |year| Holidays.jp_substitute_holiday(year, 9, Holidays.calculate_day_of_month(year, 9, 3, 1)) }, :function_id => "jp_substitute_holiday(year, 9, Holidays.calculate_day_of_month(year, 9, 3, 1))", :name => "振替休日", :regions => [:jp]},
|
40
42
|
{:function => lambda { |year| Holidays.jp_citizons_holiday(year) }, :function_id => "jp_citizons_holiday(year)", :name => "国民の休日", :regions => [:jp]},
|
@@ -103,7 +105,14 @@ def self.jp_citizons_holiday(year)
|
|
103
105
|
end
|
104
106
|
|
105
107
|
|
108
|
+
def self.jp_mountain_holiday(year)
|
109
|
+
return nil if year < 2016
|
110
|
+
Date.civil(year, 8, 11)
|
111
|
+
end
|
112
|
+
|
113
|
+
|
106
114
|
def self.jp_substitute_holiday(*date)
|
115
|
+
return nil unless date[0]
|
107
116
|
date = date[0].kind_of?(Date) ? date.first : Date.civil(*date)
|
108
117
|
date.wday == 0 ? Holidays.jp_next_weekday(date+1) : nil
|
109
118
|
end
|
data/lib/holidays.rb
CHANGED
@@ -137,11 +137,15 @@ module Holidays
|
|
137
137
|
end
|
138
138
|
|
139
139
|
def easter(year)
|
140
|
-
DateCalculatorFactory.easter_calculator.calculate_easter_for(year)
|
140
|
+
DateCalculatorFactory::Easter::Gregorian.easter_calculator.calculate_easter_for(year)
|
141
141
|
end
|
142
142
|
|
143
143
|
def orthodox_easter(year)
|
144
|
-
DateCalculatorFactory.easter_calculator.calculate_orthodox_easter_for(year)
|
144
|
+
DateCalculatorFactory::Easter::Gregorian.easter_calculator.calculate_orthodox_easter_for(year)
|
145
|
+
end
|
146
|
+
|
147
|
+
def orthodox_easter_julian(year)
|
148
|
+
DateCalculatorFactory::Easter::Julian.easter_calculator.calculate_orthodox_easter_for(year)
|
145
149
|
end
|
146
150
|
|
147
151
|
def to_monday_if_sunday(date)
|
@@ -1,57 +1,90 @@
|
|
1
1
|
module Holidays
|
2
2
|
module DateCalculator
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
3
|
+
module Easter
|
4
|
+
class Gregorian
|
5
|
+
def calculate_easter_for(year)
|
6
|
+
y = year
|
7
|
+
a = y % 19
|
8
|
+
b = y / 100
|
9
|
+
c = y % 100
|
10
|
+
d = b / 4
|
11
|
+
e = b % 4
|
12
|
+
f = (b + 8) / 25
|
13
|
+
g = (b - f + 1) / 3
|
14
|
+
h = (19 * a + b - d - g + 15) % 30
|
15
|
+
i = c / 4
|
16
|
+
k = c % 4
|
17
|
+
l = (32 + 2 * e + 2 * i - h - k) % 7
|
18
|
+
m = (a + 11 * h + 22 * l) / 451
|
19
|
+
|
20
|
+
month = (h + l - 7 * m + 114) / 31
|
21
|
+
day = ((h + l - 7 * m + 114) % 31) + 1
|
22
|
+
|
23
|
+
Date.civil(year, month, day)
|
24
|
+
end
|
25
|
+
|
26
|
+
def calculate_orthodox_easter_for(year)
|
27
|
+
j_date = Julian.new.calculate_orthodox_easter_for(year)
|
27
28
|
|
28
|
-
|
29
|
-
# Safe until appr. 4100 AD, when one leap day will be removed.
|
30
|
-
# Returns a Date object.
|
31
|
-
def calculate_orthodox_easter_for(year)
|
32
|
-
y = year
|
33
|
-
g = y % 19
|
34
|
-
i = (19 * g + 15) % 30
|
35
|
-
j = (year + year/4 + i) % 7
|
36
|
-
j_month = 3 + (i - j + 40) / 44
|
37
|
-
j_day = i - j + 28 - 31 * (j_month / 4)
|
38
|
-
j_date = Date.civil(year, j_month, j_day)
|
39
|
-
|
40
|
-
case
|
29
|
+
case
|
41
30
|
# up until 1582, julian and gregorian easter dates were identical
|
42
|
-
|
43
|
-
|
31
|
+
when year <= 1582
|
32
|
+
offset = 0
|
44
33
|
# between the years 1583 and 1699 10 days are added to the julian day count
|
45
|
-
|
46
|
-
|
34
|
+
when (year >= 1583 and year <= 1699)
|
35
|
+
offset = 10
|
47
36
|
# after 1700, 1 day is added for each century, except if the century year is exactly divisible by 400 (in which case no days are added).
|
48
37
|
# Safe until 4100 AD, when one leap day will be removed.
|
49
|
-
|
50
|
-
|
38
|
+
when year >= 1700
|
39
|
+
offset = (year - 1700).divmod(100)[0] + ((year - year.divmod(100)[1]).divmod(400)[1] == 0 ? 0 : 1) - (year - year.divmod(100)[1] - 1700).divmod(400)[0] + 10
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
Date.jd(j_date.jd + offset)
|
51
44
|
end
|
45
|
+
end
|
46
|
+
|
47
|
+
class Julian
|
48
|
+
# Copied from https://github.com/Loyolny/when_easter
|
49
|
+
# Graciously allowed by Michał Nierebiński (https://github.com/Loyolny)
|
50
|
+
def calculate_easter_for(year)
|
51
|
+
g = year % 19 +1
|
52
|
+
s = (year -1600) / 100 - (year-1600) / 400
|
53
|
+
l = (((year - 1400) / 100) * 8) / 25
|
52
54
|
|
53
|
-
|
54
|
-
|
55
|
+
p_2 = (3-11*g +s -l) % 30
|
56
|
+
if p_2 == 29 || (p_2 == 28 && g > 11)
|
57
|
+
p = p_2 -1
|
58
|
+
else
|
59
|
+
p= p_2
|
60
|
+
end
|
61
|
+
|
62
|
+
d= (year + year / 4 - year / 100 + year / 400) % 7
|
63
|
+
d_2 = (8-d) % 7
|
64
|
+
|
65
|
+
p_3 = (80 + p) % 7
|
66
|
+
x_2 = d_2 - p_3
|
67
|
+
|
68
|
+
x = (x_2 -1) % 7 +1
|
69
|
+
e = p+x
|
70
|
+
|
71
|
+
if e < 11
|
72
|
+
Date.civil(year,3,e+21)
|
73
|
+
else
|
74
|
+
Date.civil(year,4,e-10)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def calculate_orthodox_easter_for(year)
|
79
|
+
y = year
|
80
|
+
g = y % 19
|
81
|
+
i = (19 * g + 15) % 30
|
82
|
+
j = (year + year/4 + i) % 7
|
83
|
+
j_month = 3 + (i - j + 40) / 44
|
84
|
+
j_day = i - j + 28 - 31 * (j_month / 4)
|
85
|
+
|
86
|
+
Date.civil(year, j_month, j_day)
|
87
|
+
end
|
55
88
|
end
|
56
89
|
end
|
57
90
|
end
|
@@ -4,11 +4,25 @@ require 'holidays/date_calculator/day_of_month'
|
|
4
4
|
|
5
5
|
module Holidays
|
6
6
|
module DateCalculatorFactory
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
module Easter
|
8
|
+
module Gregorian
|
9
|
+
class << self
|
10
|
+
def easter_calculator
|
11
|
+
DateCalculator::Easter::Gregorian.new
|
12
|
+
end
|
13
|
+
end
|
10
14
|
end
|
11
15
|
|
16
|
+
module Julian
|
17
|
+
class << self
|
18
|
+
def easter_calculator
|
19
|
+
DateCalculator::Easter::Julian.new
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
class << self
|
12
26
|
def weekend_modifier
|
13
27
|
DateCalculator::WeekendModifier.new
|
14
28
|
end
|
data/lib/holidays/version.rb
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
3
|
+
|
4
|
+
# This file is generated by the Ruby Holiday gem.
|
5
|
+
#
|
6
|
+
# Definitions loaded: definitions/bg.yaml
|
7
|
+
class BgDefinitionTests < Test::Unit::TestCase # :nodoc:
|
8
|
+
|
9
|
+
def test_bg
|
10
|
+
{Date.civil(2015,1,1) => "New Year's Day",
|
11
|
+
Date.civil(2015,3,3) => "Liberation Day",
|
12
|
+
Date.civil(2015,3,28) => "Good Friday",
|
13
|
+
Date.civil(2015,3,29) => "Holy Saturday",
|
14
|
+
Date.civil(2015,3,30) => "Easter Sunday",
|
15
|
+
Date.civil(2015,3,31) => "Easter Monday",
|
16
|
+
Date.civil(2015,5,1) => "Labour Day",
|
17
|
+
Date.civil(2015,5,6) => "St. George's Day",
|
18
|
+
Date.civil(2015,5,24) => "Slavic Literacy Day",
|
19
|
+
Date.civil(2015,9,6) => "Unification Day",
|
20
|
+
Date.civil(2015,9,22) => "The Independence Day",
|
21
|
+
Date.civil(2015,11,1) => "Revival Leader's Day",
|
22
|
+
Date.civil(2015,12,24) => "Christmas Eve",
|
23
|
+
Date.civil(2015,12,25) => "Christmas",
|
24
|
+
Date.civil(2015,12,26) => "Christmas"}.each do |date, name|
|
25
|
+
assert_equal name, (Holidays.on(date, :bg_en)[0] || {})[:name]
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
|
3
3
|
|
4
4
|
# This file is generated by the Ruby Holiday gem.
|
5
5
|
#
|
6
|
-
# Definitions loaded: definitions/at.yaml, definitions/be.yaml, definitions/ch.yaml, definitions/cz.yaml, definitions/dk.yaml, definitions/de.yaml, definitions/el.yaml, definitions/es.yaml, definitions/fr.yaml, definitions/gb.yaml, definitions/hr.yaml, definitions/hu.yaml, definitions/ie.yaml, definitions/is.yaml, definitions/it.yaml, definitions/li.yaml, definitions/lt.yaml, definitions/nl.yaml, definitions/no.yaml, definitions/pl.yaml, definitions/pt.yaml, definitions/ro.yaml, definitions/sk.yaml, definitions/si.yaml
|
6
|
+
# Definitions loaded: definitions/at.yaml, definitions/be.yaml, definitions/ch.yaml, definitions/cz.yaml, definitions/dk.yaml, definitions/de.yaml, definitions/el.yaml, definitions/es.yaml, definitions/fr.yaml, definitions/gb.yaml, definitions/hr.yaml, definitions/hu.yaml, definitions/ie.yaml, definitions/is.yaml, definitions/it.yaml, definitions/li.yaml, definitions/lt.yaml, definitions/nl.yaml, definitions/no.yaml, definitions/pl.yaml, definitions/pt.yaml, definitions/ro.yaml, definitions/sk.yaml, definitions/si.yaml, definitions/bg.yaml
|
7
7
|
class EuropeDefinitionTests < Test::Unit::TestCase # :nodoc:
|
8
8
|
|
9
9
|
def test_europe
|
@@ -334,7 +334,7 @@ end
|
|
334
334
|
assert_equal [], Holidays.on(Date.civil(2012,3,14), :hu), '2012-03-14 is not a holiday in Hungary'
|
335
335
|
|
336
336
|
|
337
|
-
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
337
|
+
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
338
338
|
Date.civil(2008,3,17) => 'St. Patrick\'s Day',
|
339
339
|
Date.civil(2008,3,24) => 'Easter Monday',
|
340
340
|
Date.civil(2008,5,5) => 'May Day',
|
@@ -345,7 +345,7 @@ assert_equal [], Holidays.on(Date.civil(2012,3,14), :hu), '2012-03-14 is not a h
|
|
345
345
|
Date.civil(2008,12,26) => 'St. Stephen\'s Day'}.each do |date, name|
|
346
346
|
assert_equal name, (Holidays.on(date, :ie)[0] || {})[:name]
|
347
347
|
end
|
348
|
-
{Date.civil(2012,1,2) => 'New Year\'s Day',
|
348
|
+
{Date.civil(2012,1,2) => 'New Year\'s Day',
|
349
349
|
Date.civil(2012,3,19) => 'St. Patrick\'s Day',
|
350
350
|
Date.civil(2012,4,9) => 'Easter Monday',
|
351
351
|
Date.civil(2012,5,7) => 'May Day',
|
@@ -355,7 +355,8 @@ end
|
|
355
355
|
Date.civil(2011,12,26) => 'Christmas Day',
|
356
356
|
Date.civil(2011,12,27) => 'St. Stephen\'s Day',
|
357
357
|
Date.civil(2012,12,25) => 'Christmas Day',
|
358
|
-
Date.civil(2012,12,26) => 'St. Stephen\'s Day'
|
358
|
+
Date.civil(2012,12,26) => 'St. Stephen\'s Day',
|
359
|
+
Date.civil(2015,12,28) => 'St. Stephen\'s Day'}.each do |date, name|
|
359
360
|
assert_equal name, (Holidays.on(date, :ie, :observed)[0] || {})[:name]
|
360
361
|
end
|
361
362
|
|
@@ -710,5 +711,24 @@ assert_equal 'binkošti', Holidays.on(Date.civil(2016,5,15), :si)[0][:name]
|
|
710
711
|
end
|
711
712
|
end
|
712
713
|
|
714
|
+
|
715
|
+
{Date.civil(2015,1,1) => "New Year's Day",
|
716
|
+
Date.civil(2015,3,3) => "Liberation Day",
|
717
|
+
Date.civil(2015,3,28) => "Good Friday",
|
718
|
+
Date.civil(2015,3,29) => "Holy Saturday",
|
719
|
+
Date.civil(2015,3,30) => "Easter Sunday",
|
720
|
+
Date.civil(2015,3,31) => "Easter Monday",
|
721
|
+
Date.civil(2015,5,1) => "Labour Day",
|
722
|
+
Date.civil(2015,5,6) => "St. George's Day",
|
723
|
+
Date.civil(2015,5,24) => "Slavic Literacy Day",
|
724
|
+
Date.civil(2015,9,6) => "Unification Day",
|
725
|
+
Date.civil(2015,9,22) => "The Independence Day",
|
726
|
+
Date.civil(2015,11,1) => "Revival Leader's Day",
|
727
|
+
Date.civil(2015,12,24) => "Christmas Eve",
|
728
|
+
Date.civil(2015,12,25) => "Christmas",
|
729
|
+
Date.civil(2015,12,26) => "Christmas"}.each do |date, name|
|
730
|
+
assert_equal name, (Holidays.on(date, :bg_en)[0] || {})[:name]
|
731
|
+
end
|
732
|
+
|
713
733
|
end
|
714
734
|
end
|
data/test/defs/test_defs_ie.rb
CHANGED
@@ -7,7 +7,7 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
|
7
7
|
class IeDefinitionTests < Test::Unit::TestCase # :nodoc:
|
8
8
|
|
9
9
|
def test_ie
|
10
|
-
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
10
|
+
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
11
11
|
Date.civil(2008,3,17) => 'St. Patrick\'s Day',
|
12
12
|
Date.civil(2008,3,24) => 'Easter Monday',
|
13
13
|
Date.civil(2008,5,5) => 'May Day',
|
@@ -18,7 +18,7 @@ class IeDefinitionTests < Test::Unit::TestCase # :nodoc:
|
|
18
18
|
Date.civil(2008,12,26) => 'St. Stephen\'s Day'}.each do |date, name|
|
19
19
|
assert_equal name, (Holidays.on(date, :ie)[0] || {})[:name]
|
20
20
|
end
|
21
|
-
{Date.civil(2012,1,2) => 'New Year\'s Day',
|
21
|
+
{Date.civil(2012,1,2) => 'New Year\'s Day',
|
22
22
|
Date.civil(2012,3,19) => 'St. Patrick\'s Day',
|
23
23
|
Date.civil(2012,4,9) => 'Easter Monday',
|
24
24
|
Date.civil(2012,5,7) => 'May Day',
|
@@ -28,7 +28,8 @@ end
|
|
28
28
|
Date.civil(2011,12,26) => 'Christmas Day',
|
29
29
|
Date.civil(2011,12,27) => 'St. Stephen\'s Day',
|
30
30
|
Date.civil(2012,12,25) => 'Christmas Day',
|
31
|
-
Date.civil(2012,12,26) => 'St. Stephen\'s Day'
|
31
|
+
Date.civil(2012,12,26) => 'St. Stephen\'s Day',
|
32
|
+
Date.civil(2015,12,28) => 'St. Stephen\'s Day'}.each do |date, name|
|
32
33
|
assert_equal name, (Holidays.on(date, :ie, :observed)[0] || {})[:name]
|
33
34
|
end
|
34
35
|
|
data/test/defs/test_defs_jp.rb
CHANGED
@@ -7,8 +7,8 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
|
7
7
|
class JpDefinitionTests < Test::Unit::TestCase # :nodoc:
|
8
8
|
|
9
9
|
def test_jp
|
10
|
-
{Date.civil(2008,1,1) => '元日',
|
11
|
-
Date.civil(2010,1,11) => '成人の日',
|
10
|
+
{Date.civil(2008,1,1) => '元日',
|
11
|
+
Date.civil(2010,1,11) => '成人の日',
|
12
12
|
Date.civil(2008,2,11) => '建国記念日',
|
13
13
|
Date.civil(2008,4,29) => '昭和の日',
|
14
14
|
Date.civil(2008,5,3) => '憲法記念日',
|
@@ -24,7 +24,8 @@ class JpDefinitionTests < Test::Unit::TestCase # :nodoc:
|
|
24
24
|
Date.civil(2012,1,2) => '振替休日',
|
25
25
|
Date.civil(2013,5,6) => '振替休日',
|
26
26
|
Date.civil(2014,5,6) => '振替休日',
|
27
|
-
Date.civil(2015,5,6) => '振替休日'
|
27
|
+
Date.civil(2015,5,6) => '振替休日',
|
28
|
+
Date.civil(2019,8,12) => '振替休日'
|
28
29
|
}.each do |date, name|
|
29
30
|
assert_equal name, (Holidays.on(date, :jp, :informal)[0] || {})[:name]
|
30
31
|
end
|
@@ -50,5 +51,15 @@ end
|
|
50
51
|
assert_equal '国民の休日', Holidays.on(date, :jp)[0][:name]
|
51
52
|
end
|
52
53
|
|
54
|
+
# mountain holiday start since 2016
|
55
|
+
[Date.civil(2016,8,11), Date.civil(2017,8,11),Date.civil(2018,8,11),
|
56
|
+
Date.civil(2019,8,11), Date.civil(2020,8,11),Date.civil(2021,8,11),
|
57
|
+
Date.civil(2022,8,11)].each do |date|
|
58
|
+
assert_equal '山の日', Holidays.on(date, :jp)[0][:name]
|
59
|
+
end
|
60
|
+
|
61
|
+
# before 2016, there is no mountain holiday.
|
62
|
+
assert_nil Date.civil(2015,8,11).holidays(:jp)[0]
|
63
|
+
|
53
64
|
end
|
54
65
|
end
|
@@ -2,12 +2,13 @@ require File.expand_path(File.dirname(__FILE__)) + '/../../test_helper'
|
|
2
2
|
|
3
3
|
require 'holidays/date_calculator/easter'
|
4
4
|
|
5
|
-
class
|
5
|
+
class GregorianEasterDateCalculatorTests < Test::Unit::TestCase
|
6
6
|
def setup
|
7
|
-
@subject = Holidays::DateCalculator::Easter.new
|
7
|
+
@subject = Holidays::DateCalculator::Easter::Gregorian.new
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_calculate_easter_for_returns_expected_results
|
11
|
+
assert_equal '0960-04-20', @subject.calculate_easter_for(960).to_s
|
11
12
|
assert_equal '1800-04-13', @subject.calculate_easter_for(1800).to_s
|
12
13
|
assert_equal '1899-04-02', @subject.calculate_easter_for(1899).to_s
|
13
14
|
assert_equal '1900-04-15', @subject.calculate_easter_for(1900).to_s
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__)) + '/../../test_helper'
|
2
|
+
|
3
|
+
require 'holidays/date_calculator/easter'
|
4
|
+
|
5
|
+
class JulianEasterDateCalculatorTests < Test::Unit::TestCase
|
6
|
+
def setup
|
7
|
+
@subject = Holidays::DateCalculator::Easter::Julian.new
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_calculate_easter_for_returns_expected_results
|
11
|
+
assert_equal '0960-04-20', @subject.calculate_easter_for(960).to_s
|
12
|
+
assert_equal '1800-04-13', @subject.calculate_easter_for(1800).to_s
|
13
|
+
assert_equal '1899-04-02', @subject.calculate_easter_for(1899).to_s
|
14
|
+
assert_equal '1900-04-15', @subject.calculate_easter_for(1900).to_s
|
15
|
+
assert_equal '1999-04-04', @subject.calculate_easter_for(1999).to_s
|
16
|
+
assert_equal '2000-04-23', @subject.calculate_easter_for(2000).to_s
|
17
|
+
assert_equal '2025-04-20', @subject.calculate_easter_for(2025).to_s
|
18
|
+
assert_equal '2035-03-25', @subject.calculate_easter_for(2035).to_s
|
19
|
+
assert_equal '2067-04-03', @subject.calculate_easter_for(2067).to_s
|
20
|
+
assert_equal '2099-04-12', @subject.calculate_easter_for(2099).to_s
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_calculate_orthodox_easter_for_returns_expects_results
|
24
|
+
assert_equal '0960-04-22', @subject.calculate_orthodox_easter_for(960).to_s
|
25
|
+
assert_equal '1500-04-19', @subject.calculate_orthodox_easter_for(1500).to_s
|
26
|
+
assert_equal '2000-04-17', @subject.calculate_orthodox_easter_for(2000).to_s
|
27
|
+
assert_equal '2001-04-02', @subject.calculate_orthodox_easter_for(2001).to_s
|
28
|
+
assert_equal '2015-03-30', @subject.calculate_orthodox_easter_for(2015).to_s
|
29
|
+
assert_equal '2016-04-18', @subject.calculate_orthodox_easter_for(2016).to_s
|
30
|
+
assert_equal '2017-04-03', @subject.calculate_orthodox_easter_for(2017).to_s
|
31
|
+
assert_equal '2020-04-06', @subject.calculate_orthodox_easter_for(2020).to_s
|
32
|
+
assert_equal '2050-04-04', @subject.calculate_orthodox_easter_for(2050).to_s
|
33
|
+
assert_equal '2100-04-18', @subject.calculate_orthodox_easter_for(2100).to_s
|
34
|
+
assert_equal '2500-04-08', @subject.calculate_orthodox_easter_for(2500).to_s
|
35
|
+
end
|
36
|
+
end
|
@@ -15,7 +15,13 @@ class DateCalculatorFactoryTests < Test::Unit::TestCase
|
|
15
15
|
assert @subject.weekend_modifier.is_a?(Holidays::DateCalculator::WeekendModifier)
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
19
|
-
|
18
|
+
def test_easter_calculator_gregorian
|
19
|
+
@subject = @subject::Easter::Gregorian
|
20
|
+
assert @subject.easter_calculator.is_a?(Holidays::DateCalculator::Easter::Gregorian)
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_easter_calculator_julian
|
24
|
+
@subject = @subject::Easter::Julian
|
25
|
+
assert @subject.easter_calculator.is_a?(Holidays::DateCalculator::Easter::Julian)
|
20
26
|
end
|
21
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: holidays
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Dunae
|
8
|
+
- Phil Trimble
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
12
|
+
date: 2015-12-20 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
@@ -84,6 +85,7 @@ description: A collection of Ruby methods to deal with statutory and other holid
|
|
84
85
|
You deserve a holiday!
|
85
86
|
email:
|
86
87
|
- code@dunae.ca
|
88
|
+
- holidaysgem@gmail.com
|
87
89
|
executables: []
|
88
90
|
extensions: []
|
89
91
|
extra_rdoc_files: []
|
@@ -101,6 +103,7 @@ files:
|
|
101
103
|
- definitions/at.yaml
|
102
104
|
- definitions/au.yaml
|
103
105
|
- definitions/be.yaml
|
106
|
+
- definitions/bg.yaml
|
104
107
|
- definitions/br.yaml
|
105
108
|
- definitions/ca.yaml
|
106
109
|
- definitions/ch.yaml
|
@@ -155,6 +158,7 @@ files:
|
|
155
158
|
- lib/generated_definitions/at.rb
|
156
159
|
- lib/generated_definitions/au.rb
|
157
160
|
- lib/generated_definitions/be.rb
|
161
|
+
- lib/generated_definitions/bg.rb
|
158
162
|
- lib/generated_definitions/br.rb
|
159
163
|
- lib/generated_definitions/ca.rb
|
160
164
|
- lib/generated_definitions/ch.rb
|
@@ -230,6 +234,7 @@ files:
|
|
230
234
|
- test/defs/test_defs_at.rb
|
231
235
|
- test/defs/test_defs_au.rb
|
232
236
|
- test/defs/test_defs_be.rb
|
237
|
+
- test/defs/test_defs_bg.rb
|
233
238
|
- test/defs/test_defs_br.rb
|
234
239
|
- test/defs/test_defs_ca.rb
|
235
240
|
- test/defs/test_defs_ch.rb
|
@@ -280,7 +285,8 @@ files:
|
|
280
285
|
- test/defs/test_defs_za.rb
|
281
286
|
- test/holidays/core_extensions/test_date.rb
|
282
287
|
- test/holidays/date_calculator/test_day_of_month.rb
|
283
|
-
- test/holidays/date_calculator/
|
288
|
+
- test/holidays/date_calculator/test_easter_gregorian.rb
|
289
|
+
- test/holidays/date_calculator/test_easter_julian.rb
|
284
290
|
- test/holidays/date_calculator/test_weekend_modifier.rb
|
285
291
|
- test/holidays/definition/context/test_generator.rb
|
286
292
|
- test/holidays/definition/context/test_merger.rb
|
@@ -303,7 +309,7 @@ files:
|
|
303
309
|
- test/test_holidays_between.rb
|
304
310
|
- test/test_multiple_regions.rb
|
305
311
|
- test/test_parse_definitions.rb
|
306
|
-
homepage: https://github.com/
|
312
|
+
homepage: https://github.com/holidays/holidays
|
307
313
|
licenses:
|
308
314
|
- MIT
|
309
315
|
metadata: {}
|
@@ -335,6 +341,7 @@ test_files:
|
|
335
341
|
- test/defs/test_defs_at.rb
|
336
342
|
- test/defs/test_defs_au.rb
|
337
343
|
- test/defs/test_defs_be.rb
|
344
|
+
- test/defs/test_defs_bg.rb
|
338
345
|
- test/defs/test_defs_br.rb
|
339
346
|
- test/defs/test_defs_ca.rb
|
340
347
|
- test/defs/test_defs_ch.rb
|
@@ -385,7 +392,8 @@ test_files:
|
|
385
392
|
- test/defs/test_defs_za.rb
|
386
393
|
- test/holidays/core_extensions/test_date.rb
|
387
394
|
- test/holidays/date_calculator/test_day_of_month.rb
|
388
|
-
- test/holidays/date_calculator/
|
395
|
+
- test/holidays/date_calculator/test_easter_gregorian.rb
|
396
|
+
- test/holidays/date_calculator/test_easter_julian.rb
|
389
397
|
- test/holidays/date_calculator/test_weekend_modifier.rb
|
390
398
|
- test/holidays/definition/context/test_generator.rb
|
391
399
|
- test/holidays/definition/context/test_merger.rb
|