holidays 3.3.0 → 4.0.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 +44 -0
- data/CONTRIBUTING.md +37 -0
- data/README.md +16 -25
- data/REFERENCES +4 -1
- data/Rakefile +38 -8
- data/benchmark.rb +8 -0
- data/definitions/README.md +187 -8
- data/definitions/ar.yaml +2 -1
- data/definitions/at.yaml +17 -13
- data/definitions/au.yaml +65 -60
- data/definitions/be_fr.yaml +14 -10
- data/definitions/be_nl.yaml +8 -4
- data/definitions/bg.yaml +12 -6
- data/definitions/br.yaml +6 -3
- data/definitions/ca.yaml +8 -6
- data/definitions/ch.yaml +21 -15
- data/definitions/cl.yaml +4 -2
- data/definitions/cr.yaml +5 -3
- data/definitions/cz.yaml +4 -2
- data/definitions/de.yaml +25 -14
- data/definitions/dk.yaml +26 -17
- data/definitions/ecb_target.yaml +4 -2
- data/definitions/el.yaml +23 -18
- data/definitions/es.yaml +31 -28
- data/definitions/federal_reserve.yaml +12 -12
- data/definitions/fedex.yaml +6 -6
- data/definitions/fi.yaml +26 -25
- data/definitions/fr.yaml +8 -4
- data/definitions/gb.yaml +9 -7
- data/definitions/hr.yaml +8 -6
- data/definitions/hu.yaml +8 -6
- data/definitions/ie.yaml +17 -16
- data/definitions/index.yaml +1 -1
- data/definitions/is.yaml +29 -19
- data/definitions/it.yaml +10 -9
- data/definitions/jp.yaml +92 -44
- data/definitions/li.yaml +25 -20
- data/definitions/lt.yaml +2 -1
- data/definitions/ma.yaml +7 -7
- data/definitions/mx.yaml +11 -11
- data/definitions/nerc.yaml +6 -6
- data/definitions/nl.yaml +22 -18
- data/definitions/no.yaml +19 -11
- data/definitions/north_america_informal.yaml +6 -6
- data/definitions/nyse.yaml +9 -8
- data/definitions/nz.yaml +33 -29
- data/definitions/ph.yaml +15 -8
- data/definitions/pl.yaml +27 -17
- data/definitions/pt.yaml +4 -2
- data/definitions/ro.yaml +21 -18
- data/definitions/se.yaml +24 -18
- data/definitions/sg.yaml +10 -9
- data/definitions/si.yaml +4 -2
- data/definitions/sk.yaml +4 -2
- data/definitions/united_nations.yaml +12 -12
- data/definitions/ups.yaml +6 -6
- data/definitions/us.yaml +12 -11
- data/definitions/ve.yaml +8 -4
- data/definitions/vi.yaml +6 -6
- data/definitions/za.yaml +26 -24
- data/holidays.gemspec +3 -1
- data/lib/generated_definitions/MANIFEST +1 -1
- data/lib/generated_definitions/ar.rb +8 -6
- data/lib/generated_definitions/at.rb +11 -9
- data/lib/generated_definitions/au.rb +75 -99
- data/lib/generated_definitions/be.rb +12 -10
- data/lib/generated_definitions/be_fr.rb +12 -10
- data/lib/generated_definitions/be_nl.rb +12 -10
- data/lib/generated_definitions/bg.rb +14 -13
- data/lib/generated_definitions/br.rb +11 -9
- data/lib/generated_definitions/ca.rb +20 -20
- data/lib/generated_definitions/ch.rb +41 -44
- data/lib/generated_definitions/cl.rb +9 -7
- data/lib/generated_definitions/cr.rb +9 -7
- data/lib/generated_definitions/cz.rb +9 -6
- data/lib/generated_definitions/de.rb +25 -25
- data/lib/generated_definitions/dk.rb +17 -15
- data/lib/generated_definitions/ecb_target.rb +9 -7
- data/lib/generated_definitions/el.rb +13 -11
- data/lib/generated_definitions/es.rb +35 -33
- data/lib/generated_definitions/europe.rb +234 -247
- data/lib/generated_definitions/federal_reserve.rb +11 -9
- data/lib/generated_definitions/fedex.rb +42 -0
- data/lib/generated_definitions/fi.rb +32 -36
- data/lib/generated_definitions/fr.rb +12 -10
- data/lib/generated_definitions/gb.rb +15 -13
- data/lib/generated_definitions/hr.rb +10 -8
- data/lib/generated_definitions/hu.rb +9 -7
- data/lib/generated_definitions/ie.rb +17 -17
- data/lib/generated_definitions/is.rb +26 -26
- data/lib/generated_definitions/it.rb +9 -7
- data/lib/generated_definitions/jp.rb +112 -89
- data/lib/generated_definitions/li.rb +14 -12
- data/lib/generated_definitions/lt.rb +9 -7
- data/lib/generated_definitions/ma.rb +7 -5
- data/lib/generated_definitions/mx.rb +7 -5
- data/lib/generated_definitions/nerc.rb +10 -8
- data/lib/generated_definitions/nl.rb +15 -13
- data/lib/generated_definitions/no.rb +16 -14
- data/lib/generated_definitions/north_america.rb +34 -37
- data/lib/generated_definitions/nyse.rb +10 -8
- data/lib/generated_definitions/nz.rb +40 -40
- data/lib/generated_definitions/ph.rb +17 -13
- data/lib/generated_definitions/pl.rb +25 -27
- data/lib/generated_definitions/pt.rb +10 -8
- data/lib/generated_definitions/ro.rb +11 -9
- data/lib/generated_definitions/scandinavia.rb +92 -102
- data/lib/generated_definitions/se.rb +25 -27
- data/lib/generated_definitions/sg.rb +11 -9
- data/lib/generated_definitions/si.rb +10 -8
- data/lib/generated_definitions/sk.rb +9 -7
- data/lib/generated_definitions/united_nations.rb +7 -5
- data/lib/generated_definitions/ups.rb +13 -12
- data/lib/generated_definitions/us.rb +20 -21
- data/lib/generated_definitions/ve.rb +11 -9
- data/lib/generated_definitions/vi.rb +7 -5
- data/lib/generated_definitions/za.rb +19 -17
- data/lib/holidays.rb +20 -83
- data/lib/holidays/date_calculator/weekend_modifier.rb +22 -5
- data/lib/holidays/definition/context/generator.rb +67 -29
- data/lib/holidays/definition/context/merger.rb +8 -8
- data/lib/holidays/definition/decorator/custom_method_proc.rb +28 -0
- data/lib/holidays/definition/decorator/custom_method_source.rb +30 -0
- data/lib/holidays/definition/entity/custom_method.rb +11 -0
- data/lib/holidays/definition/parser/custom_method.rb +69 -0
- data/lib/holidays/definition/repository/custom_methods.rb +27 -0
- data/lib/holidays/definition/repository/holidays_by_month.rb +1 -1
- data/lib/holidays/definition/repository/{proc_cache.rb → proc_result_cache.rb} +19 -4
- data/lib/holidays/definition/validator/custom_method.rb +31 -0
- data/lib/holidays/definition_factory.rb +42 -6
- data/lib/holidays/errors.rb +6 -0
- data/lib/holidays/load_all_definitions.rb +57 -0
- data/lib/holidays/option/context/parse_options.rb +26 -16
- data/lib/holidays/option_factory.rb +1 -0
- data/lib/holidays/use_case/context/between.rb +41 -14
- data/lib/holidays/use_case_factory.rb +2 -1
- data/lib/holidays/version.rb +1 -1
- data/test/data/test_single_custom_holiday_with_custom_procs.yaml +24 -0
- data/test/defs/test_defs_at.rb +1 -1
- data/test/defs/test_defs_au.rb +3 -2
- data/test/defs/test_defs_cr.rb +1 -0
- data/test/defs/test_defs_cz.rb +1 -0
- data/test/defs/test_defs_dk.rb +2 -2
- data/test/defs/test_defs_el.rb +7 -6
- data/test/defs/test_defs_europe.rb +40 -33
- data/test/defs/test_defs_fedex.rb +24 -0
- data/test/defs/test_defs_fi.rb +4 -3
- data/test/defs/test_defs_hr.rb +2 -2
- data/test/defs/test_defs_hu.rb +2 -2
- data/test/defs/test_defs_is.rb +2 -1
- data/test/defs/test_defs_it.rb +2 -1
- data/test/defs/test_defs_jp.rb +1 -1
- data/test/defs/test_defs_li.rb +1 -1
- data/test/defs/test_defs_ma.rb +2 -1
- data/test/defs/test_defs_mx.rb +4 -3
- data/test/defs/test_defs_nl.rb +7 -6
- data/test/defs/test_defs_no.rb +1 -0
- data/test/defs/test_defs_north_america.rb +4 -3
- data/test/defs/test_defs_nyse.rb +2 -1
- data/test/defs/test_defs_pl.rb +1 -0
- data/test/defs/test_defs_ro.rb +11 -11
- data/test/defs/test_defs_scandinavia.rb +12 -8
- data/test/defs/test_defs_se.rb +3 -2
- data/test/defs/test_defs_sg.rb +2 -1
- data/test/defs/test_defs_vi.rb +1 -1
- data/test/defs/test_defs_za.rb +3 -2
- data/test/holidays/date_calculator/test_weekend_modifier.rb +11 -0
- data/test/holidays/definition/context/test_generator.rb +64 -5
- data/test/holidays/definition/context/test_merger.rb +5 -2
- data/test/holidays/definition/decorator/test_custom_method_proc.rb +113 -0
- data/test/holidays/definition/decorator/test_custom_method_source.rb +96 -0
- data/test/holidays/definition/parser/test_custom_method.rb +79 -0
- data/test/holidays/definition/repository/test_custom_methods.rb +43 -0
- data/test/holidays/definition/repository/test_holidays_by_month.rb +0 -32
- data/test/holidays/definition/repository/test_proc_result_cache.rb +84 -0
- data/test/holidays/definition/validator/test_custom_method.rb +89 -0
- data/test/holidays/option/context/test_parse_options.rb +5 -0
- data/test/holidays/test_definition_factory.rb +17 -2
- data/test/holidays/use_case/context/test_between.rb +2 -0
- data/test/test_all_regions.rb +7 -49
- data/test/test_custom_holidays.rb +8 -2
- data/test/test_helper.rb +9 -2
- data/test/test_holidays.rb +9 -29
- metadata +46 -11
- data/lib/generated_definitions/fed_ex.rb +0 -41
- data/test/holidays/definition/repository/test_proc_cache.rb +0 -29
- data/test/test_parse_definitions.rb +0 -30
data/definitions/es.yaml
CHANGED
@@ -14,128 +14,131 @@ months:
|
|
14
14
|
0:
|
15
15
|
- name: Jueves Santo
|
16
16
|
regions: [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]
|
17
|
-
function: easter(year)
|
17
|
+
function: easter(year)
|
18
|
+
function_modifier: -3
|
18
19
|
- name: Viernes Santo
|
19
20
|
regions: [es]
|
20
|
-
function: easter(year)
|
21
|
+
function: easter(year)
|
22
|
+
function_modifier: -2
|
21
23
|
- name: Lunes de Pascua
|
22
24
|
regions: [es_pv, es_ct, es_na, es_v, es_vc]
|
23
|
-
function: easter(year)
|
25
|
+
function: easter(year)
|
26
|
+
function_modifier: 1
|
24
27
|
1:
|
25
28
|
- name: Año Nuevo
|
26
29
|
regions: [es]
|
27
30
|
mday: 1
|
28
|
-
observed: to_monday_if_sunday
|
31
|
+
observed: to_monday_if_sunday(date)
|
29
32
|
- name: Día de Reyes
|
30
33
|
regions: [es]
|
31
34
|
mday: 6
|
32
|
-
observed: to_monday_if_sunday
|
35
|
+
observed: to_monday_if_sunday(date)
|
33
36
|
2:
|
34
37
|
- name: Día de Andalucía
|
35
38
|
regions: [es_an]
|
36
39
|
mday: 28
|
37
|
-
observed: to_monday_if_sunday
|
40
|
+
observed: to_monday_if_sunday(date)
|
38
41
|
3:
|
39
42
|
- name: Día de las Islas Baleares
|
40
43
|
regions: [es_ib]
|
41
44
|
mday: 1
|
42
|
-
observed: to_monday_if_sunday
|
45
|
+
observed: to_monday_if_sunday(date)
|
43
46
|
- name: San José
|
44
47
|
regions: [es_v, es_vc, es_cm, es_mu, es_m]
|
45
48
|
mday: 19
|
46
|
-
observed: to_monday_if_sunday
|
49
|
+
observed: to_monday_if_sunday(date)
|
47
50
|
4:
|
48
51
|
- name: Día de Castilla y León
|
49
52
|
regions: [es_cl]
|
50
53
|
mday: 23
|
51
|
-
observed: to_monday_if_sunday
|
54
|
+
observed: to_monday_if_sunday(date)
|
52
55
|
- name: San Jorge, Día de Aragón
|
53
56
|
regions: [es_ar]
|
54
57
|
mday: 23
|
55
|
-
observed: to_monday_if_sunday
|
58
|
+
observed: to_monday_if_sunday(date)
|
56
59
|
5:
|
57
60
|
- name: Día del Trabajador
|
58
61
|
regions: [es]
|
59
62
|
mday: 1
|
60
|
-
observed: to_monday_if_sunday
|
63
|
+
observed: to_monday_if_sunday(date)
|
61
64
|
- name: Fiesta de la Comunidad
|
62
65
|
regions: [es_m]
|
63
66
|
mday: 2
|
64
|
-
observed: to_monday_if_sunday
|
67
|
+
observed: to_monday_if_sunday(date)
|
65
68
|
- name: Día de las Canarias
|
66
69
|
regions: [es_cn]
|
67
70
|
mday: 30
|
68
|
-
observed: to_monday_if_sunday
|
71
|
+
observed: to_monday_if_sunday(date)
|
69
72
|
- name: Día de la Región Castilla-La Mancha
|
70
73
|
regions: [es_cm]
|
71
74
|
mday: 31
|
72
|
-
observed: to_monday_if_sunday
|
75
|
+
observed: to_monday_if_sunday(date)
|
73
76
|
6:
|
74
77
|
- name: Día de la Región de Murcia
|
75
78
|
regions: [es_mu]
|
76
79
|
mday: 9
|
77
|
-
observed: to_monday_if_sunday
|
80
|
+
observed: to_monday_if_sunday(date)
|
78
81
|
- name: Día de La Rioja
|
79
82
|
regions: [es_lo]
|
80
83
|
mday: 9
|
81
|
-
observed: to_monday_if_sunday
|
84
|
+
observed: to_monday_if_sunday(date)
|
82
85
|
7:
|
83
86
|
- name: Santiago Apostol
|
84
87
|
regions: [es_ga]
|
85
88
|
mday: 23
|
86
|
-
observed: to_monday_if_sunday
|
89
|
+
observed: to_monday_if_sunday(date)
|
87
90
|
8:
|
88
91
|
- name: Asunción
|
89
92
|
regions: [es]
|
90
93
|
mday: 15
|
91
|
-
observed: to_monday_if_sunday
|
94
|
+
observed: to_monday_if_sunday(date)
|
92
95
|
9:
|
93
96
|
- name: Día de Ceuta
|
94
97
|
regions: [es_ce]
|
95
98
|
mday: 2
|
96
|
-
observed: to_monday_if_sunday
|
99
|
+
observed: to_monday_if_sunday(date)
|
97
100
|
- name: Día de Asturias
|
98
101
|
regions: [es_o]
|
99
102
|
mday: 8
|
100
|
-
observed: to_monday_if_sunday
|
103
|
+
observed: to_monday_if_sunday(date)
|
101
104
|
- name: Día de Extremadura
|
102
105
|
regions: [es_ex]
|
103
106
|
mday: 8
|
104
107
|
- name: Fiesta Nacional de Cataluña
|
105
108
|
regions: [es_ct]
|
106
109
|
mday: 11
|
107
|
-
observed: to_monday_if_sunday
|
110
|
+
observed: to_monday_if_sunday(date)
|
108
111
|
10:
|
109
112
|
- name: Día de Valencia
|
110
113
|
regions: [es_vc, es_v]
|
111
114
|
mday: 9
|
112
|
-
observed: to_monday_if_sunday
|
115
|
+
observed: to_monday_if_sunday(date)
|
113
116
|
- name: Día de la Hispanidad
|
114
117
|
regions: [es]
|
115
118
|
mday: 12
|
116
|
-
observed: to_monday_if_sunday
|
119
|
+
observed: to_monday_if_sunday(date)
|
117
120
|
11:
|
118
121
|
- name: Todos los Santos
|
119
122
|
regions: [es]
|
120
123
|
mday: 1
|
121
|
-
observed: to_monday_if_sunday
|
124
|
+
observed: to_monday_if_sunday(date)
|
122
125
|
12:
|
123
126
|
- name: Día de la Constitución
|
124
127
|
regions: [es]
|
125
128
|
mday: 6
|
126
|
-
observed: to_monday_if_sunday
|
129
|
+
observed: to_monday_if_sunday(date)
|
127
130
|
- name: Inmaculada Concepción
|
128
131
|
regions: [es]
|
129
132
|
mday: 8
|
130
|
-
observed: to_monday_if_sunday
|
133
|
+
observed: to_monday_if_sunday(date)
|
131
134
|
- name: Navidad del Señor
|
132
135
|
regions: [es]
|
133
136
|
mday: 25
|
134
|
-
observed: to_monday_if_sunday
|
137
|
+
observed: to_monday_if_sunday(date)
|
135
138
|
- name: San Esteban
|
136
139
|
regions: [es_ib, es_ct]
|
137
140
|
mday: 26
|
138
|
-
observed: to_monday_if_sunday
|
141
|
+
observed: to_monday_if_sunday(date)
|
139
142
|
tests: |
|
140
143
|
{Date.civil(2009,1,1) => 'Año Nuevo',
|
141
144
|
Date.civil(2009,1,6) => 'Día de Reyes',
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Federal reserve holidays definition for the Ruby Holiday gem.
|
2
2
|
#
|
3
3
|
# Updated: 2015-03-16
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# Sources:
|
6
6
|
# - http://www.federalreserve.gov/aboutthefed/k8.htm
|
7
7
|
---
|
@@ -9,8 +9,8 @@ months:
|
|
9
9
|
1:
|
10
10
|
- name: New Year's Day
|
11
11
|
regions: [federal_reserve]
|
12
|
-
mday: 1
|
13
|
-
observed: to_monday_if_sunday
|
12
|
+
mday: 1
|
13
|
+
observed: to_monday_if_sunday(date)
|
14
14
|
- name: Birthday of Martin Luther King, Jr
|
15
15
|
week: 3
|
16
16
|
wday: 1
|
@@ -20,40 +20,40 @@ months:
|
|
20
20
|
week: 3
|
21
21
|
wday: 1
|
22
22
|
regions: [federal_reserve]
|
23
|
-
5:
|
23
|
+
5:
|
24
24
|
- name: Memorial Day
|
25
25
|
week: -1
|
26
26
|
wday: 1
|
27
27
|
regions: [federal_reserve]
|
28
|
-
7:
|
28
|
+
7:
|
29
29
|
- name: Independence Day
|
30
30
|
regions: [federal_reserve]
|
31
31
|
mday: 4
|
32
|
-
observed: to_monday_if_sunday
|
33
|
-
9:
|
32
|
+
observed: to_monday_if_sunday(date)
|
33
|
+
9:
|
34
34
|
- name: Labor Day
|
35
35
|
week: 1
|
36
36
|
regions: [federal_reserve]
|
37
37
|
wday: 1
|
38
|
-
10:
|
38
|
+
10:
|
39
39
|
- name: Columbus Day
|
40
40
|
week: 2
|
41
41
|
regions: [federal_reserve]
|
42
42
|
wday: 1
|
43
|
-
11:
|
43
|
+
11:
|
44
44
|
- name: Veterans Day
|
45
45
|
regions: [federal_reserve]
|
46
46
|
mday: 11
|
47
|
-
observed: to_monday_if_sunday
|
47
|
+
observed: to_monday_if_sunday(date)
|
48
48
|
- name: Thanksgiving Day
|
49
49
|
week: 4
|
50
50
|
wday: 4
|
51
51
|
regions: [federal_reserve]
|
52
|
-
12:
|
52
|
+
12:
|
53
53
|
- name: Christmas Day
|
54
54
|
regions: [federal_reserve]
|
55
55
|
mday: 25
|
56
|
-
observed: to_monday_if_sunday
|
56
|
+
observed: to_monday_if_sunday(date)
|
57
57
|
tests: |
|
58
58
|
{Date.civil(2012,1,2) => "New Year's Day",
|
59
59
|
Date.civil(2012,1,16) => "Birthday of Martin Luther King, Jr",
|
data/definitions/fedex.yaml
CHANGED
@@ -10,7 +10,7 @@ months:
|
|
10
10
|
- name: New Year's Day
|
11
11
|
regions: [fedex]
|
12
12
|
mday: 1
|
13
|
-
observed: to_weekday_if_weekend
|
13
|
+
observed: to_weekday_if_weekend(date)
|
14
14
|
5:
|
15
15
|
- name: Memorial Day
|
16
16
|
week: -1
|
@@ -20,7 +20,7 @@ months:
|
|
20
20
|
- name: Independence Day
|
21
21
|
regions: [fedex]
|
22
22
|
mday: 4
|
23
|
-
observed: to_weekday_if_weekend
|
23
|
+
observed: to_weekday_if_weekend(date)
|
24
24
|
9:
|
25
25
|
- name: Labor Day
|
26
26
|
week: 1
|
@@ -38,15 +38,15 @@ months:
|
|
38
38
|
- name: Christmas Day
|
39
39
|
regions: [fedex]
|
40
40
|
mday: 25
|
41
|
-
observed: to_weekday_if_weekend
|
41
|
+
observed: to_weekday_if_weekend(date)
|
42
42
|
- name: New Year's Eve
|
43
43
|
regions: [fedex]
|
44
44
|
mday: 31
|
45
45
|
methods:
|
46
|
-
day_after_thanksgiving:
|
47
|
-
|
46
|
+
day_after_thanksgiving:
|
47
|
+
arguments: year
|
48
|
+
source: |
|
48
49
|
Holidays::DateCalculatorFactory.day_of_month_calculator.call(year, 11, 4, 4) + 1
|
49
|
-
end
|
50
50
|
tests: |
|
51
51
|
{Date.civil(2015,1,1) => 'New Year\'s Day',
|
52
52
|
Date.civil(2015,5,25) => 'Memorial Day',
|
data/definitions/fi.yaml
CHANGED
@@ -3,36 +3,38 @@
|
|
3
3
|
# Updated: 2010-12-28.
|
4
4
|
# Sources:
|
5
5
|
# - http://en.wikipedia.org/wiki/Public_holidays_in_Finland
|
6
|
-
---
|
6
|
+
---
|
7
7
|
months:
|
8
|
-
0:
|
8
|
+
0:
|
9
9
|
- name: Pitkäperjantai
|
10
10
|
regions: [fi]
|
11
|
-
function: easter(year)
|
11
|
+
function: easter(year)
|
12
|
+
function_modifier: -2
|
12
13
|
- name: Pääsiäispäivä
|
13
14
|
regions: [fi]
|
14
15
|
function: easter(year)
|
15
16
|
- name: 2. Pääsiäispäivä
|
16
17
|
regions: [fi]
|
17
|
-
function: easter(year)
|
18
|
+
function: easter(year)
|
19
|
+
function_modifier: 1
|
18
20
|
- name: Helatorstai # Ascension Day
|
19
21
|
regions: [fi]
|
20
|
-
function: easter(year)
|
22
|
+
function: easter(year)
|
23
|
+
function_modifier: 39
|
21
24
|
- name: Helluntaipäivä # Whitsunday
|
22
25
|
regions: [fi]
|
23
|
-
function: easter(year)
|
26
|
+
function: easter(year)
|
27
|
+
function_modifier: 49
|
24
28
|
- name: Pyhäinpäivä # All Saint's Day
|
25
29
|
regions: [fi]
|
26
30
|
function: fi_pyhainpaiva(year)
|
27
|
-
|
28
|
-
1:
|
31
|
+
1:
|
29
32
|
- name: Uudenvuodenpäivä
|
30
33
|
regions: [fi]
|
31
34
|
mday: 1
|
32
35
|
- name: Loppiainen
|
33
36
|
regions: [fi]
|
34
37
|
mday: 6
|
35
|
-
|
36
38
|
5:
|
37
39
|
- name: Vappu
|
38
40
|
regions: [fi]
|
@@ -44,8 +46,7 @@ months:
|
|
44
46
|
- name: Juhannuspäivä
|
45
47
|
regions: [fi]
|
46
48
|
function: fi_juhannuspaiva(year)
|
47
|
-
|
48
|
-
12:
|
49
|
+
12:
|
49
50
|
- name: Itsenäisyyspäivä
|
50
51
|
regions: [fi]
|
51
52
|
mday: 6
|
@@ -59,36 +60,36 @@ months:
|
|
59
60
|
regions: [fi]
|
60
61
|
mday: 26
|
61
62
|
methods:
|
62
|
-
fi_juhannusaatto:
|
63
|
+
fi_juhannusaatto:
|
63
64
|
# Finland: Mid-summer eve (Friday between June 19–25)
|
64
|
-
|
65
|
+
arguments: year
|
66
|
+
source: |
|
65
67
|
date = Date.civil(year,6,19)
|
66
68
|
if date.wday > 5 #if 19.6 is saturday
|
67
69
|
date += 6
|
68
|
-
else
|
70
|
+
else
|
69
71
|
date += (5 - date.wday)
|
70
72
|
end
|
71
73
|
date
|
72
|
-
|
73
|
-
fi_juhannuspaiva: |
|
74
|
+
fi_juhannuspaiva:
|
74
75
|
# Finland: Mid-summer (Saturday between June 20–26)
|
75
|
-
|
76
|
+
arguments: year
|
77
|
+
source: |
|
76
78
|
date = Date.civil(year,6,20)
|
77
79
|
date += (6 - date.wday)
|
78
80
|
date
|
79
|
-
|
80
|
-
fi_pyhainpaiva: |
|
81
|
+
fi_pyhainpaiva:
|
81
82
|
# Finland: All Saint's Day (Saturday between Oct 31 and Nov 6)
|
82
|
-
|
83
|
+
arguments: year
|
84
|
+
source: |
|
83
85
|
date = Date.civil(year,10,31)
|
84
86
|
date += (6 - date.wday)
|
85
87
|
date
|
86
|
-
end
|
87
88
|
tests: |
|
88
|
-
{Date.civil(2008,1,1) => 'Uudenvuodenpäivä',
|
89
|
+
{Date.civil(2008,1,1) => 'Uudenvuodenpäivä',
|
89
90
|
Date.civil(2008,1,6) => 'Loppiainen',
|
90
|
-
Date.civil(2008,3,21) => 'Pitkäperjantai',
|
91
|
-
Date.civil(2008,3,23) => 'Pääsiäispäivä',
|
91
|
+
Date.civil(2008,3,21) => 'Pitkäperjantai',
|
92
|
+
Date.civil(2008,3,23) => 'Pääsiäispäivä',
|
92
93
|
Date.civil(2008,3,24) => '2. Pääsiäispäivä',
|
93
94
|
Date.civil(2008,5,1) => 'Vappu',
|
94
95
|
Date.civil(2008,5,1) => 'Helatorstai',
|
@@ -111,4 +112,4 @@ tests: |
|
|
111
112
|
Date.civil(2008,12,25) => 'Joulupäivä',
|
112
113
|
Date.civil(2008,12,26) => 'Tapaninpäivä'}.each do |date, name|
|
113
114
|
assert_equal name, (Holidays.on(date, :fi, :informal)[0] || {})[:name]
|
114
|
-
end
|
115
|
+
end
|
data/definitions/fr.yaml
CHANGED
@@ -13,17 +13,21 @@ months:
|
|
13
13
|
type: informal
|
14
14
|
- name: Lundi de Pâques
|
15
15
|
regions: [fr]
|
16
|
-
function: easter(year)
|
16
|
+
function: easter(year)
|
17
|
+
function_modifier: 1
|
17
18
|
- name: Ascension
|
18
19
|
regions: [fr]
|
19
|
-
function: easter(year)
|
20
|
+
function: easter(year)
|
21
|
+
function_modifier: 39
|
20
22
|
- name: Pentecôte
|
21
23
|
regions: [fr]
|
22
|
-
function: easter(year)
|
24
|
+
function: easter(year)
|
25
|
+
function_modifier: 49
|
23
26
|
type: informal
|
24
27
|
- name: Lundi de Pentecôte
|
25
28
|
regions: [fr]
|
26
|
-
function: easter(year)
|
29
|
+
function: easter(year)
|
30
|
+
function_modifier: 50
|
27
31
|
1:
|
28
32
|
- name: Jour de l'an
|
29
33
|
regions: [fr]
|
data/definitions/gb.yaml
CHANGED
@@ -15,22 +15,24 @@ months:
|
|
15
15
|
0:
|
16
16
|
- name: Good Friday
|
17
17
|
regions: [gb]
|
18
|
-
function: easter(year)
|
18
|
+
function: easter(year)
|
19
|
+
function_modifier: -2
|
19
20
|
- name: Easter Sunday
|
20
21
|
regions: [gb]
|
21
22
|
function: easter(year)
|
22
23
|
- name: Easter Monday
|
23
24
|
regions: [gb_eng, gb_wls, gb_eaw, gb_nir]
|
24
|
-
function: easter(year)
|
25
|
+
function: easter(year)
|
26
|
+
function_modifier: 1
|
25
27
|
1:
|
26
28
|
- name: New Year's Day
|
27
29
|
regions: [gb]
|
28
30
|
mday: 1
|
29
|
-
observed: to_monday_if_weekend
|
31
|
+
observed: to_monday_if_weekend(date)
|
30
32
|
- name: 2nd January
|
31
33
|
regions: [gb_sct]
|
32
34
|
mday: 2
|
33
|
-
observed: to_weekday_if_boxing_weekend
|
35
|
+
observed: to_weekday_if_boxing_weekend(date)
|
34
36
|
3:
|
35
37
|
- name: St. Piran's Day
|
36
38
|
regions: [gb_con]
|
@@ -75,16 +77,16 @@ months:
|
|
75
77
|
regions: [gb_sct]
|
76
78
|
mday: 30
|
77
79
|
type: informal
|
78
|
-
observed: to_monday_if_weekend
|
80
|
+
observed: to_monday_if_weekend(date)
|
79
81
|
12:
|
80
82
|
- name: Christmas Day
|
81
83
|
regions: [gb]
|
82
84
|
mday: 25
|
83
|
-
observed: to_monday_if_weekend
|
85
|
+
observed: to_monday_if_weekend(date)
|
84
86
|
- name: Boxing Day
|
85
87
|
regions: [gb]
|
86
88
|
mday: 26
|
87
|
-
observed: to_weekday_if_boxing_weekend
|
89
|
+
observed: to_weekday_if_boxing_weekend(date)
|
88
90
|
tests: |
|
89
91
|
{Date.civil(2008,3,21) => 'Good Friday',
|
90
92
|
Date.civil(2008,3,23) => 'Easter Sunday',
|