holidays 5.6.0 → 5.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +1 -1
- data/holidays.gemspec +2 -1
- data/lib/generated_definitions/MANIFEST +8 -0
- data/lib/generated_definitions/REGIONS.rb +2 -2
- data/lib/generated_definitions/au.rb +2 -2
- data/lib/generated_definitions/de.rb +4 -4
- data/lib/generated_definitions/ee.rb +36 -0
- data/lib/generated_definitions/europe.rb +8 -4
- data/lib/generated_definitions/fr.rb +5 -3
- data/lib/generated_definitions/ge.rb +41 -0
- data/lib/generated_definitions/mt_en.rb +38 -0
- data/lib/generated_definitions/mt_mt.rb +38 -0
- data/lib/generated_definitions/north_america.rb +106 -9
- data/lib/generated_definitions/nz.rb +0 -1
- data/lib/generated_definitions/pt.rb +4 -2
- data/lib/generated_definitions/rs_cyrl.rb +39 -0
- data/lib/generated_definitions/rs_la.rb +39 -0
- data/lib/generated_definitions/ru.rb +37 -0
- data/lib/generated_definitions/tr.rb +61 -0
- data/lib/generated_definitions/us.rb +112 -15
- data/lib/holidays/version.rb +1 -1
- data/test/coverage_report.rb +4 -2
- data/test/defs/test_defs_au.rb +2 -2
- data/test/defs/test_defs_de.rb +39 -37
- data/test/defs/test_defs_ee.rb +33 -0
- data/test/defs/test_defs_europe.rb +84 -68
- data/test/defs/test_defs_fr.rb +21 -13
- data/test/defs/test_defs_ge.rb +41 -0
- data/test/defs/test_defs_mt_en.rb +32 -0
- data/test/defs/test_defs_mt_mt.rb +32 -0
- data/test/defs/test_defs_north_america.rb +244 -16
- data/test/defs/test_defs_pt.rb +24 -18
- data/test/defs/test_defs_rs_cyrl.rb +39 -0
- data/test/defs/test_defs_rs_la.rb +39 -0
- data/test/defs/test_defs_ru.rb +28 -0
- data/test/defs/test_defs_tr.rb +44 -0
- data/test/defs/test_defs_us.rb +245 -17
- data/test/integration/test_available_regions.rb +1 -1
- data/test/integration/test_holidays.rb +2 -2
- metadata +65 -26
@@ -13,7 +13,6 @@ module Holidays
|
|
13
13
|
def self.holidays_by_month
|
14
14
|
{
|
15
15
|
0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Good Friday", :regions => [:nz]},
|
16
|
-
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -1, :name => "Easter Saturday", :regions => [:nz]},
|
17
16
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Easter Monday", :regions => [:nz]}],
|
18
17
|
1 => [{:mday => 1, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "New Year's Day", :regions => [:nz]},
|
19
18
|
{:mday => 2, :observed => "to_weekday_if_boxing_weekend(date)", :observed_arguments => [:date], :name => "Day after New Year's Day", :regions => [:nz]},
|
@@ -7,7 +7,7 @@ module Holidays
|
|
7
7
|
# All the definitions are available at https://github.com/holidays/holidays
|
8
8
|
module PT # :nodoc:
|
9
9
|
def self.defined_regions
|
10
|
-
[:pt]
|
10
|
+
[:pt, :pt_li, :pt_po]
|
11
11
|
end
|
12
12
|
|
13
13
|
def self.holidays_by_month
|
@@ -19,7 +19,9 @@ module Holidays
|
|
19
19
|
1 => [{:mday => 1, :name => "Ano Novo", :regions => [:pt]}],
|
20
20
|
4 => [{:mday => 25, :name => "Dia da Liberdade", :regions => [:pt]}],
|
21
21
|
5 => [{:mday => 1, :name => "Dia do Trabalhador", :regions => [:pt]}],
|
22
|
-
6 => [{:mday => 10, :name => "Dia de Portugal", :regions => [:pt]}
|
22
|
+
6 => [{:mday => 10, :name => "Dia de Portugal", :regions => [:pt]},
|
23
|
+
{:mday => 13, :name => "Dia de Santo António", :regions => [:pt_li]},
|
24
|
+
{:mday => 24, :name => "Dia de São João", :regions => [:pt_po]}],
|
23
25
|
8 => [{:mday => 15, :name => "Assunção de Nossa Senhora", :regions => [:pt]}],
|
24
26
|
10 => [{:mday => 5, :name => "Dia da República", :regions => [:pt]}],
|
25
27
|
11 => [{:mday => 1, :name => "Dia de Todos-os-Santos", :regions => [:pt]}],
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module Holidays
|
3
|
+
# This file is generated by the Ruby Holidays gem.
|
4
|
+
#
|
5
|
+
# Definitions loaded: definitions/rs_cyrl.yaml
|
6
|
+
#
|
7
|
+
# All the definitions are available at https://github.com/holidays/holidays
|
8
|
+
module RS_CYRL # :nodoc:
|
9
|
+
def self.defined_regions
|
10
|
+
[:rs_cyrl]
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.holidays_by_month
|
14
|
+
{
|
15
|
+
0 => [{:function => "orthodox_easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Велики петак", :regions => [:rs_cyrl]},
|
16
|
+
{:function => "orthodox_easter(year)", :function_arguments => [:year], :function_modifier => -1, :name => "Велика Субота", :regions => [:rs_cyrl]},
|
17
|
+
{:function => "orthodox_easter(year)", :function_arguments => [:year], :name => "Васкрс", :regions => [:rs_cyrl]},
|
18
|
+
{:function => "orthodox_easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Васкрсни понедељак", :regions => [:rs_cyrl]}],
|
19
|
+
1 => [{:mday => 1, :name => "Нова Година", :regions => [:rs_cyrl]},
|
20
|
+
{:mday => 2, :name => "Нова Година", :regions => [:rs_cyrl]},
|
21
|
+
{:mday => 7, :name => "Божић", :regions => [:rs_cyrl]},
|
22
|
+
{:mday => 27, :name => "Свети Сава (Савиндан)", :regions => [:rs_cyrl]}],
|
23
|
+
2 => [{:mday => 15, :name => "Дан државности Србије", :regions => [:rs_cyrl]},
|
24
|
+
{:mday => 16, :name => "Дан државности Србије", :regions => [:rs_cyrl]}],
|
25
|
+
5 => [{:mday => 1, :name => "Празник рада", :regions => [:rs_cyrl]},
|
26
|
+
{:mday => 2, :name => "Празник рада", :regions => [:rs_cyrl]},
|
27
|
+
{:mday => 9, :name => "Дан победе над фашизмом", :regions => [:rs_cyrl]}],
|
28
|
+
6 => [{:mday => 28, :name => "Видовдан", :regions => [:rs_cyrl]}],
|
29
|
+
11 => [{:mday => 11, :name => "Дан примирја", :regions => [:rs_cyrl]}]
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.custom_methods
|
34
|
+
{
|
35
|
+
|
36
|
+
}
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module Holidays
|
3
|
+
# This file is generated by the Ruby Holidays gem.
|
4
|
+
#
|
5
|
+
# Definitions loaded: definitions/rs_la.yaml
|
6
|
+
#
|
7
|
+
# All the definitions are available at https://github.com/holidays/holidays
|
8
|
+
module RS_LA # :nodoc:
|
9
|
+
def self.defined_regions
|
10
|
+
[:rs_la]
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.holidays_by_month
|
14
|
+
{
|
15
|
+
0 => [{:function => "orthodox_easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Veliki Petak", :regions => [:rs_la]},
|
16
|
+
{:function => "orthodox_easter(year)", :function_arguments => [:year], :function_modifier => -1, :name => "Velika Subota", :regions => [:rs_la]},
|
17
|
+
{:function => "orthodox_easter(year)", :function_arguments => [:year], :name => "Uskrs", :regions => [:rs_la]},
|
18
|
+
{:function => "orthodox_easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Vaskrsni ponedeljak", :regions => [:rs_la]}],
|
19
|
+
1 => [{:mday => 1, :name => "Nova Godina", :regions => [:rs_la]},
|
20
|
+
{:mday => 2, :name => "Nova Godina", :regions => [:rs_la]},
|
21
|
+
{:mday => 7, :name => "Božić", :regions => [:rs_la]},
|
22
|
+
{:mday => 27, :name => "Dan Svetog Save", :regions => [:rs_la]}],
|
23
|
+
2 => [{:mday => 15, :name => "Dan državnosti Srbije", :regions => [:rs_la]},
|
24
|
+
{:mday => 16, :name => "Dan državnosti Srbije", :regions => [:rs_la]}],
|
25
|
+
5 => [{:mday => 1, :name => "Praznik rada", :regions => [:rs_la]},
|
26
|
+
{:mday => 2, :name => "Praznik rada", :regions => [:rs_la]},
|
27
|
+
{:mday => 9, :name => "Dan pobede", :regions => [:rs_la]}],
|
28
|
+
6 => [{:mday => 28, :name => "Vidovdan", :regions => [:rs_la]}],
|
29
|
+
11 => [{:mday => 11, :name => "Dan primirja", :regions => [:rs_la]}]
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.custom_methods
|
34
|
+
{
|
35
|
+
|
36
|
+
}
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module Holidays
|
3
|
+
# This file is generated by the Ruby Holidays gem.
|
4
|
+
#
|
5
|
+
# Definitions loaded: definitions/ru.yaml
|
6
|
+
#
|
7
|
+
# All the definitions are available at https://github.com/holidays/holidays
|
8
|
+
module RU # :nodoc:
|
9
|
+
def self.defined_regions
|
10
|
+
[:ru]
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.holidays_by_month
|
14
|
+
{
|
15
|
+
1 => [{:mday => 1, :name => "Новый год", :regions => [:ru]},
|
16
|
+
{:mday => 2, :name => "Новогодний праздник", :regions => [:ru]},
|
17
|
+
{:mday => 3, :name => "Новогодний праздник", :regions => [:ru]},
|
18
|
+
{:mday => 4, :name => "Новогодний праздник", :regions => [:ru]},
|
19
|
+
{:mday => 5, :name => "Новогодний праздник", :regions => [:ru]},
|
20
|
+
{:mday => 7, :name => "Рождество Христово", :regions => [:ru]}],
|
21
|
+
2 => [{:mday => 23, :name => "День защитника Отечества", :regions => [:ru]}],
|
22
|
+
3 => [{:mday => 8, :name => "Международный женский день", :regions => [:ru]}],
|
23
|
+
5 => [{:mday => 1, :name => "Праздник Весны и Труда", :regions => [:ru]},
|
24
|
+
{:mday => 9, :name => "День Победы", :regions => [:ru]}],
|
25
|
+
6 => [{:mday => 12, :name => "День России", :regions => [:ru]}],
|
26
|
+
8 => [{:mday => 22, :name => "День Государственного флага Российской Федерации", :regions => [:ru]}],
|
27
|
+
11 => [{:mday => 4, :name => "День народного единства", :regions => [:ru]}]
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.custom_methods
|
32
|
+
{
|
33
|
+
|
34
|
+
}
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module Holidays
|
3
|
+
# This file is generated by the Ruby Holidays gem.
|
4
|
+
#
|
5
|
+
# Definitions loaded: definitions/tr.yaml
|
6
|
+
#
|
7
|
+
# All the definitions are available at https://github.com/holidays/holidays
|
8
|
+
module TR # :nodoc:
|
9
|
+
def self.defined_regions
|
10
|
+
[:tr]
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.holidays_by_month
|
14
|
+
{
|
15
|
+
0 => [{:function => "ramadan_feast(year)", :function_arguments => [:year], :name => "Ramazan Bayramı", :regions => [:tr]},
|
16
|
+
{:function => "ramadan_feast(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Ramazan Bayramı (ikinci tatil)", :regions => [:tr]},
|
17
|
+
{:function => "ramadan_feast(year)", :function_arguments => [:year], :function_modifier => 2, :name => "Ramazan Bayramı (üçüncü tatil)", :regions => [:tr]},
|
18
|
+
{:function => "sacrifice_feast(year)", :function_arguments => [:year], :name => "Kurban Bayramı", :regions => [:tr]},
|
19
|
+
{:function => "sacrifice_feast(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Kurban Bayramı (ikinci tatil)", :regions => [:tr]},
|
20
|
+
{:function => "sacrifice_feast(year)", :function_arguments => [:year], :function_modifier => 2, :name => "Kurban Bayramı (üçüncü tatil)", :regions => [:tr]},
|
21
|
+
{:function => "sacrifice_feast(year)", :function_arguments => [:year], :function_modifier => 3, :name => "Kurban Bayramı (dördüncü tatil)", :regions => [:tr]}],
|
22
|
+
1 => [{:mday => 1, :name => "Yılbaşı", :regions => [:tr]}],
|
23
|
+
4 => [{:mday => 23, :name => "Ulusal Egemenlik ve Çocuk Bayramı", :regions => [:tr]}],
|
24
|
+
5 => [{:mday => 1, :name => "Emek ve Dayanışma Günü", :regions => [:tr]},
|
25
|
+
{:mday => 19, :name => "Atatürk'ü Anma Gençlik ve Spor Bayramı", :regions => [:tr]}],
|
26
|
+
8 => [{:mday => 30, :name => "Zafer Bayramı", :regions => [:tr]}],
|
27
|
+
10 => [{:mday => 29, :name => "Cumhuriyet Bayramı", :regions => [:tr]}]
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.custom_methods
|
32
|
+
{
|
33
|
+
"ramadan_feast(year)" => Proc.new { |year|
|
34
|
+
begin_of_ramadan_feast = {
|
35
|
+
'2014' => Date.civil(2014, 7, 28),
|
36
|
+
'2015' => Date.civil(2015, 7, 17),
|
37
|
+
'2016' => Date.civil(2016, 7, 5),
|
38
|
+
'2017' => Date.civil(2017, 6, 25),
|
39
|
+
'2018' => Date.civil(2018, 6, 15),
|
40
|
+
'2019' => Date.civil(2019, 6, 4)
|
41
|
+
}
|
42
|
+
begin_of_ramadan_feast[year.to_s]
|
43
|
+
},
|
44
|
+
|
45
|
+
"sacrifice_feast(year)" => Proc.new { |year|
|
46
|
+
begin_of_sacrifice_feast = {
|
47
|
+
'2014' => Date.civil(2014, 10, 4),
|
48
|
+
'2015' => Date.civil(2015, 9, 24),
|
49
|
+
'2016' => Date.civil(2016, 9, 12),
|
50
|
+
'2017' => Date.civil(2017, 9, 1),
|
51
|
+
'2018' => Date.civil(2018, 8, 21),
|
52
|
+
'2019' => Date.civil(2019, 8, 11)
|
53
|
+
}
|
54
|
+
begin_of_sacrifice_feast[year.to_s]
|
55
|
+
},
|
56
|
+
|
57
|
+
|
58
|
+
}
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -7,41 +7,138 @@ module Holidays
|
|
7
7
|
# All the definitions are available at https://github.com/holidays/holidays
|
8
8
|
module US # :nodoc:
|
9
9
|
def self.defined_regions
|
10
|
-
[:us, :us_dc, :us_ca, :ca]
|
10
|
+
[:us_fl, :us_la, :us, :us_ct, :us_de, :us_gu, :us_hi, :us_in, :us_ky, :us_nj, :us_nc, :us_nd, :us_pr, :us_tn, :us_ms, :us_id, :us_ar, :us_tx, :us_dc, :us_md, :us_va, :us_il, :us_vt, :us_ak, :us_ca, :us_me, :us_ma, :us_al, :us_ga, :us_ne, :us_mo, :us_sc, :us_wv, :us_vi, :us_ut, :us_ri, :us_az, :us_co, :us_mt, :us_nm, :us_ny, :us_oh, :us_pa, :us_mi, :us_mn, :us_nv, :us_or, :us_sd, :us_wa, :us_wi, :us_wy, :us_ia, :us_ks, :us_nh, :us_ok, :ca]
|
11
11
|
end
|
12
12
|
|
13
13
|
def self.holidays_by_month
|
14
14
|
{
|
15
|
-
0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -
|
15
|
+
0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -47, :name => "Shrove Tuesday", :regions => [:us_fl]},
|
16
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -47, :name => "Mardi Gras Day", :regions => [:us_la]},
|
17
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :type => :informal, :name => "Good Friday", :regions => [:us]},
|
18
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Good Friday", :regions => [:us_ct, :us_de, :us_gu, :us_hi, :us_in, :us_ky, :us_la, :us_nj, :us_nc, :us_nd, :us_pr, :us_tn]},
|
16
19
|
{:function => "easter(year)", :function_arguments => [:year], :type => :informal, :name => "Easter Sunday", :regions => [:us]}],
|
17
20
|
1 => [{:mday => 1, :observed => "to_weekday_if_weekend(date)", :observed_arguments => [:date], :name => "New Year's Day", :regions => [:us]},
|
21
|
+
{:wday => 1, :week => 3, :name => "Martin Luther King's and Robert E. Lee's Birthdays", :regions => [:us_ms]},
|
22
|
+
{:wday => 1, :week => 3, :name => "Idaho Human Rights Day", :regions => [:us_id]},
|
23
|
+
{:wday => 1, :week => 3, :name => "Civil Rights Day", :regions => [:us_ar]},
|
18
24
|
{:wday => 1, :week => 3, :name => "Martin Luther King, Jr. Day", :regions => [:us]},
|
19
|
-
{:function => "us_inauguration_day(year)", :function_arguments => [:year], :name => "Inauguration Day", :regions => [:us_dc]}
|
25
|
+
{:function => "us_inauguration_day(year)", :function_arguments => [:year], :name => "Inauguration Day", :regions => [:us_tx, :us_dc, :us_la, :us_md, :us_va]},
|
26
|
+
{:function => "lee_jackson_day(year, month)", :function_arguments => [:year, :month], :name => "Lee-Jackson Day", :regions => [:us_va]},
|
27
|
+
{:mday => 19, :name => "Confederate Heroes Day", :regions => [:us_tx]}],
|
20
28
|
2 => [{:wday => 1, :week => 3, :name => "Presidents' Day", :regions => [:us]},
|
21
29
|
{:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
|
22
30
|
{:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
|
23
|
-
3 => [{:
|
31
|
+
3 => [{:wday => 1, :week => 1, :name => "Casimir Pulaski Day", :regions => [:us_il]},
|
32
|
+
{:wday => 2, :week => 1, :name => "Town Meeting Day", :regions => [:us_vt]},
|
33
|
+
{:mday => 2, :name => "Texas Independence Day", :regions => [:us_tx]},
|
34
|
+
{:mday => 26, :observed => "to_weekday_if_weekend(date)", :observed_arguments => [:date], :name => "Prince Jonah Kuhio Kalanianaole Day", :regions => [:us_hi]},
|
35
|
+
{:wday => 1, :week => -1, :name => "Seward's Day", :regions => [:us_ak]},
|
36
|
+
{:mday => 31, :name => "César Chávez Day", :regions => [:us_ca]},
|
24
37
|
{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
|
25
|
-
|
38
|
+
4 => [{:mday => 16, :observed => "to_weekday_if_weekend(date)", :observed_arguments => [:date], :name => "Emancipation Day", :regions => [:us_dc, :us_ca]},
|
39
|
+
{:wday => 1, :week => 3, :name => "Patriots' Day", :regions => [:us_me, :us_ma]},
|
40
|
+
{:mday => 21, :name => "San Jacinto Day", :regions => [:us_tx]},
|
41
|
+
{:wday => 1, :week => -1, :name => "Confederate Memorial Day", :regions => [:us_al, :us_ms]},
|
42
|
+
{:mday => 26, :observed => "to_monday_if_sunday(date)", :observed_arguments => [:date], :name => "Confederate Memorial Day", :regions => [:us_fl]},
|
43
|
+
{:function => "georgia_state_holiday(year, month)", :function_arguments => [:year, :month], :name => "State Holiday", :regions => [:us_ga]},
|
44
|
+
{:mday => 28, :name => "Arbor Day", :regions => [:us_ne]},
|
45
|
+
{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
|
46
|
+
{:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}],
|
47
|
+
5 => [{:mday => 8, :name => "Truman Day", :regions => [:us_mo]},
|
48
|
+
{:mday => 10, :name => "Confederate Memorial Day", :regions => [:us_sc]},
|
49
|
+
{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:us]},
|
26
50
|
{:wday => 0, :week => 2, :type => :informal, :name => "Mother's Day", :regions => [:us, :ca]},
|
27
51
|
{:wday => 6, :week => 3, :type => :informal, :name => "Armed Forces Day", :regions => [:us]}],
|
28
|
-
|
29
|
-
|
30
|
-
|
52
|
+
6 => [{:wday => 1, :week => 1, :name => "Jefferson Davis' Birthday", :regions => [:us_al]},
|
53
|
+
{:mday => 3, :name => "Birthday of Jefferson Davis", :regions => [:us_fl]},
|
54
|
+
{:mday => 11, :observed => "to_weekday_if_weekend(date)", :observed_arguments => [:date], :name => "King Kamehameha I Day", :regions => [:us_hi]},
|
55
|
+
{:mday => 19, :name => "Emancipation Day in Texas", :regions => [:us_tx]},
|
56
|
+
{:mday => 20, :observed => "to_weekday_if_weekend(date)", :observed_arguments => [:date], :name => "West Virginia Day", :regions => [:us_wv]},
|
57
|
+
{:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
|
58
|
+
7 => [{:mday => 3, :name => "Emancipation Day", :regions => [:us_vi]},
|
59
|
+
{:mday => 4, :name => "Independence Day", :regions => [:us]},
|
60
|
+
{:mday => 4, :function => "to_weekday_if_weekend(date)", :function_arguments => [:date], :name => "Independence Day (Holiday)", :regions => [:us_va]},
|
61
|
+
{:mday => 24, :name => "Pioneer Day", :regions => [:us_ut]}],
|
62
|
+
8 => [{:wday => 1, :week => 2, :name => "Victory Day", :regions => [:us_ri]},
|
63
|
+
{:mday => 16, :observed => "to_weekday_if_weekend(date)", :observed_arguments => [:date], :name => "Bennington Battle Day", :regions => [:us_vt]},
|
64
|
+
{:wday => 5, :week => 3, :name => "Statehood Day", :regions => [:us_hi]},
|
65
|
+
{:mday => 27, :name => "Lyndon Baines Johnson Day", :regions => [:us_tx]}],
|
66
|
+
9 => [{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:us]},
|
67
|
+
{:function => "rosh_hashanah(year)", :function_arguments => [:year], :name => "Rosh Hashanah", :regions => [:us_tx]},
|
68
|
+
{:function => "yom_kippur(year)", :function_arguments => [:year], :name => "Yom Kippur", :regions => [:us_tx]}],
|
69
|
+
10 => [{:wday => 1, :week => 2, :name => "Columbus Day", :regions => [:us_al, :us_az, :us_co, :us_ct, :us_dc, :us_ga, :us_id, :us_il, :us_in, :us_ma, :us_md, :us_me, :us_mo, :us_mt, :us_ne, :us_nj, :us_nm, :us_ny, :us_oh, :us_pa, :us_ri, :us_ut, :us_va, :us_wv]},
|
70
|
+
{:wday => 1, :week => 2, :type => :informal, :name => "Columbus Day", :regions => [:us_ak, :us_ar, :us_ca, :us_de, :us_fl, :us_hi, :us_mi, :us_mn, :us_nd, :us_nv, :us_or, :us_sd, :us_tx, :us_vt, :us_wa, :us_wi, :us_wy]},
|
71
|
+
{:mday => 18, :name => "Alaska Day", :regions => [:us_ak]},
|
72
|
+
{:wday => 5, :week => -1, :name => "Nevada Day", :regions => [:us_nv]},
|
31
73
|
{:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}],
|
32
|
-
11 => [{:
|
74
|
+
11 => [{:function => "election_day(year)", :function_arguments => [:year], :name => "Election Day", :regions => [:us_de, :us_hi, :us_il, :us_in, :us_mt, :us_nj, :us_ny, :us_pa, :us_ri]},
|
75
|
+
{:mday => 11, :observed => "to_weekday_if_weekend(date)", :observed_arguments => [:date], :name => "Veterans Day", :regions => [:us]},
|
33
76
|
{:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:us]},
|
34
|
-
{:function => "day_after_thanksgiving(year)", :function_arguments => [:year], :name => "Day
|
35
|
-
|
36
|
-
|
37
|
-
{:
|
38
|
-
|
77
|
+
{:function => "day_after_thanksgiving(year)", :function_arguments => [:year], :name => "Family Day", :regions => [:us_nv]},
|
78
|
+
{:function => "day_after_thanksgiving(year)", :function_arguments => [:year], :name => "State Holiday", :regions => [:us_ga]},
|
79
|
+
{:function => "day_after_thanksgiving(year)", :function_arguments => [:year], :name => "Presidents' Day", :regions => [:us_nm]},
|
80
|
+
{:function => "day_after_thanksgiving(year)", :function_arguments => [:year], :name => "Lincoln's Birthday", :regions => [:us_in]},
|
81
|
+
{:function => "day_after_thanksgiving(year)", :function_arguments => [:year], :name => "American Indian Heritage Day", :regions => [:us_md]},
|
82
|
+
{:function => "day_after_thanksgiving(year)", :function_arguments => [:year], :name => "Day after Thanksgiving (Black Friday)", :regions => [:us_ca, :us_de, :us_fl, :us_ia, :us_il, :us_ks, :us_ky, :us_me, :us_mi, :us_mn, :us_ms, :us_ne, :us_nh, :us_nc, :us_pa, :us_sc, :us_ok, :us_tn, :us_tx, :us_va, :us_wa, :us_wv]}],
|
83
|
+
12 => [{:mday => 24, :name => "Christmas Eve", :regions => [:us_ar, :us_mi, :us_nc, :us_sc, :us_tx, :us_wi]},
|
84
|
+
{:mday => 24, :function => "christmas_eve_holiday(date)", :function_arguments => [:date], :name => "Christmas Eve (Holiday)", :regions => [:us_mi, :us_sc, :us_va]},
|
85
|
+
{:mday => 25, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Christmas Day", :regions => [:us]},
|
86
|
+
{:mday => 26, :name => "Day after Christmas", :regions => [:us_ar, :us_nc, :us_ok, :us_sc, :us_tn, :us_tx]},
|
87
|
+
{:mday => 31, :name => "New Year's Eve", :regions => [:us_mi, :us_wi]}]
|
39
88
|
}
|
40
89
|
end
|
41
90
|
|
42
91
|
def self.custom_methods
|
43
92
|
{
|
44
|
-
"
|
93
|
+
"christmas_eve_holiday(date)" => Proc.new { |date|
|
94
|
+
beginning_of_month = Date.civil(date.year, date.month, 1)
|
95
|
+
(date.saturday? || date.sunday?) ? date.downto(beginning_of_month).find {|date| date if date.wday == 5} : date
|
96
|
+
},
|
97
|
+
|
98
|
+
"rosh_hashanah(year)" => Proc.new { |year|
|
99
|
+
rosh_hashanah_dates = {
|
100
|
+
'2014' => Date.civil(2014, 9, 25),
|
101
|
+
'2015' => Date.civil(2015, 9, 14),
|
102
|
+
'2016' => Date.civil(2016, 10, 3),
|
103
|
+
'2017' => Date.civil(2017, 9, 21),
|
104
|
+
'2018' => Date.civil(2018, 9, 10),
|
105
|
+
'2019' => Date.civil(2019, 9, 30),
|
106
|
+
'2020' => Date.civil(2020, 9, 19)
|
107
|
+
}
|
108
|
+
rosh_hashanah_dates[year.to_s]
|
109
|
+
},
|
110
|
+
|
111
|
+
"yom_kippur(year)" => Proc.new { |year|
|
112
|
+
yom_kippur_dates = {
|
113
|
+
'2014' => Date.civil(2014, 10, 4),
|
114
|
+
'2015' => Date.civil(2015, 9, 23),
|
115
|
+
'2016' => Date.civil(2016, 10, 12),
|
116
|
+
'2017' => Date.civil(2017, 9, 30),
|
117
|
+
'2018' => Date.civil(2018, 9, 19),
|
118
|
+
'2019' => Date.civil(2019, 10, 9),
|
119
|
+
'2020' => Date.civil(2020, 9, 28)
|
120
|
+
}
|
121
|
+
yom_kippur_dates[year.to_s]
|
122
|
+
},
|
123
|
+
|
124
|
+
"georgia_state_holiday(year, month)" => Proc.new { |year, month|
|
125
|
+
beginning_of_month = Date.civil(year, month, 1)
|
126
|
+
state_holiday = Date.civil(year, month, 26)
|
127
|
+
state_holiday.downto(beginning_of_month).find {|date| date if date.wday == 1 }
|
128
|
+
},
|
129
|
+
|
130
|
+
"lee_jackson_day(year, month)" => Proc.new { |year, month|
|
131
|
+
day_of_holiday = Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, month, 3, 1)
|
132
|
+
beginning_of_month = Date.civil(year, month, 1)
|
133
|
+
king_day = Date.civil(year, month, day_of_holiday)
|
134
|
+
king_day.downto(beginning_of_month).find {|date| date if date.wday == 5 }
|
135
|
+
},
|
136
|
+
|
137
|
+
"election_day(year)" => Proc.new { |year|
|
138
|
+
Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 11, 1, 1) + 1
|
139
|
+
},
|
140
|
+
|
141
|
+
"us_inauguration_day(year)" => Proc.new { |year|
|
45
142
|
year % 4 == 1 ? 20 : nil
|
46
143
|
},
|
47
144
|
|
data/lib/holidays/version.rb
CHANGED
data/test/coverage_report.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
require 'simplecov'
|
2
|
-
require '
|
2
|
+
require 'simplecov-rcov'
|
3
3
|
|
4
|
-
SimpleCov.
|
4
|
+
SimpleCov.minimum_coverage 99
|
5
|
+
SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
|
6
|
+
SimpleCov.coverage_dir 'reports/coverage'
|
5
7
|
SimpleCov.start do
|
6
8
|
add_filter 'lib/generated_definitions/'
|
7
9
|
end
|
data/test/defs/test_defs_au.rb
CHANGED
@@ -98,7 +98,7 @@ assert_equal "Boxing Day", Date.civil(2015, 12, 28).holidays(:au_qld, :observed)
|
|
98
98
|
|
99
99
|
# BOXING DAY - SA gets monday only. same for TAS and NT.
|
100
100
|
assert_nil Date.civil(2015, 12, 26).holidays(:au_sa)[0]
|
101
|
-
assert_equal "
|
101
|
+
assert_equal "Proclamation Day", Date.civil(2015, 12, 28).holidays(:au_sa)[0][:name]
|
102
102
|
assert_nil Date.civil(2015, 12, 26).holidays(:au_tas)[0]
|
103
103
|
assert_equal "Boxing Day", Date.civil(2015, 12, 28).holidays(:au_tas)[0][:name]
|
104
104
|
assert_nil Date.civil(2015, 12, 26).holidays(:au_nt)[0]
|
@@ -128,7 +128,7 @@ assert_equal "Christmas Day", Date.civil(2016, 12, 27).holidays(:au_wa, :observe
|
|
128
128
|
# CHRISTMAS DAY - SA observes on 26th if 25th is a Sunday (Boxing Day goes to 27th)
|
129
129
|
assert_equal "Christmas Day", Date.civil(2016, 12, 25).holidays(:au_sa)[0][:name]
|
130
130
|
assert_equal "Christmas Day", Date.civil(2016, 12, 26).holidays(:au_sa, :observed)[0][:name]
|
131
|
-
assert_equal "
|
131
|
+
assert_equal "Proclamation Day", Date.civil(2016, 12, 27).holidays(:au_sa)[0][:name]
|
132
132
|
|
133
133
|
# CHRISTMAS DAY - Victoria and NT now observe both 25th and 27th if weekend
|
134
134
|
assert_equal "Christmas Day", Date.civil(2016, 12, 25).holidays(:au_vic)[0][:name]
|
data/test/defs/test_defs_de.rb
CHANGED
@@ -7,78 +7,80 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
|
7
7
|
class DeDefinitionTests < Test::Unit::TestCase # :nodoc:
|
8
8
|
|
9
9
|
def test_de
|
10
|
-
{Date.civil(2009,1,1) => 'Neujahrstag',
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
10
|
+
{ Date.civil(2009, 1, 1) => 'Neujahrstag',
|
11
|
+
Date.civil(2009, 4, 10) => 'Karfreitag',
|
12
|
+
Date.civil(2009, 4, 12) => 'Ostersonntag',
|
13
|
+
Date.civil(2009, 4, 13) => 'Ostermontag',
|
14
|
+
Date.civil(2009, 5, 1) => 'Tag der Arbeit',
|
15
|
+
Date.civil(2009, 5, 21) => 'Christi Himmelfahrt',
|
16
|
+
Date.civil(2009, 5, 31) => 'Pfingstsonntag',
|
17
|
+
Date.civil(2009, 6, 1) => 'Pfingstmontag',
|
18
|
+
Date.civil(2009, 10, 3) => 'Tag der Deutschen Einheit',
|
19
|
+
Date.civil(2009, 12, 24) => 'Heilig Abend',
|
20
|
+
Date.civil(2009, 12, 25) => '1. Weihnachtstag',
|
21
|
+
Date.civil(2009, 12, 26) => '2. Weihnachtstag',
|
22
|
+
Date.civil(2009, 12, 31) => 'Silvester' }.each do |date, name|
|
23
23
|
assert_equal name, (Holidays.on(date, :de, :informal)[0] || {})[:name], "Failed on '#{name}' for date '#{date}'"
|
24
24
|
end
|
25
25
|
|
26
26
|
[:de_bw, :de_by, :de_st, :de_].each do |r|
|
27
|
-
assert_equal 'Heilige Drei Könige', Holidays.on(Date.civil(2009,1,6), r)[0][:name]
|
27
|
+
assert_equal 'Heilige Drei Könige', Holidays.on(Date.civil(2009, 1, 6), r)[0][:name]
|
28
28
|
end
|
29
29
|
|
30
|
-
[
|
31
|
-
|
30
|
+
assert_equal [],Holidays.on(Date.civil(2017, 6, 15), [:de_th, :de_sn])
|
31
|
+
[:de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_sn_sorbian, :de_th_cath].each do |r|
|
32
|
+
assert_equal 'Fronleichnam', Holidays.on(Date.civil(2017, 6, 15), r)[0][:name]
|
32
33
|
end
|
33
34
|
|
34
|
-
[
|
35
|
-
|
35
|
+
assert_equal [], Holidays.on(Date.civil(2017, 8, 15), [:de_by, :de_sn])
|
36
|
+
[:de_by_cath, :de_by_augsburg, :de_sl].each do |r|
|
37
|
+
assert_equal 'Mariä Himmelfahrt', Holidays.on(Date.civil(2017, 8, 15), r)[0][:name]
|
36
38
|
end
|
37
39
|
|
38
|
-
[:de_bb, :de_mv, :de_sn, :de_st, :de_th, :de_].each do |r|
|
39
|
-
assert_equal 'Reformationstag', Holidays.on(Date.civil(
|
40
|
+
[:de_sh, :de_ni, :de_hh, :de_hb, :de_be, :de_bb, :de_mv, :de_sn, :de_st, :de_th, :de_].each do |r|
|
41
|
+
assert_equal 'Reformationstag', Holidays.on(Date.civil(2017, 10, 31), r)[0][:name]
|
40
42
|
end
|
41
43
|
|
42
44
|
# Free day in schools
|
43
45
|
[:de_bw].each do |r|
|
44
|
-
assert_equal 'Reformationstag', Holidays.on(Date.civil(2009,10,31), r, :informal)[0][:name]
|
46
|
+
assert_equal 'Reformationstag', Holidays.on(Date.civil(2009, 10, 31), r, :informal)[0][:name]
|
45
47
|
end
|
46
48
|
|
47
49
|
# 500 years reformation in 2017
|
48
|
-
assert_equal 'Reformationstag', Holidays.on(Date.civil(2017,10,31), :de)[0][:name]
|
49
|
-
assert_equal [], Holidays.on(Date.civil(2016,10,31), :de), "Reformationstag is not a holiday in 2016 in whole Germany"
|
50
|
-
assert_equal [], Holidays.on(Date.civil(2018,10,31), :de), "Reformationstag is not a holiday in 2018 in whole Germany"
|
50
|
+
assert_equal 'Reformationstag', Holidays.on(Date.civil(2017, 10, 31), :de)[0][:name]
|
51
|
+
assert_equal [], Holidays.on(Date.civil(2016, 10, 31), :de), "Reformationstag is not a holiday in 2016 in whole Germany"
|
52
|
+
assert_equal [], Holidays.on(Date.civil(2018, 10, 31), :de), "Reformationstag is not a holiday in 2018 in whole Germany"
|
51
53
|
|
52
54
|
[:de_bw, :de_by, :de_nw, :de_rp, :de_sl, :de_].each do |r|
|
53
|
-
assert_equal 'Allerheiligen', Holidays.on(Date.civil(2009,11,1), r)[0][:name]
|
55
|
+
assert_equal 'Allerheiligen', Holidays.on(Date.civil(2009, 11, 1), r)[0][:name]
|
54
56
|
end
|
55
57
|
|
56
58
|
[:de_by_augsburg].each do |r|
|
57
|
-
assert_equal 'Friedensfest', Holidays.on(Date.civil(2015,8,8),r)[0][:name]
|
59
|
+
assert_equal 'Friedensfest', Holidays.on(Date.civil(2015, 8, 8), r)[0][:name]
|
58
60
|
end
|
59
61
|
|
60
62
|
[:de,
|
61
63
|
:de_bw, :de_by, :de_bb, :de_he, :de_mv,
|
62
64
|
:de_nw, :de_rp, :de_sl, :de_sn, :de_st, :de_th].each do |r|
|
63
|
-
assert_equal [], Holidays.on(Date.civil(2015,8,8), r), "Friedensfest is not a holiday in #{r}"
|
65
|
+
assert_equal [], Holidays.on(Date.civil(2015, 8, 8), r), "Friedensfest is not a holiday in #{r}"
|
64
66
|
end
|
65
67
|
|
66
|
-
assert_equal [], Holidays.on(Date.civil(2010,5,8), :de), '2010-05-08 is not a holiday in Germany'
|
68
|
+
assert_equal [], Holidays.on(Date.civil(2010, 5, 8), :de), '2010-05-08 is not a holiday in Germany'
|
67
69
|
|
68
|
-
assert_equal [], Holidays.on(Date.civil(2010,8,8), :de), '2010-08-08 is not a holiday in Germany'
|
70
|
+
assert_equal [], Holidays.on(Date.civil(2010, 8, 8), :de), '2010-08-08 is not a holiday in Germany'
|
69
71
|
|
70
72
|
# Repentance Day
|
71
|
-
assert_equal 'Buß- und Bettag', Holidays.on(Date.civil(2004,11,17), :de_sn)[0][:name]
|
72
|
-
assert_equal 'Buß- und Bettag', Holidays.on(Date.civil(2005,11,16), :de_sn)[0][:name]
|
73
|
-
assert_equal 'Buß- und Bettag', Holidays.on(Date.civil(2006,11,22), :de_sn)[0][:name]
|
74
|
-
assert_equal 'Buß- und Bettag', Holidays.on(Date.civil(2009,11,18), :de_sn)[0][:name]
|
73
|
+
assert_equal 'Buß- und Bettag', Holidays.on(Date.civil(2004, 11, 17), :de_sn)[0][:name]
|
74
|
+
assert_equal 'Buß- und Bettag', Holidays.on(Date.civil(2005, 11, 16), :de_sn)[0][:name]
|
75
|
+
assert_equal 'Buß- und Bettag', Holidays.on(Date.civil(2006, 11, 22), :de_sn)[0][:name]
|
76
|
+
assert_equal 'Buß- und Bettag', Holidays.on(Date.civil(2009, 11, 18), :de_sn)[0][:name]
|
75
77
|
|
76
78
|
# Carnival
|
77
79
|
[:de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_sn].each do |r|
|
78
|
-
assert_equal 'Weiberfastnacht', Holidays.on(Date.civil(2016,2,4),r
|
79
|
-
assert_equal 'Rosenmontag', Holidays.on(Date.civil(2016,2,8),r
|
80
|
-
assert_equal 'Aschermittwoch', Holidays.on(Date.civil(2016,2,10),r
|
81
|
-
|
80
|
+
assert_equal 'Weiberfastnacht', Holidays.on(Date.civil(2016, 2, 4), r, :informal)[0][:name]
|
81
|
+
assert_equal 'Rosenmontag', Holidays.on(Date.civil(2016, 2, 8), r, :informal)[0][:name]
|
82
|
+
assert_equal 'Aschermittwoch', Holidays.on(Date.civil(2016, 2, 10), r, :informal)[0][:name]
|
83
|
+
end
|
82
84
|
|
83
85
|
end
|
84
86
|
end
|