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/sg.yaml
CHANGED
@@ -10,15 +10,16 @@
|
|
10
10
|
# http://publicholidays.sg/
|
11
11
|
|
12
12
|
months:
|
13
|
-
0:
|
13
|
+
0:
|
14
14
|
- name: Good Friday
|
15
15
|
regions: [sg]
|
16
|
-
function: easter(year)
|
17
|
-
|
16
|
+
function: easter(year)
|
17
|
+
function_modifier: -2
|
18
|
+
1:
|
18
19
|
- name: New Year's Day
|
19
20
|
regions: [sg]
|
20
21
|
mday: 1
|
21
|
-
observed: to_weekday_if_weekend
|
22
|
+
observed: to_weekday_if_weekend(date)
|
22
23
|
2:
|
23
24
|
- name: Valentine's Day
|
24
25
|
regions: [sg]
|
@@ -36,15 +37,15 @@ months:
|
|
36
37
|
- name: National Day
|
37
38
|
regions: [sg]
|
38
39
|
mday: 9
|
39
|
-
observed: to_weekday_if_weekend
|
40
|
-
12:
|
40
|
+
observed: to_weekday_if_weekend(date)
|
41
|
+
12:
|
41
42
|
- name: Christmas Day
|
42
43
|
regions: [sg]
|
43
44
|
mday: 25
|
44
|
-
observed: to_weekday_if_weekend
|
45
|
+
observed: to_weekday_if_weekend(date)
|
45
46
|
|
46
47
|
tests: |
|
47
|
-
{Date.civil(2014,1,1) => 'New Year\'s Day',
|
48
|
+
{Date.civil(2014,1,1) => 'New Year\'s Day',
|
48
49
|
Date.civil(2014,2,14) => 'Valentine\'s Day',
|
49
50
|
Date.civil(2014,2,15) => 'Total Defence Day',
|
50
51
|
Date.civil(2014,4,18) => 'Good Friday',
|
@@ -52,4 +53,4 @@ tests: |
|
|
52
53
|
Date.civil(2014,8,9) => 'National Day',
|
53
54
|
Date.civil(2014,12,25) => 'Christmas Day'}.each do |date, name|
|
54
55
|
assert_equal name, (Holidays.on(date, :sg, :informal)[0] || {})[:name]
|
55
|
-
end
|
56
|
+
end
|
data/definitions/si.yaml
CHANGED
@@ -11,10 +11,12 @@ months:
|
|
11
11
|
function: easter(year)
|
12
12
|
- name: velikonočni ponedeljek
|
13
13
|
regions: [si]
|
14
|
-
function: easter(year)
|
14
|
+
function: easter(year)
|
15
|
+
function_modifier: 1
|
15
16
|
- name: binkošti
|
16
17
|
regions: [si]
|
17
|
-
function: easter(year)
|
18
|
+
function: easter(year)
|
19
|
+
function_modifier: 49
|
18
20
|
1:
|
19
21
|
- name: novo leto
|
20
22
|
regions: [si]
|
data/definitions/sk.yaml
CHANGED
@@ -8,10 +8,12 @@ months:
|
|
8
8
|
0:
|
9
9
|
- name: Veľkonočný pondelok
|
10
10
|
regions: [sk]
|
11
|
-
function: easter(year)
|
11
|
+
function: easter(year)
|
12
|
+
function_modifier: 1
|
12
13
|
- name: Veľký piatok
|
13
14
|
regions: [sk]
|
14
|
-
function: easter(year)
|
15
|
+
function: easter(year)
|
16
|
+
function_modifier: -2
|
15
17
|
1:
|
16
18
|
- name: Nový rok
|
17
19
|
regions: [sk]
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# United Nationas holiday definitions for the Ruby Holiday gem.
|
2
2
|
# Updated 2008-11-21.
|
3
|
-
---
|
3
|
+
---
|
4
4
|
months:
|
5
|
-
2:
|
5
|
+
2:
|
6
6
|
- name: International Mother Language Day
|
7
7
|
regions: [united_nations]
|
8
8
|
mday: 2
|
9
|
-
3:
|
9
|
+
3:
|
10
10
|
- name: United Nations Day for Women's Rights and International Peace
|
11
11
|
regions: [united_nations]
|
12
12
|
mday: 8
|
@@ -22,14 +22,14 @@ months:
|
|
22
22
|
- name: World Meteorological Day
|
23
23
|
regions: [united_nations]
|
24
24
|
mday: 23
|
25
|
-
4:
|
25
|
+
4:
|
26
26
|
- name: World Health Day
|
27
27
|
regions: [united_nations]
|
28
28
|
mday: 7
|
29
29
|
- name: World Book and Copyright Day
|
30
30
|
regions: [united_nations]
|
31
31
|
mday: 23
|
32
|
-
5:
|
32
|
+
5:
|
33
33
|
- name: World Press Freedom Day
|
34
34
|
regions: [united_nations]
|
35
35
|
mday: 3
|
@@ -54,7 +54,7 @@ months:
|
|
54
54
|
- name: World No-Tobacco Day
|
55
55
|
regions: [united_nations]
|
56
56
|
mday: 31
|
57
|
-
6:
|
57
|
+
6:
|
58
58
|
- name: International Day of Innocent Children Victims of Aggression
|
59
59
|
regions: [united_nations]
|
60
60
|
mday: 4
|
@@ -76,7 +76,7 @@ months:
|
|
76
76
|
- name: International Day in Support of Victims of Torture
|
77
77
|
regions: [united_nations]
|
78
78
|
mday: 26
|
79
|
-
7:
|
79
|
+
7:
|
80
80
|
- name: International Day of Cooperatives
|
81
81
|
week: 1
|
82
82
|
regions: [united_nations]
|
@@ -84,7 +84,7 @@ months:
|
|
84
84
|
- name: World Population Day
|
85
85
|
regions: [united_nations]
|
86
86
|
mday: 11
|
87
|
-
8:
|
87
|
+
8:
|
88
88
|
- name: International Day of the World's Indigenous People
|
89
89
|
regions: [united_nations]
|
90
90
|
mday: 9
|
@@ -94,7 +94,7 @@ months:
|
|
94
94
|
- name: International Day for the Remembrance of the Slave Trade and Its Abolition
|
95
95
|
regions: [united_nations]
|
96
96
|
mday: 23
|
97
|
-
9:
|
97
|
+
9:
|
98
98
|
- name: International Literacy Day
|
99
99
|
regions: [united_nations]
|
100
100
|
mday: 8
|
@@ -107,7 +107,7 @@ months:
|
|
107
107
|
- name: International Day of Older Persons
|
108
108
|
regions: [united_nations]
|
109
109
|
mday: 1
|
110
|
-
10:
|
110
|
+
10:
|
111
111
|
- name: World Space Week
|
112
112
|
regions: [united_nations]
|
113
113
|
mday: 4
|
@@ -143,7 +143,7 @@ months:
|
|
143
143
|
- name: Disarmament Week
|
144
144
|
regions: [united_nations]
|
145
145
|
mday: 24
|
146
|
-
11:
|
146
|
+
11:
|
147
147
|
- name: International Day for Preventing the Exploitation of the Environment in War and Armed Conflict
|
148
148
|
regions: [united_nations]
|
149
149
|
mday: 6
|
@@ -165,7 +165,7 @@ months:
|
|
165
165
|
- name: International Day of Solidarity with the Palestinian People
|
166
166
|
regions: [united_nations]
|
167
167
|
mday: 29
|
168
|
-
12:
|
168
|
+
12:
|
169
169
|
- name: World AIDS Day
|
170
170
|
regions: [united_nations]
|
171
171
|
mday: 1
|
data/definitions/ups.yaml
CHANGED
@@ -10,7 +10,7 @@ months:
|
|
10
10
|
- name: New Year's Day
|
11
11
|
regions: [ups]
|
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: [ups]
|
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: [ups]
|
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: [ups]
|
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(2008,1,1) => 'New Year\'s Day',
|
52
52
|
Date.civil(2008,5,26) => 'Memorial Day',
|
data/definitions/us.yaml
CHANGED
@@ -7,7 +7,8 @@ months:
|
|
7
7
|
0:
|
8
8
|
- name: Good Friday
|
9
9
|
regions: [us]
|
10
|
-
function: easter(year)
|
10
|
+
function: easter(year)
|
11
|
+
function_modifier: -2
|
11
12
|
type: informal
|
12
13
|
- name: Easter Sunday
|
13
14
|
regions: [us]
|
@@ -17,7 +18,7 @@ months:
|
|
17
18
|
- name: New Year's Day
|
18
19
|
regions: [us]
|
19
20
|
mday: 1
|
20
|
-
observed: to_weekday_if_weekend
|
21
|
+
observed: to_weekday_if_weekend(date)
|
21
22
|
- name: Martin Luther King, Jr. Day
|
22
23
|
week: 3
|
23
24
|
regions: [us]
|
@@ -43,7 +44,7 @@ months:
|
|
43
44
|
- name: Independence Day
|
44
45
|
regions: [us]
|
45
46
|
mday: 4
|
46
|
-
observed: to_weekday_if_weekend
|
47
|
+
observed: to_weekday_if_weekend(date)
|
47
48
|
9:
|
48
49
|
- name: Labor Day
|
49
50
|
week: 1
|
@@ -58,7 +59,7 @@ months:
|
|
58
59
|
- name: Veterans Day
|
59
60
|
regions: [us]
|
60
61
|
mday: 11
|
61
|
-
observed: to_weekday_if_weekend
|
62
|
+
observed: to_weekday_if_weekend(date)
|
62
63
|
- name: Thanksgiving
|
63
64
|
week: 4
|
64
65
|
regions: [us]
|
@@ -70,17 +71,17 @@ months:
|
|
70
71
|
- name: Christmas Day
|
71
72
|
regions: [us]
|
72
73
|
mday: 25
|
73
|
-
observed: to_weekday_if_weekend
|
74
|
+
observed: to_weekday_if_weekend(date)
|
74
75
|
methods:
|
75
|
-
us_inauguration_day:
|
76
|
+
us_inauguration_day:
|
76
77
|
# January 20, every fourth year, following Presidential election
|
77
|
-
|
78
|
+
arguments: year
|
79
|
+
source: |
|
78
80
|
year % 4 == 1 ? 20 : nil
|
79
|
-
|
80
|
-
|
81
|
-
|
81
|
+
day_after_thanksgiving:
|
82
|
+
arguments: year
|
83
|
+
source: |
|
82
84
|
Holidays::DateCalculatorFactory.day_of_month_calculator.call(year, 11, 4, 4) + 1
|
83
|
-
end
|
84
85
|
tests: |
|
85
86
|
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
86
87
|
Date.civil(2008,1,21) => 'Martin Luther King, Jr. Day',
|
data/definitions/ve.yaml
CHANGED
@@ -9,16 +9,20 @@ months:
|
|
9
9
|
0:
|
10
10
|
- name: Lunes Carnaval
|
11
11
|
regions: [ve]
|
12
|
-
function: easter(year)
|
12
|
+
function: easter(year)
|
13
|
+
function_modifier: -48
|
13
14
|
- name: Martes Carnaval
|
14
15
|
regions: [ve]
|
15
|
-
function: easter(year)
|
16
|
+
function: easter(year)
|
17
|
+
function_modifier: -47
|
16
18
|
- name: Jueves Santo
|
17
19
|
regions: [ve]
|
18
|
-
function: easter(year)
|
20
|
+
function: easter(year)
|
21
|
+
function_modifier: -3
|
19
22
|
- name: Viernes Santo
|
20
23
|
regions: [ve]
|
21
|
-
function: easter(year)
|
24
|
+
function: easter(year)
|
25
|
+
function_modifier: -2
|
22
26
|
1:
|
23
27
|
- name: Año Nuevo
|
24
28
|
regions: [ve]
|
data/definitions/vi.yaml
CHANGED
@@ -2,26 +2,26 @@
|
|
2
2
|
#
|
3
3
|
# Updated: 2014-07-17.
|
4
4
|
# Source: http://en.wikipedia.org/wiki/Public_holidays_in_Vietnam
|
5
|
-
---
|
5
|
+
---
|
6
6
|
months:
|
7
|
-
1:
|
7
|
+
1:
|
8
8
|
- name: New Year
|
9
9
|
regions: [vi]
|
10
10
|
mday: 1
|
11
|
-
4:
|
11
|
+
4:
|
12
12
|
- name: Liberation Day
|
13
13
|
regions: [vi]
|
14
14
|
mday: 30
|
15
|
-
5:
|
15
|
+
5:
|
16
16
|
- name: International Workers' Day
|
17
17
|
regions: [vi]
|
18
18
|
mday: 1
|
19
|
-
9:
|
19
|
+
9:
|
20
20
|
- name: National Day
|
21
21
|
regions: [vi]
|
22
22
|
mday: 2
|
23
23
|
tests: |
|
24
|
-
{Date.civil(2014,1,1) => 'New Year',
|
24
|
+
{Date.civil(2014,1,1) => 'New Year',
|
25
25
|
Date.civil(2014,4,30) => 'Liberation Day',
|
26
26
|
Date.civil(2014,5,1) => "International Workers' Day",
|
27
27
|
Date.civil(2014,9,2) => 'National Day'}.each do |date, name|
|
data/definitions/za.yaml
CHANGED
@@ -4,66 +4,68 @@
|
|
4
4
|
# Sources:
|
5
5
|
# - http://en.wikipedia.org/wiki/Public_holidays_in_South_Africa
|
6
6
|
# - http://www.info.gov.za/aboutsa/holidays.htm
|
7
|
-
---
|
7
|
+
---
|
8
8
|
months:
|
9
|
-
0:
|
9
|
+
0:
|
10
10
|
- name: Good Friday
|
11
11
|
regions: [za]
|
12
|
-
function: easter(year)
|
12
|
+
function: easter(year)
|
13
|
+
function_modifier: -2
|
13
14
|
- name: Family Day
|
14
15
|
regions: [za]
|
15
|
-
function: easter(year)
|
16
|
-
|
16
|
+
function: easter(year)
|
17
|
+
function_modifier: 1
|
18
|
+
1:
|
17
19
|
- name: New Year's Day
|
18
20
|
regions: [za]
|
19
21
|
mday: 1
|
20
|
-
observed: to_monday_if_sunday
|
21
|
-
3:
|
22
|
+
observed: to_monday_if_sunday(date)
|
23
|
+
3:
|
22
24
|
- name: Human Rights Day
|
23
25
|
regions: [za]
|
24
26
|
mday: 21
|
25
|
-
observed: to_monday_if_sunday
|
26
|
-
4:
|
27
|
+
observed: to_monday_if_sunday(date)
|
28
|
+
4:
|
27
29
|
- name: Freedom Day
|
28
30
|
regions: [za]
|
29
31
|
mday: 27
|
30
|
-
observed: to_monday_if_sunday
|
31
|
-
5:
|
32
|
+
observed: to_monday_if_sunday(date)
|
33
|
+
5:
|
32
34
|
- name: Workers Day
|
33
35
|
regions: [za]
|
34
36
|
mday: 1
|
35
|
-
observed: to_monday_if_sunday
|
37
|
+
observed: to_monday_if_sunday(date)
|
36
38
|
6:
|
37
39
|
- name: Youth Day
|
38
40
|
regions: [za]
|
39
41
|
mday: 16
|
40
|
-
observed: to_monday_if_sunday
|
41
|
-
8:
|
42
|
+
observed: to_monday_if_sunday(date)
|
43
|
+
8:
|
42
44
|
- name: National Women's Day
|
43
45
|
regions: [za]
|
44
46
|
mday: 9
|
45
|
-
observed: to_monday_if_sunday
|
46
|
-
9:
|
47
|
+
observed: to_monday_if_sunday(date)
|
48
|
+
9:
|
47
49
|
- name: Heritage Day
|
48
50
|
regions: [za]
|
49
51
|
mday: 24
|
50
|
-
observed: to_monday_if_sunday
|
51
|
-
12:
|
52
|
+
observed: to_monday_if_sunday(date)
|
53
|
+
12:
|
52
54
|
- name: Day of Reconciliation
|
53
55
|
regions: [za]
|
54
56
|
mday: 16
|
55
|
-
observed: to_monday_if_sunday
|
57
|
+
observed: to_monday_if_sunday(date)
|
56
58
|
- name: Christmas Day
|
57
59
|
regions: [za]
|
58
60
|
mday: 25
|
59
|
-
observed: to_monday_if_sunday
|
61
|
+
observed: to_monday_if_sunday(date)
|
60
62
|
- name: Day of Goodwill
|
61
63
|
regions: [za]
|
62
64
|
mday: 26
|
63
|
-
observed: to_weekday_if_boxing_weekend
|
65
|
+
observed: to_weekday_if_boxing_weekend(date)
|
64
66
|
tests: |
|
65
|
-
{Date.civil(2007,1,1) => 'New Year\'s Day',
|
66
|
-
Date.civil(2007,3,21) => 'Human Rights Day',
|
67
|
+
{Date.civil(2007,1,1) => 'New Year\'s Day',
|
68
|
+
Date.civil(2007,3,21) => 'Human Rights Day',
|
67
69
|
Date.civil(2007,4,6) => 'Good Friday',
|
68
70
|
Date.civil(2007,4,9) => 'Family Day',
|
69
71
|
Date.civil(2007,4,27) => 'Freedom Day',
|
@@ -75,4 +77,4 @@ tests: |
|
|
75
77
|
Date.civil(2007,12,25) => 'Christmas Day',
|
76
78
|
Date.civil(2007,12,26) => 'Day of Goodwill'}.each do |date, name|
|
77
79
|
assert_equal name, (Holidays.on(date, :za, :informal)[0] || {})[:name]
|
78
|
-
end
|
80
|
+
end
|
data/holidays.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.name = 'holidays'
|
9
9
|
gem.version = Holidays::VERSION
|
10
10
|
gem.authors = ['Alex Dunae', 'Phil Trimble']
|
11
|
-
gem.email = ['
|
11
|
+
gem.email = ['holidaysgem@gmail.com']
|
12
12
|
gem.homepage = 'https://github.com/holidays/holidays'
|
13
13
|
gem.description = %q(A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!)
|
14
14
|
gem.summary = %q(A collection of Ruby methods to deal with statutory and other holidays.)
|
@@ -16,9 +16,11 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.test_files = gem.files.grep(/^test/)
|
17
17
|
gem.require_paths = ['lib']
|
18
18
|
gem.licenses = ['MIT']
|
19
|
+
gem.required_ruby_version = '~> 2.0'
|
19
20
|
gem.add_development_dependency 'bundler'
|
20
21
|
gem.add_development_dependency 'rake'
|
21
22
|
gem.add_development_dependency 'coveralls'
|
22
23
|
gem.add_development_dependency 'test-unit'
|
23
24
|
gem.add_development_dependency 'mocha', '~>1.0'
|
25
|
+
gem.add_development_dependency 'pry', '~>0.10'
|
24
26
|
end
|
@@ -21,8 +21,8 @@ The following definition files are included in this installation:
|
|
21
21
|
* generated_definitions/el
|
22
22
|
* generated_definitions/es
|
23
23
|
* generated_definitions/europe
|
24
|
-
* generated_definitions/fed_ex
|
25
24
|
* generated_definitions/federal_reserve
|
25
|
+
* generated_definitions/fedex
|
26
26
|
* generated_definitions/fi
|
27
27
|
* generated_definitions/fr
|
28
28
|
* generated_definitions/gb
|