holidays 5.5.1 → 5.6.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 +4 -0
- data/lib/generated_definitions/REGIONS.rb +2 -2
- data/lib/generated_definitions/ca.rb +9 -7
- data/lib/generated_definitions/north_america.rb +9 -7
- data/lib/holidays/version.rb +1 -1
- data/test/defs/test_defs_ca.rb +18 -11
- data/test/defs/test_defs_north_america.rb +18 -11
- data/test/integration/test_holidays.rb +22 -19
- metadata +31 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c97e25cf052981fecf15db7f9680138de6151ae4
|
4
|
+
data.tar.gz: 0124185d76176776055ffba97ff0c6bcdf256294
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b444c49d53ba79db33e085ee1273b1f22089871fb3474801774837ae9b270427d8d5bbdd2a01b191620035f30d4bac42310ba37a6965c5682bdae2d6db9b049d
|
7
|
+
data.tar.gz: 58bce320857a492e4d5ee0bb73460c211900f5c91fca5d82bd21317d880e32fdd1e06dea99789bc845c3290ee7075de63ed03e9b20e49444bb3228d76c337116
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,6 @@
|
|
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_wa, :au_tas, :au_tas_south, :au_qld_cairns, :au_qld_brisbane, :au_tas_north, :au_vic_melbourne, :be_fr, :be_nl, :br, :bg_en, :bg_bg, :ca, :ca_qc, :ca_ab, :ca_sk, :ca_on, :ca_bc, :ca_mb, :ca_ns, :ca_pe, :ca_nl, :ca_nt, :ca_nu, :
|
3
|
+
REGIONS = [:ar, :at, :au, :au_nsw, :au_vic, :au_qld, :au_nt, :au_act, :au_sa, :au_wa, :au_tas, :au_tas_south, :au_qld_cairns, :au_qld_brisbane, :au_tas_north, :au_vic_melbourne, :be_fr, :be_nl, :br, :bg_en, :bg_bg, :ca, :ca_qc, :ca_ab, :ca_sk, :ca_on, :ca_bc, :ca_mb, :ca_ns, :ca_pe, :ca_nl, :ca_nt, :ca_nu, :ca_yt, :ca_nb, :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_sn_sorbian, :de_th_eichsfeld, :de_sn, :de_st, :de_by_augsburg, :de_bb, :de_mv, :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, :hk, :hu, :ie, :is, :it, :kr, :li, :lt, :ma, :mx, :mx_pue, :nerc, :nl, :lu, :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, :pe, :ph, :pl, :pt, :ro, :se, :tn, :us_dc, :us_ca, :united_nations, :ups, :za, :sk, :si, :jp, :ve, :vi, :sg, :my]
|
4
4
|
|
5
|
-
PARENT_REGION_LOOKUP = {:ar=>:ar, :at=>:at, :au=>:au, :au_nsw=>:au, :au_vic=>:au, :au_qld=>:au, :au_nt=>:au, :au_act=>:au, :au_sa=>:au, :au_wa=>:au, :au_tas=>:au, :au_tas_south=>:au, :au_qld_cairns=>:au, :au_qld_brisbane=>:au, :au_tas_north=>:au, :au_vic_melbourne=>:au, :be_fr=>:be_fr, :be_nl=>:be_nl, :br=>:br, :bg_en=>:bg, :bg_bg=>:bg, :ca=>:ca, :ca_qc=>:ca, :ca_ab=>:ca, :ca_sk=>:ca, :ca_on=>:ca, :ca_bc=>:ca, :ca_mb=>:ca, :ca_ns=>:ca, :ca_pe=>:ca, :ca_nl=>:ca, :ca_nt=>:ca, :ca_nu=>:ca, :
|
5
|
+
PARENT_REGION_LOOKUP = {:ar=>:ar, :at=>:at, :au=>:au, :au_nsw=>:au, :au_vic=>:au, :au_qld=>:au, :au_nt=>:au, :au_act=>:au, :au_sa=>:au, :au_wa=>:au, :au_tas=>:au, :au_tas_south=>:au, :au_qld_cairns=>:au, :au_qld_brisbane=>:au, :au_tas_north=>:au, :au_vic_melbourne=>:au, :be_fr=>:be_fr, :be_nl=>:be_nl, :br=>:br, :bg_en=>:bg, :bg_bg=>:bg, :ca=>:ca, :ca_qc=>:ca, :ca_ab=>:ca, :ca_sk=>:ca, :ca_on=>:ca, :ca_bc=>:ca, :ca_mb=>:ca, :ca_ns=>:ca, :ca_pe=>:ca, :ca_nl=>:ca, :ca_nt=>:ca, :ca_nu=>:ca, :ca_yt=>:ca, :ca_nb=>:ca, :us=>:ca, :ch_zh=>:ch, :ch_be=>:ch, :ch_lu=>:ch, :ch_ur=>:ch, :ch_sz=>:ch, :ch_ow=>:ch, :ch_nw=>:ch, :ch_gl=>:ch, :ch_zg=>:ch, :ch_fr=>:ch, :ch_so=>:ch, :ch_bs=>:ch, :ch_bl=>:ch, :ch_sh=>:ch, :ch_ar=>:ch, :ch_ai=>:ch, :ch_sg=>:ch, :ch_gr=>:ch, :ch_ag=>:ch, :ch_tg=>:ch, :ch_ti=>:ch, :ch_vd=>:ch, :ch_ne=>:ch, :ch_ge=>:ch, :ch_ju=>:ch, :ch_vs=>:ch, :ch=>:ch, :cl=>:cl, :cr=>:cr, :cz=>:cz, :dk=>:dk, :de=>:de, :de_bw=>:de, :de_by=>:de, :de_he=>:de, :de_nw=>:de, :de_rp=>:de, :de_sl=>:de, :de_sn_sorbian=>:de, :de_th_eichsfeld=>:de, :de_sn=>:de, :de_st=>:de, :de_by_augsburg=>:de, :de_bb=>:de, :de_mv=>:de, :de_th=>:de, :ecb_target=>:ecb_target, :el=>:el, :es_pv=>:es, :es_na=>:es, :es_an=>:es, :es_ib=>:es, :es_cm=>:es, :es_mu=>:es, :es_m=>:es, :es_ar=>:es, :es_cl=>:es, :es_cn=>:es, :es_lo=>:es, :es_ga=>:es, :es_ce=>:es, :es_o=>:es, :es_ex=>:es, :es=>:es, :es_ct=>:es, :es_v=>:es, :es_vc=>:es, :federal_reserve=>:federal_reserve, :fedex=>:fedex, :fi=>:fi, :fr=>:fr, :gb=>:gb, :gb_eng=>:gb, :gb_wls=>:gb, :gb_eaw=>:gb, :gb_nir=>:gb, :gb_sct=>:gb, :gb_con=>:gb, :je=>:gb, :gb_jsy=>:gb, :gg=>:gb, :gb_gsy=>:gb, :im=>:gb, :gb_iom=>:gb, :hr=>:hr, :hk=>:hk, :hu=>:hu, :ie=>:ie, :is=>:is, :it=>:it, :kr=>:kr, :li=>:li, :lt=>:lt, :ma=>:ma, :mx=>:mx, :mx_pue=>:mx, :nerc=>:nerc, :nl=>:nl, :lu=>:lu, :no=>:no, :nyse=>:nyse, :nz=>:nz, :nz_sl=>:nz, :nz_we=>:nz, :nz_ak=>:nz, :nz_nl=>:nz, :nz_ne=>:nz, :nz_ot=>:nz, :nz_ta=>:nz, :nz_sc=>:nz, :nz_hb=>:nz, :nz_mb=>:nz, :nz_ca=>:nz, :nz_ch=>:nz, :nz_wl=>:nz, :pe=>:pe, :ph=>:ph, :pl=>:pl, :pt=>:pt, :ro=>:ro, :se=>:se, :tn=>:tn, :us_dc=>:us, :us_ca=>:us, :united_nations=>:united_nations, :ups=>:ups, :za=>:za, :sk=>:europe, :si=>:europe, :jp=>:jp, :ve=>:ve, :vi=>:vi, :sg=>:sg, :my=>:my}
|
6
6
|
end
|
@@ -7,13 +7,13 @@ module Holidays
|
|
7
7
|
# All the definitions are available at https://github.com/holidays/holidays
|
8
8
|
module CA # :nodoc:
|
9
9
|
def self.defined_regions
|
10
|
-
[:ca, :ca_qc, :ca_ab, :ca_sk, :ca_on, :ca_bc, :ca_mb, :ca_ns, :ca_pe, :ca_nl, :ca_nt, :ca_nu, :
|
10
|
+
[:ca, :ca_qc, :ca_ab, :ca_sk, :ca_on, :ca_bc, :ca_mb, :ca_ns, :ca_pe, :ca_nl, :ca_nt, :ca_nu, :ca_yt, :ca_nb, :us]
|
11
11
|
end
|
12
12
|
|
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 => [:ca]},
|
16
|
-
{:function => "easter(year)", :function_arguments => [:year], :name => "Easter Sunday", :regions => [:ca]},
|
16
|
+
{:function => "easter(year)", :function_arguments => [:year], :type => :informal, :name => "Easter Sunday", :regions => [:ca]},
|
17
17
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :type => :informal, :name => "Easter Monday", :regions => [:ca]}],
|
18
18
|
1 => [{:mday => 1, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "New Year's Day", :regions => [:ca]},
|
19
19
|
{:mday => 2, :name => "New Year's", :regions => [:ca_qc]}],
|
@@ -28,7 +28,7 @@ module Holidays
|
|
28
28
|
{:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
|
29
29
|
3 => [{:mday => 23, :name => "St. George's Day", :regions => [:ca_nl]},
|
30
30
|
{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
|
31
|
-
5 => [{:function => "ca_victoria_day(year)", :function_arguments => [:year], :name => "Victoria Day", :regions => [:
|
31
|
+
5 => [{:function => "ca_victoria_day(year)", :function_arguments => [:year], :name => "Victoria Day", :regions => [:ca_ab, :ca_bc, :ca_mb, :ca_nt, :ca_nu, :ca_on, :ca_sk, :ca_yt]},
|
32
32
|
{:function => "ca_victoria_day(year)", :function_arguments => [:year], :name => "National Patriotes Day", :regions => [:ca_qc]},
|
33
33
|
{:wday => 0, :week => 2, :type => :informal, :name => "Mother's Day", :regions => [:us, :ca]},
|
34
34
|
{:wday => 6, :week => 3, :type => :informal, :name => "Armed Forces Day", :regions => [:us]}],
|
@@ -39,19 +39,21 @@ module Holidays
|
|
39
39
|
7 => [{:mday => 1, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Canada Day", :regions => [:ca]},
|
40
40
|
{:mday => 12, :name => "Orangemen's Day", :regions => [:ca_nl]},
|
41
41
|
{:mday => 9, :name => "Nunavut Day", :regions => [:ca_nu]}],
|
42
|
-
8 => [{:wday => 1, :week => 1, :name => "
|
42
|
+
8 => [{:wday => 1, :week => 1, :name => "B.C. Day", :regions => [:ca_bc]},
|
43
43
|
{:wday => 1, :week => 1, :name => "Saskatchewan Day", :regions => [:ca_sk]},
|
44
44
|
{:wday => 1, :week => 1, :name => "Heritage Day", :regions => [:ca_ab]},
|
45
45
|
{:wday => 1, :week => 1, :name => "Natal Day", :regions => [:ca_ns]},
|
46
|
-
{:wday => 1, :week => 1, :name => "Civic Holiday", :regions => [:
|
46
|
+
{:wday => 1, :week => 1, :name => "Civic Holiday", :regions => [:ca_nt, :ca_nu, :ca_pe]},
|
47
|
+
{:wday => 1, :week => 1, :type => :informal, :name => "Civic Holiday", :regions => [:ca_on]},
|
47
48
|
{:wday => 1, :week => 1, :name => "New Brunswick Day", :regions => [:ca_nb]},
|
48
49
|
{:wday => 1, :week => 3, :name => "Discovery Day", :regions => [:ca_yt]}],
|
49
50
|
9 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:ca]}],
|
50
|
-
10 => [{:wday => 1, :week => 2, :name => "Thanksgiving", :regions => [:
|
51
|
+
10 => [{:wday => 1, :week => 2, :name => "Thanksgiving", :regions => [:ca_ab, :ca_bc, :ca_mb, :ca_nt, :ca_nu, :ca_on, :ca_sk, :ca_yt]},
|
51
52
|
{:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}],
|
52
53
|
11 => [{:mday => 11, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Remembrance Day", :regions => [:ca_ab, :ca_sk, :ca_bc, :ca_pe, :ca_nl, :ca_nt, :ca_nu, :ca_nb, :ca_yt]}],
|
53
54
|
12 => [{:mday => 25, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Christmas Day", :regions => [:ca]},
|
54
|
-
{:mday => 26, :observed => "to_weekday_if_boxing_weekend(date)", :observed_arguments => [:date], :name => "Boxing Day", :regions => [:
|
55
|
+
{:mday => 26, :observed => "to_weekday_if_boxing_weekend(date)", :observed_arguments => [:date], :name => "Boxing Day", :regions => [:ca_on]},
|
56
|
+
{:mday => 26, :observed => "to_weekday_if_boxing_weekend(date)", :observed_arguments => [:date], :type => :informal, :name => "Boxing Day", :regions => [:ca_ab, :ca_bc, :ca_mb, :ca_nb, :ca_nl, :ca_nt, :ca_ns, :ca_nu, :ca_pe, :ca_sk, :ca_yt]}],
|
55
57
|
4 => [{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
|
56
58
|
{:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}]
|
57
59
|
}
|
@@ -7,13 +7,13 @@ module Holidays
|
|
7
7
|
# All the definitions are available at https://github.com/holidays/holidays
|
8
8
|
module NORTH_AMERICA # :nodoc:
|
9
9
|
def self.defined_regions
|
10
|
-
[:ca, :ca_qc, :ca_ab, :ca_sk, :ca_on, :ca_bc, :ca_mb, :ca_ns, :ca_pe, :ca_nl, :ca_nt, :ca_nu, :
|
10
|
+
[:ca, :ca_qc, :ca_ab, :ca_sk, :ca_on, :ca_bc, :ca_mb, :ca_ns, :ca_pe, :ca_nl, :ca_nt, :ca_nu, :ca_yt, :ca_nb, :mx, :mx_pue, :us, :us_dc, :us_ca]
|
11
11
|
end
|
12
12
|
|
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 => [:ca]},
|
16
|
-
{:function => "easter(year)", :function_arguments => [:year], :name => "Easter Sunday", :regions => [:ca]},
|
16
|
+
{:function => "easter(year)", :function_arguments => [:year], :type => :informal, :name => "Easter Sunday", :regions => [:ca]},
|
17
17
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :type => :informal, :name => "Easter Monday", :regions => [:ca]},
|
18
18
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :type => :informal, :name => "Good Friday", :regions => [:us]},
|
19
19
|
{:function => "easter(year)", :function_arguments => [:year], :type => :informal, :name => "Easter Sunday", :regions => [:us]}],
|
@@ -39,7 +39,7 @@ module Holidays
|
|
39
39
|
{:wday => 1, :week => 3, :name => "Natalicio de Benito Juárez", :regions => [:mx]},
|
40
40
|
{:mday => 31, :name => "Cesar Chavez Day", :regions => [:us_ca]},
|
41
41
|
{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
|
42
|
-
5 => [{:function => "ca_victoria_day(year)", :function_arguments => [:year], :name => "Victoria Day", :regions => [:
|
42
|
+
5 => [{:function => "ca_victoria_day(year)", :function_arguments => [:year], :name => "Victoria Day", :regions => [:ca_ab, :ca_bc, :ca_mb, :ca_nt, :ca_nu, :ca_on, :ca_sk, :ca_yt]},
|
43
43
|
{:function => "ca_victoria_day(year)", :function_arguments => [:year], :name => "National Patriotes Day", :regions => [:ca_qc]},
|
44
44
|
{:mday => 1, :name => "Día del Trabajo", :regions => [:mx]},
|
45
45
|
{:mday => 5, :type => :informal, :name => "Cinco de Mayo", :regions => [:mx]},
|
@@ -58,18 +58,19 @@ module Holidays
|
|
58
58
|
{:mday => 12, :name => "Orangemen's Day", :regions => [:ca_nl]},
|
59
59
|
{:mday => 9, :name => "Nunavut Day", :regions => [:ca_nu]},
|
60
60
|
{:mday => 4, :observed => "to_weekday_if_weekend(date)", :observed_arguments => [:date], :name => "Independence Day", :regions => [:us]}],
|
61
|
-
8 => [{:wday => 1, :week => 1, :name => "
|
61
|
+
8 => [{:wday => 1, :week => 1, :name => "B.C. Day", :regions => [:ca_bc]},
|
62
62
|
{:wday => 1, :week => 1, :name => "Saskatchewan Day", :regions => [:ca_sk]},
|
63
63
|
{:wday => 1, :week => 1, :name => "Heritage Day", :regions => [:ca_ab]},
|
64
64
|
{:wday => 1, :week => 1, :name => "Natal Day", :regions => [:ca_ns]},
|
65
|
-
{:wday => 1, :week => 1, :name => "Civic Holiday", :regions => [:
|
65
|
+
{:wday => 1, :week => 1, :name => "Civic Holiday", :regions => [:ca_nt, :ca_nu, :ca_pe]},
|
66
|
+
{:wday => 1, :week => 1, :type => :informal, :name => "Civic Holiday", :regions => [:ca_on]},
|
66
67
|
{:wday => 1, :week => 1, :name => "New Brunswick Day", :regions => [:ca_nb]},
|
67
68
|
{:wday => 1, :week => 3, :name => "Discovery Day", :regions => [:ca_yt]}],
|
68
69
|
9 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:ca]},
|
69
70
|
{:mday => 15, :name => "Grito de Dolores", :regions => [:mx]},
|
70
71
|
{:mday => 16, :name => "Día de la Independencia", :regions => [:mx]},
|
71
72
|
{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:us]}],
|
72
|
-
10 => [{:wday => 1, :week => 2, :name => "Thanksgiving", :regions => [:
|
73
|
+
10 => [{:wday => 1, :week => 2, :name => "Thanksgiving", :regions => [:ca_ab, :ca_bc, :ca_mb, :ca_nt, :ca_nu, :ca_on, :ca_sk, :ca_yt]},
|
73
74
|
{:mday => 12, :type => :informal, :name => "Día de la Raza", :regions => [:mx]},
|
74
75
|
{:wday => 1, :week => 2, :name => "Columbus Day", :regions => [:us]},
|
75
76
|
{:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}],
|
@@ -81,7 +82,8 @@ module Holidays
|
|
81
82
|
{:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:us]},
|
82
83
|
{:function => "day_after_thanksgiving(year)", :function_arguments => [:year], :name => "Day after Thanksgiving", :regions => [:us_ca]}],
|
83
84
|
12 => [{:mday => 25, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Christmas Day", :regions => [:ca]},
|
84
|
-
{:mday => 26, :observed => "to_weekday_if_boxing_weekend(date)", :observed_arguments => [:date], :name => "Boxing Day", :regions => [:
|
85
|
+
{:mday => 26, :observed => "to_weekday_if_boxing_weekend(date)", :observed_arguments => [:date], :name => "Boxing Day", :regions => [:ca_on]},
|
86
|
+
{:mday => 26, :observed => "to_weekday_if_boxing_weekend(date)", :observed_arguments => [:date], :type => :informal, :name => "Boxing Day", :regions => [:ca_ab, :ca_bc, :ca_mb, :ca_nb, :ca_nl, :ca_nt, :ca_ns, :ca_nu, :ca_pe, :ca_sk, :ca_yt]},
|
85
87
|
{:mday => 12, :type => :informal, :name => "Día de la Virgen de Guadalupe", :regions => [:mx]},
|
86
88
|
{:mday => 24, :type => :informal, :name => "Nochebuena", :regions => [:mx]},
|
87
89
|
{:mday => 25, :name => "Navidad", :regions => [:mx]},
|
data/lib/holidays/version.rb
CHANGED
data/test/defs/test_defs_ca.rb
CHANGED
@@ -11,12 +11,9 @@ class CaDefinitionTests < Test::Unit::TestCase # :nodoc:
|
|
11
11
|
Date.civil(2008,3,21) => 'Good Friday',
|
12
12
|
Date.civil(2013,3,31) => 'Easter Sunday',
|
13
13
|
Date.civil(2008,3,24) => 'Easter Monday',
|
14
|
-
Date.civil(2008,5,19) => 'Victoria Day',
|
15
14
|
Date.civil(2008,7,1) => 'Canada Day',
|
16
15
|
Date.civil(2008,9,1) => 'Labour Day',
|
17
|
-
Date.civil(2008,
|
18
|
-
Date.civil(2008,12,25) => 'Christmas Day',
|
19
|
-
Date.civil(2008,12,26) => 'Boxing Day'}.each do |date, name|
|
16
|
+
Date.civil(2008,12,25) => 'Christmas Day'}.each do |date, name|
|
20
17
|
assert_equal name, (Holidays.on(date, :ca, :informal)[0] || {})[:name]
|
21
18
|
end
|
22
19
|
|
@@ -123,27 +120,37 @@ end
|
|
123
120
|
assert_equal 'Islander Day', Holidays.on(date, :ca_pe)[0][:name]
|
124
121
|
end
|
125
122
|
|
123
|
+
|
126
124
|
# Victoria Day
|
127
|
-
[
|
128
|
-
|
129
|
-
|
125
|
+
[:ca_ab, :ca_bc, :ca_mb, :ca_nt, :ca_nu, :ca_on, :ca_sk, :ca_yt].each do |r|
|
126
|
+
[
|
127
|
+
Date.civil(2004,5,24), Date.civil(2005,5,23), Date.civil(2006,5,22),
|
128
|
+
Date.civil(2007,5,21), Date.civil(2008,5,19)
|
129
|
+
].each do |date|
|
130
|
+
assert_equal 'Victoria Day', Holidays.on(date, r)[0][:name]
|
131
|
+
end
|
130
132
|
end
|
131
133
|
|
132
134
|
# First Monday in August
|
133
135
|
[Date.civil(2013,8,5), Date.civil(2014,8,4), Date.civil(2015,8,3)].each do |date|
|
134
|
-
{ :ca_bc => '
|
136
|
+
{ :ca_bc => 'B.C. Day',
|
135
137
|
:ca_sk => 'Saskatchewan Day',
|
136
138
|
:ca_ab => 'Heritage Day',
|
137
139
|
:ca_ns => 'Natal Day',
|
138
|
-
:ca_on => 'Civic Holiday',
|
139
140
|
:ca_nt => 'Civic Holiday',
|
140
141
|
:ca_nu => 'Civic Holiday',
|
141
142
|
:ca_pe => 'Civic Holiday',
|
142
|
-
:ca_nb => 'New Brunswick Day'
|
143
|
+
:ca_nb => 'New Brunswick Day'
|
144
|
+
}.each do |region, name|
|
143
145
|
assert_equal name, Holidays.on(date, region)[0][:name]
|
144
146
|
end
|
145
147
|
end
|
146
148
|
|
149
|
+
# Civic Holiday is only by convention in :ca_on
|
150
|
+
[Date.civil(2013,8,5), Date.civil(2014,8,4), Date.civil(2015,8,3)].each do |date|
|
151
|
+
assert_equal 'Civic Holiday', Holidays.on(date, :ca_on, :informal)[0][:name]
|
152
|
+
end
|
153
|
+
|
147
154
|
# Remembrance Day in all Canadian provinces
|
148
155
|
# except (Nova Scotia, Manitoba, Ontario, and Quebec)
|
149
156
|
[
|
@@ -184,7 +191,7 @@ end
|
|
184
191
|
# Boxing Day observed date
|
185
192
|
[Date.civil(2010, 12, 28), Date.civil(2012, 12, 26), Date.civil(2016, 12, 27),
|
186
193
|
Date.civil(2015, 12, 28)].each do |date|
|
187
|
-
assert_equal 'Boxing Day', Holidays.on(date, :
|
194
|
+
assert_equal 'Boxing Day', Holidays.on(date, :ca_on, :observed)[0][:name]
|
188
195
|
end
|
189
196
|
|
190
197
|
|
@@ -11,12 +11,9 @@ class North_americaDefinitionTests < Test::Unit::TestCase # :nodoc:
|
|
11
11
|
Date.civil(2008,3,21) => 'Good Friday',
|
12
12
|
Date.civil(2013,3,31) => 'Easter Sunday',
|
13
13
|
Date.civil(2008,3,24) => 'Easter Monday',
|
14
|
-
Date.civil(2008,5,19) => 'Victoria Day',
|
15
14
|
Date.civil(2008,7,1) => 'Canada Day',
|
16
15
|
Date.civil(2008,9,1) => 'Labour Day',
|
17
|
-
Date.civil(2008,
|
18
|
-
Date.civil(2008,12,25) => 'Christmas Day',
|
19
|
-
Date.civil(2008,12,26) => 'Boxing Day'}.each do |date, name|
|
16
|
+
Date.civil(2008,12,25) => 'Christmas Day'}.each do |date, name|
|
20
17
|
assert_equal name, (Holidays.on(date, :ca, :informal)[0] || {})[:name]
|
21
18
|
end
|
22
19
|
|
@@ -123,27 +120,37 @@ end
|
|
123
120
|
assert_equal 'Islander Day', Holidays.on(date, :ca_pe)[0][:name]
|
124
121
|
end
|
125
122
|
|
123
|
+
|
126
124
|
# Victoria Day
|
127
|
-
[
|
128
|
-
|
129
|
-
|
125
|
+
[:ca_ab, :ca_bc, :ca_mb, :ca_nt, :ca_nu, :ca_on, :ca_sk, :ca_yt].each do |r|
|
126
|
+
[
|
127
|
+
Date.civil(2004,5,24), Date.civil(2005,5,23), Date.civil(2006,5,22),
|
128
|
+
Date.civil(2007,5,21), Date.civil(2008,5,19)
|
129
|
+
].each do |date|
|
130
|
+
assert_equal 'Victoria Day', Holidays.on(date, r)[0][:name]
|
131
|
+
end
|
130
132
|
end
|
131
133
|
|
132
134
|
# First Monday in August
|
133
135
|
[Date.civil(2013,8,5), Date.civil(2014,8,4), Date.civil(2015,8,3)].each do |date|
|
134
|
-
{ :ca_bc => '
|
136
|
+
{ :ca_bc => 'B.C. Day',
|
135
137
|
:ca_sk => 'Saskatchewan Day',
|
136
138
|
:ca_ab => 'Heritage Day',
|
137
139
|
:ca_ns => 'Natal Day',
|
138
|
-
:ca_on => 'Civic Holiday',
|
139
140
|
:ca_nt => 'Civic Holiday',
|
140
141
|
:ca_nu => 'Civic Holiday',
|
141
142
|
:ca_pe => 'Civic Holiday',
|
142
|
-
:ca_nb => 'New Brunswick Day'
|
143
|
+
:ca_nb => 'New Brunswick Day'
|
144
|
+
}.each do |region, name|
|
143
145
|
assert_equal name, Holidays.on(date, region)[0][:name]
|
144
146
|
end
|
145
147
|
end
|
146
148
|
|
149
|
+
# Civic Holiday is only by convention in :ca_on
|
150
|
+
[Date.civil(2013,8,5), Date.civil(2014,8,4), Date.civil(2015,8,3)].each do |date|
|
151
|
+
assert_equal 'Civic Holiday', Holidays.on(date, :ca_on, :informal)[0][:name]
|
152
|
+
end
|
153
|
+
|
147
154
|
# Remembrance Day in all Canadian provinces
|
148
155
|
# except (Nova Scotia, Manitoba, Ontario, and Quebec)
|
149
156
|
[
|
@@ -184,7 +191,7 @@ end
|
|
184
191
|
# Boxing Day observed date
|
185
192
|
[Date.civil(2010, 12, 28), Date.civil(2012, 12, 26), Date.civil(2016, 12, 27),
|
186
193
|
Date.civil(2015, 12, 28)].each do |date|
|
187
|
-
assert_equal 'Boxing Day', Holidays.on(date, :
|
194
|
+
assert_equal 'Boxing Day', Holidays.on(date, :ca_on, :observed)[0][:name]
|
188
195
|
end
|
189
196
|
|
190
197
|
|
@@ -90,9 +90,9 @@ class HolidaysTests < Test::Unit::TestCase
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def test_any_region
|
93
|
-
# Should return Victoria Day
|
93
|
+
# Should return nothing(Victoria Day is not celebrated :ca wide anymore)
|
94
94
|
holidays = Holidays.between(Date.civil(2008,5,1), Date.civil(2008,5,31), :ca)
|
95
|
-
assert_equal
|
95
|
+
assert_equal 0, holidays.length
|
96
96
|
|
97
97
|
# Should return Victoria Day and National Patriotes Day.
|
98
98
|
#
|
@@ -110,7 +110,7 @@ class HolidaysTests < Test::Unit::TestCase
|
|
110
110
|
# Should return Victoria Day.
|
111
111
|
holidays = Holidays.next_holidays(1, [:ca], Date.civil(2008,5,1))
|
112
112
|
assert_equal 1, holidays.length
|
113
|
-
assert_equal ['2008-
|
113
|
+
assert_equal ['2008-07-01','Canada Day'] , [holidays.first[:date].to_s, holidays.first[:name].to_s]
|
114
114
|
|
115
115
|
# Should return 2 holidays.
|
116
116
|
holidays = Holidays.next_holidays(2, [:ca], Date.civil(2008,5,1))
|
@@ -135,9 +135,9 @@ class HolidaysTests < Test::Unit::TestCase
|
|
135
135
|
end
|
136
136
|
|
137
137
|
def test_year_holidays
|
138
|
-
# Should return
|
138
|
+
# Should return 7 holidays from February 23 to December 31
|
139
139
|
holidays = Holidays.year_holidays([:ca_on], Date.civil(2016, 2, 23))
|
140
|
-
assert_equal
|
140
|
+
assert_equal 7, holidays.length
|
141
141
|
|
142
142
|
# Must have options (Regions)
|
143
143
|
assert_raises ArgumentError do
|
@@ -153,7 +153,7 @@ class HolidaysTests < Test::Unit::TestCase
|
|
153
153
|
def test_year_holidays_with_specified_year
|
154
154
|
# Should return all 11 holidays for 2016 in Ontario, Canada
|
155
155
|
holidays = Holidays.year_holidays([:ca_on], Date.civil(2016, 1, 1))
|
156
|
-
assert_equal
|
156
|
+
assert_equal 9, holidays.length
|
157
157
|
|
158
158
|
# Should return all 5 holidays for 2016 in Australia
|
159
159
|
holidays = Holidays.year_holidays([:au], Date.civil(2016, 1, 1))
|
@@ -197,30 +197,30 @@ class HolidaysTests < Test::Unit::TestCase
|
|
197
197
|
def test_year_holidays_random_years
|
198
198
|
# Should be 1 less holiday, as Family day didn't exist in Ontario in 1990
|
199
199
|
holidays = Holidays.year_holidays([:ca_on], Date.civil(1990, 1, 1))
|
200
|
-
assert_equal
|
200
|
+
assert_equal 8, holidays.length
|
201
201
|
|
202
202
|
# Family day still didn't exist in 2000
|
203
203
|
holidays = Holidays.year_holidays([:ca_on], Date.civil(2000, 1, 1))
|
204
|
-
assert_equal
|
204
|
+
assert_equal 8, holidays.length
|
205
205
|
|
206
206
|
holidays = Holidays.year_holidays([:ca_on], Date.civil(2020, 1, 1))
|
207
|
-
assert_equal
|
207
|
+
assert_equal 9, holidays.length
|
208
208
|
|
209
209
|
holidays = Holidays.year_holidays([:ca_on], Date.civil(2050, 1, 1))
|
210
|
-
assert_equal
|
210
|
+
assert_equal 9, holidays.length
|
211
211
|
|
212
212
|
holidays = Holidays.year_holidays([:jp], Date.civil(2070, 1, 1))
|
213
213
|
assert_equal 18, holidays.length
|
214
214
|
end
|
215
215
|
|
216
216
|
def test_sub_regions
|
217
|
-
# Should return Victoria Day
|
217
|
+
# Should return nothing (Victoria Day is no longer :ca wide)
|
218
218
|
holidays = Holidays.between(Date.civil(2008,5,1), Date.civil(2008,5,31), :ca)
|
219
|
-
assert_equal
|
219
|
+
assert_equal 0, holidays.length
|
220
220
|
|
221
|
-
## Should return
|
221
|
+
## Should return National Patriotes Day.
|
222
222
|
holidays = Holidays.between(Date.civil(2008,5,1), Date.civil(2008,5,31), :ca_qc)
|
223
|
-
assert_equal
|
223
|
+
assert_equal 1, holidays.length
|
224
224
|
|
225
225
|
# Should return Victoria Day and National Patriotes Day.
|
226
226
|
holidays = Holidays.between(Date.civil(2008,5,1), Date.civil(2008,5,31), :ca_)
|
@@ -229,21 +229,24 @@ class HolidaysTests < Test::Unit::TestCase
|
|
229
229
|
|
230
230
|
def test_sub_regions_holiday_next
|
231
231
|
# Should return Victoria Day.
|
232
|
-
holidays = Holidays.next_holidays(2, [:
|
232
|
+
holidays = Holidays.next_holidays(2, [:ca_bc], Date.civil(2008,5,1))
|
233
233
|
assert_equal 2, holidays.length
|
234
234
|
assert_equal ['2008-05-19','Victoria Day'] , [holidays.first[:date].to_s, holidays.first[:name].to_s]
|
235
235
|
|
236
236
|
# Should return Victoria Da and National Patriotes Day.
|
237
237
|
holidays = Holidays.next_holidays(2, [:ca_qc], Date.civil(2008,5,1))
|
238
238
|
assert_equal 2, holidays.length
|
239
|
-
assert_equal ['2008-
|
240
|
-
assert_equal ['2008-05-19','National Patriotes Day'] , [holidays.last[:date].to_s, holidays.last[:name].to_s]
|
239
|
+
assert_equal ['2008-06-24','Fête Nationale'] , [holidays.last[:date].to_s, holidays.last[:name].to_s]
|
241
240
|
|
242
241
|
# Should return Victoria Day and National Patriotes Day.
|
243
242
|
holidays = Holidays.next_holidays(2, [:ca_], Date.civil(2008,5,1))
|
244
243
|
assert_equal 2, holidays.length
|
245
|
-
|
246
|
-
|
244
|
+
|
245
|
+
# Aparently something in jruby doesn't sort the same way as other rubies so....we'll just do it ourselves so
|
246
|
+
# we don't flap.
|
247
|
+
sorted_holidays = holidays.sort_by { |h| h[:name] }
|
248
|
+
assert_equal ['2008-05-19','National Patriotes Day'] , [sorted_holidays.first[:date].to_s, sorted_holidays.first[:name].to_s]
|
249
|
+
assert_equal ['2008-05-19','Victoria Day'] , [sorted_holidays.last[:date].to_s, sorted_holidays.last[:name].to_s]
|
247
250
|
end
|
248
251
|
|
249
252
|
def test_easter_lambda
|
metadata
CHANGED
@@ -1,102 +1,101 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: holidays
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Dunae
|
8
8
|
- Phil Trimble
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-05-
|
12
|
+
date: 2017-05-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
16
|
+
version_requirements: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
16
21
|
requirement: !ruby/object:Gem::Requirement
|
17
22
|
requirements:
|
18
23
|
- - ">="
|
19
24
|
- !ruby/object:Gem::Version
|
20
25
|
version: '0'
|
21
|
-
type: :development
|
22
26
|
prerelease: false
|
27
|
+
type: :development
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rake
|
23
30
|
version_requirements: !ruby/object:Gem::Requirement
|
24
31
|
requirements:
|
25
32
|
- - ">="
|
26
33
|
- !ruby/object:Gem::Version
|
27
34
|
version: '0'
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: rake
|
30
35
|
requirement: !ruby/object:Gem::Requirement
|
31
36
|
requirements:
|
32
37
|
- - ">="
|
33
38
|
- !ruby/object:Gem::Version
|
34
39
|
version: '0'
|
35
|
-
type: :development
|
36
40
|
prerelease: false
|
41
|
+
type: :development
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: coveralls
|
37
44
|
version_requirements: !ruby/object:Gem::Requirement
|
38
45
|
requirements:
|
39
46
|
- - ">="
|
40
47
|
- !ruby/object:Gem::Version
|
41
48
|
version: '0'
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: coveralls
|
44
49
|
requirement: !ruby/object:Gem::Requirement
|
45
50
|
requirements:
|
46
51
|
- - ">="
|
47
52
|
- !ruby/object:Gem::Version
|
48
53
|
version: '0'
|
49
|
-
type: :development
|
50
54
|
prerelease: false
|
55
|
+
type: :development
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: test-unit
|
51
58
|
version_requirements: !ruby/object:Gem::Requirement
|
52
59
|
requirements:
|
53
60
|
- - ">="
|
54
61
|
- !ruby/object:Gem::Version
|
55
62
|
version: '0'
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: test-unit
|
58
63
|
requirement: !ruby/object:Gem::Requirement
|
59
64
|
requirements:
|
60
65
|
- - ">="
|
61
66
|
- !ruby/object:Gem::Version
|
62
67
|
version: '0'
|
63
|
-
type: :development
|
64
68
|
prerelease: false
|
65
|
-
|
66
|
-
requirements:
|
67
|
-
- - ">="
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
69
|
+
type: :development
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: mocha
|
72
|
-
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
76
|
version: '1.0'
|
77
|
-
|
78
|
-
prerelease: false
|
79
|
-
version_requirements: !ruby/object:Gem::Requirement
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
80
78
|
requirements:
|
81
79
|
- - "~>"
|
82
80
|
- !ruby/object:Gem::Version
|
83
81
|
version: '1.0'
|
82
|
+
prerelease: false
|
83
|
+
type: :development
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: pry
|
86
|
-
|
86
|
+
version_requirements: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
88
|
- - "~>"
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '0.10'
|
91
|
-
|
92
|
-
prerelease: false
|
93
|
-
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
94
92
|
requirements:
|
95
93
|
- - "~>"
|
96
94
|
- !ruby/object:Gem::Version
|
97
95
|
version: '0.10'
|
98
|
-
|
99
|
-
|
96
|
+
prerelease: false
|
97
|
+
type: :development
|
98
|
+
description: A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!
|
100
99
|
email:
|
101
100
|
- holidaysgem@gmail.com
|
102
101
|
executables: []
|
@@ -331,7 +330,7 @@ homepage: https://github.com/holidays/holidays
|
|
331
330
|
licenses:
|
332
331
|
- MIT
|
333
332
|
metadata: {}
|
334
|
-
post_install_message:
|
333
|
+
post_install_message:
|
335
334
|
rdoc_options: []
|
336
335
|
require_paths:
|
337
336
|
- lib
|
@@ -346,9 +345,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
346
345
|
- !ruby/object:Gem::Version
|
347
346
|
version: '0'
|
348
347
|
requirements: []
|
349
|
-
rubyforge_project:
|
350
|
-
rubygems_version: 2.
|
351
|
-
signing_key:
|
348
|
+
rubyforge_project:
|
349
|
+
rubygems_version: 2.4.8
|
350
|
+
signing_key:
|
352
351
|
specification_version: 4
|
353
352
|
summary: A collection of Ruby methods to deal with statutory and other holidays.
|
354
353
|
test_files:
|