holidays 9.1.1 → 9.2.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/.github/workflows/ruby.yml +2 -1
- data/CHANGELOG.md +10 -0
- data/Gemfile +5 -0
- data/Makefile +17 -2
- data/README.md +1 -2
- data/Rakefile +28 -0
- data/holidays.gemspec +3 -3
- data/lib/generated_definitions/MANIFEST +2 -0
- data/lib/generated_definitions/REGIONS.rb +2 -2
- data/lib/generated_definitions/europe.rb +5 -5
- data/lib/generated_definitions/fr.rb +2 -2
- data/lib/generated_definitions/gb.rb +3 -3
- data/lib/generated_definitions/il.rb +74 -0
- data/lib/generated_definitions/mc.rb +36 -0
- data/lib/generated_definitions/northamerica.rb +3 -2
- data/lib/generated_definitions/us.rb +3 -2
- data/lib/holidays/definition/context/function_processor.rb +1 -1
- data/lib/holidays/definition/context/merger.rb +20 -4
- data/lib/holidays/definition/repository/custom_methods.rb +37 -9
- data/lib/holidays/finder/context/search.rb +43 -24
- data/lib/holidays/version.rb +1 -1
- data/lib/holidays.rb +9 -4
- data/test/coverage_report.rb +3 -5
- data/test/data/test_date_transform_conflict_region_1.yaml +14 -0
- data/test/data/test_date_transform_conflict_region_2.yaml +14 -0
- data/test/defs/test_defs_europe.rb +7 -3
- data/test/defs/test_defs_fr.rb +3 -3
- data/test/defs/test_defs_gb.rb +4 -0
- data/test/defs/test_defs_il.rb +35 -0
- data/test/defs/test_defs_mc.rb +43 -0
- data/test/defs/test_defs_northamerica.rb +6 -1
- data/test/defs/test_defs_us.rb +6 -1
- data/test/e2e/README.md +52 -0
- data/test/e2e/data/test_multiple_regions_with_conflicts_region_3.yaml +38 -0
- data/test/{integration → e2e}/test_holidays.rb +3 -2
- data/test/e2e/test_multiple_regions_with_conflict.rb +228 -0
- data/test/holidays/definition/context/test_function_processor.rb +2 -2
- data/test/holidays/definition/context/test_merger.rb +1 -1
- data/test/holidays/finder/context/test_search.rb +58 -0
- data/test/integration/README.md +45 -6
- data/test/integration/test_custom_holidays.rb +1 -1
- data/test/integration/test_custom_informal_holidays.rb +1 -1
- data/test/smoke/README.md +31 -0
- data/test/{integration → smoke}/test_available_regions.rb +0 -5
- data/test/smoke/test_smoke.rb +74 -0
- metadata +51 -33
- data/test/integration/test_multiple_regions_with_conflict.rb +0 -29
- /data/test/{data → e2e/data}/test_multiple_regions_with_conflicts_region_1.yaml +0 -0
- /data/test/{data → e2e/data}/test_multiple_regions_with_conflicts_region_2.yaml +0 -0
- /data/test/{integration → e2e}/test_all_regions.rb +0 -0
- /data/test/{integration → e2e}/test_any_holidays_during_work_week.rb +0 -0
- /data/test/{integration → e2e}/test_holidays_between.rb +0 -0
- /data/test/{integration → e2e}/test_multiple_regions.rb +0 -0
- /data/test/{integration → e2e}/test_nonstandard_regions.rb +0 -0
- /data/test/{data → integration/data}/test_custom_govt_holiday_defs.yaml +0 -0
- /data/test/{data → integration/data}/test_custom_informal_holidays_defs.yaml +0 -0
- /data/test/{data → integration/data}/test_multiple_custom_holiday_defs.yaml +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c5df9d7c9191d51eb57d3d62573ea4ad0b606d8edf9e0d8f0c8e77ad980c69cc
|
|
4
|
+
data.tar.gz: c78ba3585823a7ec2ec21634216c39d8b3eb6170d9209131664c6a0f169ff61b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0a2960e5d509413c28be78a5d21e42d06176d2311577604673b5f9465efb8d13c86a05df2d39ed0d51207d1178d23f1c3e3c865b85693720c5f95ef073d487f5
|
|
7
|
+
data.tar.gz: f436525c1aa5d8230ef1a88ab29c09addc15e5f68e55fe8ba735b3129bd1296bdc6bd67913cd5e77bbe2efd89f1fd544f3b0a7e725da67dbdd7851916c82b38f
|
data/.github/workflows/ruby.yml
CHANGED
|
@@ -11,7 +11,7 @@ jobs:
|
|
|
11
11
|
runs-on: ubuntu-latest
|
|
12
12
|
strategy:
|
|
13
13
|
matrix:
|
|
14
|
-
ruby-version: ['3.2', '3.3', '3.4', 'ruby-head', '4.0']
|
|
14
|
+
ruby-version: ['3.2', '3.3', '3.4', '4.0', 'ruby-head', 'jruby-10.0.4.0']
|
|
15
15
|
env:
|
|
16
16
|
BUNDLER_NO_OLD_RUBYGEMS_WARNING: true
|
|
17
17
|
steps:
|
|
@@ -20,6 +20,7 @@ jobs:
|
|
|
20
20
|
uses: ruby/setup-ruby@3ff19f5e2baf30647122352b96108b1fbe250c64 #v1.299.0
|
|
21
21
|
with:
|
|
22
22
|
ruby-version: ${{ matrix.ruby-version }}
|
|
23
|
+
bundler: latest
|
|
23
24
|
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
|
24
25
|
- name: Run tests
|
|
25
26
|
run: make test
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Ruby Holidays Gem CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 9.2.0
|
|
4
|
+
|
|
5
|
+
* Update to [v6.1.1 definitions](https://github.com/holidays/definitions/releases/tag/v6.1.1). Please see the changelog for the definition details.
|
|
6
|
+
* Add `test:contract` rake task and `make test-contract` target combining smoke and generated definition tests for use as a downstream contract check
|
|
7
|
+
* Set coverage minimum to 90% and skip for ruby-head builds
|
|
8
|
+
|
|
9
|
+
## 9.1.2
|
|
10
|
+
|
|
11
|
+
* Fix bug ([#344](https://github.com/holidays/holidays/issues/344)) where holidays with the same name and function but different implementations across regions would return incorrect results depending on region load order. When multiple regions are queried simultaneously, each region's function implementation is now evaluated independently and all matching results are returned.
|
|
12
|
+
|
|
3
13
|
## 9.1.1
|
|
4
14
|
|
|
5
15
|
* Update to [v6.0.1 definitions](https://github.com/holidays/definitions/releases/tag/v6.0.1). Please see the changelog for the definition details.
|
data/Gemfile
CHANGED
data/Makefile
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
default: test
|
|
2
1
|
|
|
3
2
|
setup: update-defs
|
|
4
3
|
bundle install
|
|
@@ -7,8 +6,21 @@ generate:
|
|
|
7
6
|
bundle exec rake generate
|
|
8
7
|
|
|
9
8
|
test:
|
|
9
|
+
rm -rf reports
|
|
10
10
|
bundle exec rake test
|
|
11
11
|
|
|
12
|
+
test-smoke:
|
|
13
|
+
bundle exec rake test:smoke
|
|
14
|
+
|
|
15
|
+
test-contract:
|
|
16
|
+
bundle exec rake test:contract
|
|
17
|
+
|
|
18
|
+
test-integration:
|
|
19
|
+
bundle exec rake test:integration
|
|
20
|
+
|
|
21
|
+
test-e2e:
|
|
22
|
+
bundle exec rake test:e2e
|
|
23
|
+
|
|
12
24
|
console:
|
|
13
25
|
bundle exec rake console
|
|
14
26
|
|
|
@@ -32,6 +44,9 @@ point-to-defs-branch:
|
|
|
32
44
|
point-to-defs-master:
|
|
33
45
|
git submodule add https://github.com/holidays/definitions definitions/
|
|
34
46
|
|
|
47
|
+
reset-defs-to-master:
|
|
48
|
+
git -C definitions checkout $$(git ls-tree origin/master -- definitions | awk '{print $$3}')
|
|
49
|
+
|
|
35
50
|
clean-defs:
|
|
36
51
|
git rm -f definitions
|
|
37
52
|
rm -rf .git/modules/definitions
|
|
@@ -42,4 +57,4 @@ clean:
|
|
|
42
57
|
rm -rf reports
|
|
43
58
|
rm -rf coverage
|
|
44
59
|
|
|
45
|
-
.PHONY: setup test generate console build push update-defs test-region clean-defs point-to-defs-master point-to-defs-branch clean definitions
|
|
60
|
+
.PHONY: setup test test-smoke test-contract test-integration test-e2e generate console build push update-defs test-region reset-defs-to-master clean-defs point-to-defs-master point-to-defs-branch clean definitions
|
data/README.md
CHANGED
data/Rakefile
CHANGED
|
@@ -15,6 +15,34 @@ Rake::TestTask.new(:test) do |t|
|
|
|
15
15
|
t.test_files = FileList['test/**/test_*.rb']
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
+
task 'test:smoke' do
|
|
19
|
+
ENV['SMOKE_TEST'] = '1'
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
Rake::TestTask.new('test:smoke') do |t|
|
|
23
|
+
t.libs << 'test'
|
|
24
|
+
t.test_files = FileList['test/smoke/test_*.rb']
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
task 'test:contract' do
|
|
28
|
+
ENV['CONTRACT_TEST'] = '1'
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
Rake::TestTask.new('test:contract') do |t|
|
|
32
|
+
t.libs << 'test'
|
|
33
|
+
t.test_files = FileList['test/smoke/test_*.rb'] + FileList['test/defs/test_*.rb']
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
Rake::TestTask.new('test:integration') do |t|
|
|
37
|
+
t.libs << 'test'
|
|
38
|
+
t.test_files = FileList['test/integration/test_*.rb']
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
Rake::TestTask.new('test:e2e') do |t|
|
|
42
|
+
t.libs << 'test'
|
|
43
|
+
t.test_files = FileList['test/e2e/test_*.rb']
|
|
44
|
+
end
|
|
45
|
+
|
|
18
46
|
task :default => :test
|
|
19
47
|
|
|
20
48
|
desc "Run tests for only a single region. Do not provide sub regions. Example (without quotes): 'rake test_region jp'"
|
data/holidays.gemspec
CHANGED
|
@@ -22,10 +22,10 @@ Gem::Specification.new do |gem|
|
|
|
22
22
|
gem.require_paths = ['lib']
|
|
23
23
|
gem.licenses = ['MIT']
|
|
24
24
|
gem.required_ruby_version = '>= 3.2'
|
|
25
|
-
gem.add_development_dependency 'bundler', '>=
|
|
25
|
+
gem.add_development_dependency 'bundler', '>= 4'
|
|
26
26
|
gem.add_development_dependency 'rake', '~> 13'
|
|
27
27
|
gem.add_development_dependency 'simplecov', '~> 0.16'
|
|
28
28
|
gem.add_development_dependency 'test-unit', '~> 3'
|
|
29
|
-
gem.add_development_dependency 'mocha', '~>
|
|
30
|
-
gem.add_development_dependency 'pry', '~> 0.
|
|
29
|
+
gem.add_development_dependency 'mocha', '~> 3'
|
|
30
|
+
gem.add_development_dependency 'pry', '~> 0.16'
|
|
31
31
|
end
|
|
@@ -36,6 +36,7 @@ The following definition files are included in this installation:
|
|
|
36
36
|
* generated_definitions/hr
|
|
37
37
|
* generated_definitions/hu
|
|
38
38
|
* generated_definitions/ie
|
|
39
|
+
* generated_definitions/il
|
|
39
40
|
* generated_definitions/in
|
|
40
41
|
* generated_definitions/is
|
|
41
42
|
* generated_definitions/it
|
|
@@ -48,6 +49,7 @@ The following definition files are included in this installation:
|
|
|
48
49
|
* generated_definitions/lu
|
|
49
50
|
* generated_definitions/lv
|
|
50
51
|
* generated_definitions/ma
|
|
52
|
+
* generated_definitions/mc
|
|
51
53
|
* generated_definitions/mt_en
|
|
52
54
|
* generated_definitions/mt_mt
|
|
53
55
|
* generated_definitions/mx
|
|
@@ -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_nb, :ca_mb, :ca_ns, :ca_pe, :ca_nl, :ca_nt, :ca_nu, :ca_yt, :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, :co, :cr, :cy, :cz, :dk, :de, :de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_sn_sorbian, :de_th_cath, :de_sn, :de_st, :de_be, :de_mv, :de_by_cath, :de_by_augsburg, :de_th, :de_bb, :de_hb, :de_hh, :de_ni, :de_sh, :ecbtarget, :ee, :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, :federalreserve, :federalreservebanks, :fedex, :fi, :fr_a, :fr_m, :fr, :gb, :gb_eng, :gb_wls, :gb_eaw, :gb_nir, :je, :gb_jsy, :gg, :gb_gsy, :gb_sct, :
|
|
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_nb, :ca_mb, :ca_ns, :ca_pe, :ca_nl, :ca_nt, :ca_nu, :ca_yt, :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, :co, :cr, :cy, :cz, :dk, :de, :de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_sn_sorbian, :de_th_cath, :de_sn, :de_st, :de_be, :de_mv, :de_by_cath, :de_by_augsburg, :de_th, :de_bb, :de_hb, :de_hh, :de_ni, :de_sh, :ecbtarget, :ee, :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, :federalreserve, :federalreservebanks, :fedex, :fi, :fr_a, :fr_m, :fr, :gb, :gb_eng, :gb_wls, :gb_eaw, :gb_nir, :gb_con, :je, :gb_jsy, :gg, :gb_gsy, :gb_sct, :im, :gb_iom, :ge, :gr, :hr, :hk, :hu, :ie, :il, :in, :in_wb, :in_od, :in_tr, :in_mh, :in_ar, :in_mz, :in_br, :in_hp, :in_gj, :in_sk, :in_ts, :in_jh, :in_py, :in_kl, :in_ka, :in_jk, :in_ap, :in_cg, :in_hr, :in_mp, :in_pb, :in_nl, :in_as, :in_ga, :is, :it, :it_ve, :it_tv, :it_vr, :it_pd, :it_fi, :it_ge, :it_to, :it_rm, :it_vi, :it_bl, :it_ro, :ke, :kr, :kz, :li, :lt, :lv, :ma, :mc, :mt_mt, :mt_en, :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, :pt_li, :pt_po, :ro, :rs_cyrl, :rs_la, :ru, :se, :tn, :tr, :tsx, :ua, :us_fl, :us_al, :us_la, :us_ct, :us_de, :us_gu, :us_hi, :us_in, :us_ky, :us_nj, :us_nc, :us_nd, :us_pa, :us_pr, :us_tn, :us_ga, :us_ms, :us_id, :us_ar, :us_tx, :us_dc, :us_md, :us_va, :us_vt, :us_ak, :us_ca, :us_me, :us_ma, :us_ne, :us_mo, :us_sc, :us_wv, :us_vi, :us_ut, :us_ri, :us_az, :us_co, :us_il, :us_mt, :us_nm, :us_ny, :us_oh, :us_mi, :us_mn, :us_nv, :us_or, :us_sd, :us_wa, :us_wi, :us_wy, :us_ia, :us_ks, :us_nh, :us_ok, :unitednations, :ups, :za, :ve, :sk, :si, :jp, :vi, :sg, :my, :th, :ng]
|
|
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_nb: :ca, ca_mb: :ca, ca_ns: :ca, ca_pe: :ca, ca_nl: :ca, ca_nt: :ca, ca_nu: :ca, ca_yt: :ca, us: :us, 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, co: :co, cr: :cr, cy: :cy, 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_cath: :de, de_sn: :de, de_st: :de, de_be: :de, de_mv: :de, de_by_cath: :de, de_by_augsburg: :de, de_th: :de, de_bb: :de, de_hb: :de, de_hh: :de, de_ni: :de, de_sh: :de, ecbtarget: :ecbtarget, ee: :ee, 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, federalreserve: :federalreserve, federalreservebanks: :federalreservebanks, fedex: :fedex, fi: :fi, fr_a: :fr, fr_m: :fr, fr: :fr, gb: :gb, gb_eng: :gb, gb_wls: :gb, gb_eaw: :gb, gb_nir: :gb,
|
|
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_nb: :ca, ca_mb: :ca, ca_ns: :ca, ca_pe: :ca, ca_nl: :ca, ca_nt: :ca, ca_nu: :ca, ca_yt: :ca, us: :us, 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, co: :co, cr: :cr, cy: :cy, 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_cath: :de, de_sn: :de, de_st: :de, de_be: :de, de_mv: :de, de_by_cath: :de, de_by_augsburg: :de, de_th: :de, de_bb: :de, de_hb: :de, de_hh: :de, de_ni: :de, de_sh: :de, ecbtarget: :ecbtarget, ee: :ee, 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, federalreserve: :federalreserve, federalreservebanks: :federalreservebanks, fedex: :fedex, fi: :fi, fr_a: :fr, fr_m: :fr, fr: :fr, gb: :gb, gb_eng: :gb, gb_wls: :gb, gb_eaw: :gb, gb_nir: :gb, gb_con: :gb, je: :gb, gb_jsy: :gb, gg: :gb, gb_gsy: :gb, gb_sct: :gb, im: :gb, gb_iom: :gb, ge: :ge, gr: :gr, hr: :hr, hk: :hk, hu: :hu, ie: :ie, il: :il, in: :in, in_wb: :in, in_od: :in, in_tr: :in, in_mh: :in, in_ar: :in, in_mz: :in, in_br: :in, in_hp: :in, in_gj: :in, in_sk: :in, in_ts: :in, in_jh: :in, in_py: :in, in_kl: :in, in_ka: :in, in_jk: :in, in_ap: :in, in_cg: :in, in_hr: :in, in_mp: :in, in_pb: :in, in_nl: :in, in_as: :in, in_ga: :in, is: :is, it: :it, it_ve: :it, it_tv: :it, it_vr: :it, it_pd: :it, it_fi: :it, it_ge: :it, it_to: :it, it_rm: :it, it_vi: :it, it_bl: :it, it_ro: :it, ke: :ke, kr: :kr, kz: :kz, li: :li, lt: :lt, lv: :lv, ma: :ma, mc: :mc, mt_mt: :mt_mt, mt_en: :mt_en, 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, pt_li: :pt, pt_po: :pt, ro: :ro, rs_cyrl: :rs_cyrl, rs_la: :rs_la, ru: :ru, se: :se, tn: :tn, tr: :tr, tsx: :tsx, ua: :ua, us_fl: :us, us_al: :us, us_la: :us, us_ct: :us, us_de: :us, us_gu: :us, us_hi: :us, us_in: :us, us_ky: :us, us_nj: :us, us_nc: :us, us_nd: :us, us_pa: :us, us_pr: :us, us_tn: :us, us_ga: :us, us_ms: :us, us_id: :us, us_ar: :us, us_tx: :us, us_dc: :us, us_md: :us, us_va: :us, us_vt: :us, us_ak: :us, us_ca: :us, us_me: :us, us_ma: :us, us_ne: :us, us_mo: :us, us_sc: :us, us_wv: :us, us_vi: :us, us_ut: :us, us_ri: :us, us_az: :us, us_co: :us, us_il: :us, us_mt: :us, us_nm: :us, us_ny: :us, us_oh: :us, us_mi: :us, us_mn: :us, us_nv: :us, us_or: :us, us_sd: :us, us_wa: :us, us_wi: :us, us_wy: :us, us_ia: :us, us_ks: :us, us_nh: :us, us_ok: :us, unitednations: :unitednations, ups: :ups, za: :za, ve: :southamerica, sk: :europe, si: :europe, jp: :jp, vi: :vi, sg: :sg, my: :my, th: :th, ng: :ng}
|
|
6
6
|
end
|
|
@@ -7,7 +7,7 @@ module Holidays
|
|
|
7
7
|
# All the definitions are available at https://github.com/holidays/holidays
|
|
8
8
|
module EUROPE # :nodoc:
|
|
9
9
|
def self.defined_regions
|
|
10
|
-
[:at, :be_fr, :be_nl, :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_sn_sorbian, :de_th_cath, :de_sn, :de_st, :de_be, :de_mv, :de_by_cath, :de_by_augsburg, :de_th, :de_bb, :de_hb, :de_hh, :de_ni, :de_sh, :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_a, :fr_m, :fr, :gb, :gb_eng, :gb_wls, :gb_eaw, :gb_nir, :je, :gb_jsy, :gg, :gb_gsy, :gb_sct, :
|
|
10
|
+
[:at, :be_fr, :be_nl, :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_sn_sorbian, :de_th_cath, :de_sn, :de_st, :de_be, :de_mv, :de_by_cath, :de_by_augsburg, :de_th, :de_bb, :de_hb, :de_hh, :de_ni, :de_sh, :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_a, :fr_m, :fr, :gb, :gb_eng, :gb_wls, :gb_eaw, :gb_nir, :gb_con, :je, :gb_jsy, :gg, :gb_gsy, :gb_sct, :im, :gb_iom, :gr, :hr, :hu, :ie, :is, :it, :it_ve, :it_tv, :it_vr, :it_pd, :it_fi, :it_ge, :it_to, :it_rm, :it_vi, :it_bl, :it_ro, :li, :lt, :lv, :nl, :no, :pl, :pt, :pt_li, :pt_po, :ro, :sk, :si, :bg_en, :bg_bg, :ua]
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
def self.holidays_by_month
|
|
@@ -63,12 +63,12 @@ module Holidays
|
|
|
63
63
|
{:function => "easter(year)", :function_arguments => [:year], :type => :informal, :name => "Pâques", :regions => [:fr]},
|
|
64
64
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Lundi de Pâques", :regions => [:fr]},
|
|
65
65
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 39, :name => "Ascension", :regions => [:fr]},
|
|
66
|
-
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 49, :name => "Pentecôte", :regions => [:fr]},
|
|
67
|
-
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 50, :
|
|
66
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 49, :type => :informal, :name => "Pentecôte", :regions => [:fr]},
|
|
67
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 50, :name => "Lundi de Pentecôte", :regions => [:fr]},
|
|
68
68
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -21, :type => :informal, :name => "Mothering Sunday", :regions => [:gb]},
|
|
69
69
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Good Friday", :regions => [:gb]},
|
|
70
70
|
{:function => "easter(year)", :function_arguments => [:year], :name => "Easter Sunday", :regions => [:gb]},
|
|
71
|
-
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Easter Monday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir, :je, :gb_jsy, :gg, :gb_gsy]},
|
|
71
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Easter Monday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir, :gb_con, :je, :gb_jsy, :gg, :gb_gsy]},
|
|
72
72
|
{:function => "orthodox_easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Μεγάλη Παρασκευή", :regions => [:gr]},
|
|
73
73
|
{:function => "orthodox_easter(year)", :function_arguments => [:year], :function_modifier => -1, :name => "Μεγάλο Σάββατο", :regions => [:gr]},
|
|
74
74
|
{:function => "orthodox_easter(year)", :function_arguments => [:year], :name => "Κυριακή του Πάσχα", :regions => [:gr]},
|
|
@@ -282,7 +282,7 @@ module Holidays
|
|
|
282
282
|
{:mday => 15, :observed => "to_monday_if_sunday(date)", :observed_arguments => [:date], :name => "Asunción", :regions => [:es]},
|
|
283
283
|
{:mday => 15, :name => "Assomption", :regions => [:fr]},
|
|
284
284
|
{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:gb_sct]},
|
|
285
|
-
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir, :je, :gb_jsy, :gg, :gb_gsy]},
|
|
285
|
+
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir, :gb_con, :je, :gb_jsy, :gg, :gb_gsy]},
|
|
286
286
|
{:mday => 15, :name => "Κοίμηση της Θεοτόκου", :regions => [:gr]},
|
|
287
287
|
{:mday => 5, :name => "Dan pobjede i domovinske zahvalnosti i Dan hrvatskih branitelja", :regions => [:hr]},
|
|
288
288
|
{:mday => 15, :name => "Velika Gospa", :regions => [:hr]},
|
|
@@ -16,8 +16,8 @@ module Holidays
|
|
|
16
16
|
{:function => "easter(year)", :function_arguments => [:year], :type => :informal, :name => "Pâques", :regions => [:fr]},
|
|
17
17
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Lundi de Pâques", :regions => [:fr]},
|
|
18
18
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 39, :name => "Ascension", :regions => [:fr]},
|
|
19
|
-
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 49, :name => "Pentecôte", :regions => [:fr]},
|
|
20
|
-
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 50, :
|
|
19
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 49, :type => :informal, :name => "Pentecôte", :regions => [:fr]},
|
|
20
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 50, :name => "Lundi de Pentecôte", :regions => [:fr]}],
|
|
21
21
|
1 => [{:mday => 1, :name => "Jour de l'an", :regions => [:fr]}],
|
|
22
22
|
5 => [{:mday => 1, :name => "Fête du travail", :regions => [:fr]},
|
|
23
23
|
{:mday => 8, :name => "Victoire 1945", :regions => [:fr]}],
|
|
@@ -7,7 +7,7 @@ module Holidays
|
|
|
7
7
|
# All the definitions are available at https://github.com/holidays/holidays
|
|
8
8
|
module GB # :nodoc:
|
|
9
9
|
def self.defined_regions
|
|
10
|
-
[:gb, :gb_eng, :gb_wls, :gb_eaw, :gb_nir, :je, :gb_jsy, :gg, :gb_gsy, :gb_sct, :
|
|
10
|
+
[:gb, :gb_eng, :gb_wls, :gb_eaw, :gb_nir, :gb_con, :je, :gb_jsy, :gg, :gb_gsy, :gb_sct, :im, :gb_iom]
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
def self.holidays_by_month
|
|
@@ -15,7 +15,7 @@ module Holidays
|
|
|
15
15
|
0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -21, :type => :informal, :name => "Mothering Sunday", :regions => [:gb]},
|
|
16
16
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :name => "Good Friday", :regions => [:gb]},
|
|
17
17
|
{:function => "easter(year)", :function_arguments => [:year], :name => "Easter Sunday", :regions => [:gb]},
|
|
18
|
-
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Easter Monday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir, :je, :gb_jsy, :gg, :gb_gsy]}],
|
|
18
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Easter Monday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir, :gb_con, :je, :gb_jsy, :gg, :gb_gsy]}],
|
|
19
19
|
1 => [{:mday => 1, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "New Year's Day", :regions => [:gb]},
|
|
20
20
|
{:mday => 2, :observed => "to_weekday_if_boxing_weekend(date)", :observed_arguments => [:date], :name => "2nd January", :regions => [:gb_sct]}],
|
|
21
21
|
3 => [{:mday => 5, :name => "St. Piran's Day", :regions => [:gb_con]},
|
|
@@ -32,7 +32,7 @@ module Holidays
|
|
|
32
32
|
7 => [{:mday => 5, :name => "Tynwald Day", :regions => [:im, :gb_iom]},
|
|
33
33
|
{:mday => 12, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Battle of the Boyne", :regions => [:gb_nir]}],
|
|
34
34
|
8 => [{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:gb_sct]},
|
|
35
|
-
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir, :je, :gb_jsy, :gg, :gb_gsy]}],
|
|
35
|
+
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir, :gb_con, :je, :gb_jsy, :gg, :gb_gsy]}],
|
|
36
36
|
9 => [{:mday => 19, :year_ranges => { :limited => [2022] },:name => "Bank Holiday for the State Funeral of Queen Elizabeth II", :regions => [:gb]}],
|
|
37
37
|
11 => [{:mday => 5, :type => :informal, :name => "Guy Fawkes Day", :regions => [:gb]},
|
|
38
38
|
{:mday => 30, :year_ranges => { :until => 2006 },:observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :type => :informal, :name => "St. Andrew's Day", :regions => [:gb_sct]},
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
module Holidays
|
|
3
|
+
# This file is generated by the Ruby Holidays gem.
|
|
4
|
+
#
|
|
5
|
+
# Definitions loaded: definitions/il.yaml
|
|
6
|
+
#
|
|
7
|
+
# All the definitions are available at https://github.com/holidays/holidays
|
|
8
|
+
module IL # :nodoc:
|
|
9
|
+
def self.defined_regions
|
|
10
|
+
[:il]
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.holidays_by_month
|
|
14
|
+
{
|
|
15
|
+
3 => [{:mday => 16, :year_ranges => { :limited => [2022] },:name => "Exodus from Egypt", :regions => [:il]},
|
|
16
|
+
{:mday => 6, :year_ranges => { :limited => [2023] },:name => "Exodus from Egypt", :regions => [:il]},
|
|
17
|
+
{:mday => 23, :year_ranges => { :limited => [2024] },:name => "Exodus from Egypt", :regions => [:il]},
|
|
18
|
+
{:mday => 13, :year_ranges => { :limited => [2025] },:name => "Exodus from Egypt", :regions => [:il]},
|
|
19
|
+
{:mday => 2, :year_ranges => { :limited => [2026] },:name => "Exodus from Egypt", :regions => [:il]},
|
|
20
|
+
{:mday => 22, :year_ranges => { :limited => [2022] },:name => "Exodus from Egypt (day 7)", :regions => [:il]},
|
|
21
|
+
{:mday => 12, :year_ranges => { :limited => [2023] },:name => "Exodus from Egypt (day 7)", :regions => [:il]},
|
|
22
|
+
{:mday => 29, :year_ranges => { :limited => [2024] },:name => "Exodus from Egypt (day 7)", :regions => [:il]},
|
|
23
|
+
{:mday => 19, :year_ranges => { :limited => [2025] },:name => "Exodus from Egypt (day 7)", :regions => [:il]},
|
|
24
|
+
{:mday => 8, :year_ranges => { :limited => [2026] },:name => "Exodus from Egypt (day 7)", :regions => [:il]},
|
|
25
|
+
{:mday => 24, :year_ranges => { :limited => [2023] },:name => "Independence Day", :regions => [:il]},
|
|
26
|
+
{:mday => 20, :year_ranges => { :limited => [2026] },:name => "Independence Day", :regions => [:il]}],
|
|
27
|
+
4 => [{:mday => 4, :year_ranges => { :limited => [2022] },:name => "Independence Day", :regions => [:il]},
|
|
28
|
+
{:mday => 11, :year_ranges => { :limited => [2024] },:name => "Independence Day", :regions => [:il]},
|
|
29
|
+
{:mday => 1, :year_ranges => { :limited => [2025] },:name => "Independence Day", :regions => [:il]},
|
|
30
|
+
{:mday => 26, :year_ranges => { :limited => [2023] },:name => "Thanksgiving", :regions => [:il]},
|
|
31
|
+
{:mday => 22, :year_ranges => { :limited => [2026] },:name => "Thanksgiving", :regions => [:il]},
|
|
32
|
+
{:mday => 27, :year_ranges => { :limited => [2023] },:name => "Thanksgiving (day 2)", :regions => [:il]},
|
|
33
|
+
{:mday => 23, :year_ranges => { :limited => [2026] },:name => "Thanksgiving (day 2)", :regions => [:il]}],
|
|
34
|
+
5 => [{:mday => 5, :year_ranges => { :limited => [2022] },:name => "Thanksgiving", :regions => [:il]},
|
|
35
|
+
{:mday => 12, :year_ranges => { :limited => [2024] },:name => "Thanksgiving", :regions => [:il]},
|
|
36
|
+
{:mday => 2, :year_ranges => { :limited => [2025] },:name => "Thanksgiving", :regions => [:il]},
|
|
37
|
+
{:mday => 6, :year_ranges => { :limited => [2022] },:name => "Thanksgiving (day 2)", :regions => [:il]},
|
|
38
|
+
{:mday => 13, :year_ranges => { :limited => [2024] },:name => "Thanksgiving (day 2)", :regions => [:il]},
|
|
39
|
+
{:mday => 3, :year_ranges => { :limited => [2025] },:name => "Thanksgiving (day 2)", :regions => [:il]}],
|
|
40
|
+
9 => [{:mday => 26, :year_ranges => { :limited => [2022] },:name => "Jewish New Year", :regions => [:il]},
|
|
41
|
+
{:mday => 16, :year_ranges => { :limited => [2023] },:name => "Jewish New Year", :regions => [:il]},
|
|
42
|
+
{:mday => 23, :year_ranges => { :limited => [2025] },:name => "Jewish New Year", :regions => [:il]},
|
|
43
|
+
{:mday => 12, :year_ranges => { :limited => [2026] },:name => "Jewish New Year", :regions => [:il]},
|
|
44
|
+
{:mday => 27, :year_ranges => { :limited => [2022] },:name => "2nd New Year's Day", :regions => [:il]},
|
|
45
|
+
{:mday => 17, :year_ranges => { :limited => [2023] },:name => "2nd New Year's Day", :regions => [:il]},
|
|
46
|
+
{:mday => 24, :year_ranges => { :limited => [2025] },:name => "2nd New Year's Day", :regions => [:il]},
|
|
47
|
+
{:mday => 13, :year_ranges => { :limited => [2026] },:name => "2nd New Year's Day", :regions => [:il]},
|
|
48
|
+
{:mday => 25, :year_ranges => { :limited => [2023] },:name => "Day of Atonement", :regions => [:il]},
|
|
49
|
+
{:mday => 21, :year_ranges => { :limited => [2026] },:name => "Day of Atonement", :regions => [:il]},
|
|
50
|
+
{:mday => 30, :year_ranges => { :limited => [2023] },:name => "Feast of Tabernacles", :regions => [:il]},
|
|
51
|
+
{:mday => 26, :year_ranges => { :limited => [2026] },:name => "Feast of Tabernacles", :regions => [:il]}],
|
|
52
|
+
10 => [{:mday => 3, :year_ranges => { :limited => [2024] },:name => "Jewish New Year", :regions => [:il]},
|
|
53
|
+
{:mday => 4, :year_ranges => { :limited => [2024] },:name => "2nd New Year's Day", :regions => [:il]},
|
|
54
|
+
{:mday => 5, :year_ranges => { :limited => [2022] },:name => "Day of Atonement", :regions => [:il]},
|
|
55
|
+
{:mday => 12, :year_ranges => { :limited => [2024] },:name => "Day of Atonement", :regions => [:il]},
|
|
56
|
+
{:mday => 2, :year_ranges => { :limited => [2025] },:name => "Day of Atonement", :regions => [:il]},
|
|
57
|
+
{:mday => 10, :year_ranges => { :limited => [2022] },:name => "Feast of Tabernacles", :regions => [:il]},
|
|
58
|
+
{:mday => 17, :year_ranges => { :limited => [2024] },:name => "Feast of Tabernacles", :regions => [:il]},
|
|
59
|
+
{:mday => 7, :year_ranges => { :limited => [2025] },:name => "Feast of Tabernacles", :regions => [:il]},
|
|
60
|
+
{:mday => 18, :year_ranges => { :limited => [2022] },:name => "Rejoicing of the Torah", :regions => [:il]},
|
|
61
|
+
{:mday => 8, :year_ranges => { :limited => [2023] },:name => "Rejoicing of the Torah", :regions => [:il]},
|
|
62
|
+
{:mday => 25, :year_ranges => { :limited => [2024] },:name => "Rejoicing of the Torah", :regions => [:il]},
|
|
63
|
+
{:mday => 15, :year_ranges => { :limited => [2025] },:name => "Rejoicing of the Torah", :regions => [:il]},
|
|
64
|
+
{:mday => 4, :year_ranges => { :limited => [2026] },:name => "Rejoicing of the Torah", :regions => [:il]}]
|
|
65
|
+
}
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def self.custom_methods
|
|
69
|
+
{
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
module Holidays
|
|
3
|
+
# This file is generated by the Ruby Holidays gem.
|
|
4
|
+
#
|
|
5
|
+
# Definitions loaded: definitions/mc.yaml
|
|
6
|
+
#
|
|
7
|
+
# All the definitions are available at https://github.com/holidays/holidays
|
|
8
|
+
module MC # :nodoc:
|
|
9
|
+
def self.defined_regions
|
|
10
|
+
[:mc]
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.holidays_by_month
|
|
14
|
+
{
|
|
15
|
+
0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Lundi de Pâques", :regions => [:mc]},
|
|
16
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 39, :name => "Ascension", :regions => [:mc]},
|
|
17
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 50, :name => "Lundi de Pentecôte", :regions => [:mc]},
|
|
18
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 60, :name => "Fête Dieu", :regions => [:mc]}],
|
|
19
|
+
1 => [{:mday => 1, :name => "Jour de l'an", :regions => [:mc]},
|
|
20
|
+
{:mday => 27, :name => "Sainte Dévote", :regions => [:mc]}],
|
|
21
|
+
5 => [{:mday => 1, :name => "Fête du Travail", :regions => [:mc]}],
|
|
22
|
+
8 => [{:mday => 15, :name => "Assomption", :regions => [:mc]}],
|
|
23
|
+
11 => [{:mday => 1, :observed => "to_monday_if_sunday(date)", :observed_arguments => [:date], :name => "Toussaint", :regions => [:mc]},
|
|
24
|
+
{:mday => 19, :name => "Fête du Prince", :regions => [:mc]}],
|
|
25
|
+
12 => [{:mday => 8, :observed => "to_monday_if_sunday(date)", :observed_arguments => [:date], :name => "Immaculée Conception", :regions => [:mc]},
|
|
26
|
+
{:mday => 25, :name => "Noël", :regions => [:mc]}]
|
|
27
|
+
}
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def self.custom_methods
|
|
31
|
+
{
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -7,7 +7,7 @@ module Holidays
|
|
|
7
7
|
# All the definitions are available at https://github.com/holidays/holidays
|
|
8
8
|
module NORTHAMERICA # :nodoc:
|
|
9
9
|
def self.defined_regions
|
|
10
|
-
[:ca, :ca_qc, :ca_ab, :ca_sk, :ca_on, :ca_bc, :ca_nb, :ca_mb, :ca_ns, :ca_pe, :ca_nl, :ca_nt, :ca_nu, :ca_yt, :mx, :mx_pue, :us_fl, :us_al, :us_la, :us, :us_ct, :us_de, :us_gu, :us_hi, :us_in, :us_ky, :us_nj, :us_nc, :us_nd, :us_pa, :us_pr, :us_tn, :us_ms, :us_id, :us_ar, :us_tx, :us_dc, :us_md, :us_va, :us_vt, :us_ak, :us_ca, :us_me, :us_ma, :
|
|
10
|
+
[:ca, :ca_qc, :ca_ab, :ca_sk, :ca_on, :ca_bc, :ca_nb, :ca_mb, :ca_ns, :ca_pe, :ca_nl, :ca_nt, :ca_nu, :ca_yt, :mx, :mx_pue, :us_fl, :us_al, :us_la, :us, :us_ct, :us_de, :us_gu, :us_hi, :us_in, :us_ky, :us_nj, :us_nc, :us_nd, :us_pa, :us_pr, :us_tn, :us_ga, :us_ms, :us_id, :us_ar, :us_tx, :us_dc, :us_md, :us_va, :us_vt, :us_ak, :us_ca, :us_me, :us_ma, :us_ne, :us_mo, :us_sc, :us_wv, :us_vi, :us_ut, :us_ri, :us_az, :us_co, :us_il, :us_mt, :us_nm, :us_ny, :us_oh, :us_mi, :us_mn, :us_nv, :us_or, :us_sd, :us_wa, :us_wi, :us_wy, :us_ia, :us_ks, :us_nh, :us_ok]
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
def self.holidays_by_month
|
|
@@ -19,6 +19,7 @@ module Holidays
|
|
|
19
19
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -47, :name => "Mardi Gras Day", :regions => [:us_al, :us_la]},
|
|
20
20
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :type => :informal, :name => "Good Friday", :regions => [:us]},
|
|
21
21
|
{: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_pa, :us_pr, :us_tn]},
|
|
22
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :year_ranges => { :from => 2020 },:name => "State Holiday", :regions => [:us_ga]},
|
|
22
23
|
{:function => "easter(year)", :function_arguments => [:year], :type => :informal, :name => "Easter Sunday", :regions => [:us]}],
|
|
23
24
|
1 => [{:mday => 1, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "New Year's Day", :regions => [:ca]},
|
|
24
25
|
{:mday => 2, :name => "New Year's", :regions => [:ca_qc]},
|
|
@@ -149,7 +150,7 @@ module Holidays
|
|
|
149
150
|
{:wday => 1, :week => -1, :name => "Confederate Memorial Day", :regions => [:us_ms]},
|
|
150
151
|
{:wday => 1, :week => 4, :name => "Confederate Memorial Day", :regions => [:us_al]},
|
|
151
152
|
{:mday => 26, :observed => "to_monday_if_sunday(date)", :observed_arguments => [:date], :name => "Confederate Memorial Day", :regions => [:us_fl]},
|
|
152
|
-
{:function => "georgia_state_holiday(year, month)", :function_arguments => [:year, :month], :name => "State Holiday", :regions => [:us_ga]},
|
|
153
|
+
{:function => "georgia_state_holiday(year, month)", :function_arguments => [:year, :month], :year_ranges => { :until => 2019 },:name => "State Holiday", :regions => [:us_ga]},
|
|
153
154
|
{:wday => 5, :week => -1, :name => "Arbor Day", :regions => [:us_ne]},
|
|
154
155
|
{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
|
|
155
156
|
{:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}]
|
|
@@ -7,7 +7,7 @@ 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_fl, :us_al, :us_la, :us, :us_ct, :us_de, :us_gu, :us_hi, :us_in, :us_ky, :us_nj, :us_nc, :us_nd, :us_pa, :us_pr, :us_tn, :us_ms, :us_id, :us_ar, :us_tx, :us_dc, :us_md, :us_va, :us_vt, :us_ak, :us_ca, :us_me, :us_ma, :
|
|
10
|
+
[:us_fl, :us_al, :us_la, :us, :us_ct, :us_de, :us_gu, :us_hi, :us_in, :us_ky, :us_nj, :us_nc, :us_nd, :us_pa, :us_pr, :us_tn, :us_ga, :us_ms, :us_id, :us_ar, :us_tx, :us_dc, :us_md, :us_va, :us_vt, :us_ak, :us_ca, :us_me, :us_ma, :us_ne, :us_mo, :us_sc, :us_wv, :us_vi, :us_ut, :us_ri, :us_az, :us_co, :us_il, :us_mt, :us_nm, :us_ny, :us_oh, :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
|
|
@@ -16,6 +16,7 @@ module Holidays
|
|
|
16
16
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -47, :name => "Mardi Gras Day", :regions => [:us_al, :us_la]},
|
|
17
17
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :type => :informal, :name => "Good Friday", :regions => [:us]},
|
|
18
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_pa, :us_pr, :us_tn]},
|
|
19
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :year_ranges => { :from => 2020 },:name => "State Holiday", :regions => [:us_ga]},
|
|
19
20
|
{:function => "easter(year)", :function_arguments => [:year], :type => :informal, :name => "Easter Sunday", :regions => [:us]}],
|
|
20
21
|
1 => [{:mday => 1, :observed => "to_weekday_if_weekend(date)", :observed_arguments => [:date], :name => "New Year's Day", :regions => [:us]},
|
|
21
22
|
{:wday => 1, :week => 3, :name => "Martin Luther King's and Robert E. Lee's Birthdays", :regions => [:us_ms]},
|
|
@@ -40,7 +41,7 @@ module Holidays
|
|
|
40
41
|
{:wday => 1, :week => -1, :name => "Confederate Memorial Day", :regions => [:us_ms]},
|
|
41
42
|
{:wday => 1, :week => 4, :name => "Confederate Memorial Day", :regions => [:us_al]},
|
|
42
43
|
{: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
|
+
{:function => "georgia_state_holiday(year, month)", :function_arguments => [:year, :month], :year_ranges => { :until => 2019 },:name => "State Holiday", :regions => [:us_ga]},
|
|
44
45
|
{:wday => 5, :week => -1, :name => "Arbor Day", :regions => [:us_ne]},
|
|
45
46
|
{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
|
|
46
47
|
{:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}],
|
|
@@ -12,7 +12,7 @@ module Holidays
|
|
|
12
12
|
def call(input, func_id, desired_func_args, func_modifier = nil)
|
|
13
13
|
validate!(input, func_id, desired_func_args)
|
|
14
14
|
|
|
15
|
-
function = @custom_methods_repo.find(func_id)
|
|
15
|
+
function = @custom_methods_repo.find(func_id, input[:region])
|
|
16
16
|
raise Holidays::FunctionNotFound.new("Unable to find function with id '#{func_id}'") if function.nil?
|
|
17
17
|
|
|
18
18
|
calculate(input, function, parse_arguments(input, desired_func_args), func_modifier)
|
|
@@ -9,12 +9,28 @@ module Holidays
|
|
|
9
9
|
@custom_methods_repo = custom_methods_repo
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
def call(target_regions, target_holidays, target_custom_methods)
|
|
13
|
-
#FIXME Does this need to come in this exact order? God I hope not.
|
|
14
|
-
# If not then we should swap the order so it matches the init.
|
|
12
|
+
def call(target_regions, target_holidays, target_custom_methods, target_custom_method_sources = {})
|
|
15
13
|
@regions_repo.add(target_regions)
|
|
16
14
|
@holidays_repo.add(target_holidays)
|
|
17
|
-
@custom_methods_repo.add(
|
|
15
|
+
@custom_methods_repo.add(
|
|
16
|
+
target_custom_methods,
|
|
17
|
+
target_custom_method_sources,
|
|
18
|
+
derive_function_regions(target_holidays),
|
|
19
|
+
)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
# Builds a map of {func_id => [regions]} from the holiday definitions
|
|
25
|
+
# so the custom_methods repo knows which regions each function belongs to.
|
|
26
|
+
def derive_function_regions(holidays_by_month)
|
|
27
|
+
holidays_by_month.each_with_object({}) do |(_, definitions), result|
|
|
28
|
+
definitions.each do |defn|
|
|
29
|
+
next unless defn[:function]
|
|
30
|
+
result[defn[:function]] ||= []
|
|
31
|
+
result[defn[:function]] |= Array(defn[:regions])
|
|
32
|
+
end
|
|
33
|
+
end
|
|
18
34
|
end
|
|
19
35
|
end
|
|
20
36
|
end
|
|
@@ -4,21 +4,49 @@ module Holidays
|
|
|
4
4
|
class CustomMethods
|
|
5
5
|
def initialize
|
|
6
6
|
@custom_methods = {}
|
|
7
|
+
@custom_method_sources = {}
|
|
8
|
+
@regional_overrides = {}
|
|
7
9
|
end
|
|
8
10
|
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
|
|
12
|
-
#
|
|
13
|
-
# FIXME: this should probably return an error if a method with the
|
|
14
|
-
# same ID already exists.
|
|
15
|
-
def add(new_custom_methods)
|
|
11
|
+
# When a conflict is detected the method is stored as a regional override keyed by its regions.
|
|
12
|
+
# find() then resolves the right implementation at lookup time using the queried region.
|
|
13
|
+
def add(new_custom_methods, new_sources = {}, function_regions = {})
|
|
16
14
|
raise ArgumentError if new_custom_methods.nil?
|
|
17
|
-
|
|
15
|
+
|
|
16
|
+
new_custom_methods.each do |key, method|
|
|
17
|
+
new_source = new_sources[key]
|
|
18
|
+
|
|
19
|
+
if @custom_methods.key?(key)
|
|
20
|
+
existing_source = @custom_method_sources[key]
|
|
21
|
+
|
|
22
|
+
if new_source && existing_source && new_source != existing_source
|
|
23
|
+
regions = function_regions[key] || []
|
|
24
|
+
@regional_overrides[key] ||= []
|
|
25
|
+
@regional_overrides[key] << { regions: regions, proc: method }
|
|
26
|
+
else
|
|
27
|
+
@custom_methods[key] = method
|
|
28
|
+
@custom_method_sources[key] = new_source if new_source
|
|
29
|
+
end
|
|
30
|
+
else
|
|
31
|
+
@custom_methods[key] = method
|
|
32
|
+
@custom_method_sources[key] = new_source if new_source
|
|
33
|
+
end
|
|
34
|
+
end
|
|
18
35
|
end
|
|
19
36
|
|
|
20
|
-
|
|
37
|
+
# Returns the proc for the given method_id.
|
|
38
|
+
#
|
|
39
|
+
# When a region is supplied, regional overrides are checked first so
|
|
40
|
+
# that conflicting methods with the same name but different logic each
|
|
41
|
+
# resolve to their own implementation.
|
|
42
|
+
def find(method_id, region = nil)
|
|
21
43
|
raise ArgumentError if method_id.nil? || method_id.empty?
|
|
44
|
+
|
|
45
|
+
if region && @regional_overrides[method_id]
|
|
46
|
+
override = @regional_overrides[method_id].find { |o| o[:regions].include?(region) }
|
|
47
|
+
return override[:proc] if override
|
|
48
|
+
end
|
|
49
|
+
|
|
22
50
|
@custom_methods[method_id]
|
|
23
51
|
end
|
|
24
52
|
end
|