holidays 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/holidays/nyse.rb CHANGED
@@ -15,15 +15,15 @@ module Holidays
15
15
  DEFINED_REGIONS = [:nyse]
16
16
 
17
17
  HOLIDAYS_BY_MONTH = {
18
+ 5 => [{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:nyse]}],
18
19
  0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:nyse]}],
20
+ 11 => [{:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:nyse]}],
19
21
  1 => [{:mday => 1, :name => "New Year's Day", :regions => [:nyse]},
20
22
  {:wday => 1, :week => 3, :name => "Martin Luther King, Jr. Day", :regions => [:nyse]}],
21
- 2 => [{:wday => 1, :week => 3, :name => "Presidents' Day", :regions => [:nyse]}],
22
- 5 => [{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:nyse]}],
23
+ 12 => [{:mday => 25, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Christmas Day", :regions => [:nyse]}],
23
24
  7 => [{:mday => 4, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Independence Day", :regions => [:nyse]}],
24
- 9 => [{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:nyse]}],
25
- 11 => [{:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:nyse]}],
26
- 12 => [{:mday => 25, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Christmas Day", :regions => [:nyse]}]
25
+ 2 => [{:wday => 1, :week => 3, :name => "Presidents' Day", :regions => [:nyse]}],
26
+ 9 => [{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:nyse]}]
27
27
  }
28
28
  end
29
29
 
data/lib/holidays/nz.rb CHANGED
@@ -12,33 +12,33 @@ module Holidays
12
12
  #
13
13
  # More definitions are available at http://code.dunae.ca/holidays.
14
14
  module NZ # :nodoc:
15
- DEFINED_REGIONS = [:nz, :nz_sl, :nz_we, :nz_ak, :nz_nl, :nz_ot, :nz_sc, :nz_hb, :nz_mb, :nz_ca, :nz_ch, :nz_wl]
15
+ DEFINED_REGIONS = [:nz_ca, :nz_ch, :nz, :nz_wl, :nz_sl, :nz_we, :nz_ak, :nz_nl, :nz_ot, :nz_sc, :nz_hb, :nz_mb]
16
16
 
17
17
  HOLIDAYS_BY_MONTH = {
18
18
  0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:nz]},
19
19
  {:function => lambda { |year| Holidays.easter(year)-1 }, :function_id => "easter(year)-1", :name => "Easter Saturday", :regions => [:nz]},
20
20
  {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Easter Monday", :regions => [:nz]}],
21
+ 11 => [{:wday => 5, :week => 2, :name => "Canterbury Anniversary Day", :regions => [:nz_ca]},
22
+ {:mday => 30, :observed => lambda { |date| Holidays.closest_monday(date) }, :observed_id => "closest_monday", :name => "Chatham Island Anniversary Day", :regions => [:nz_ch]}],
23
+ 6 => [{:wday => 1, :week => 1, :name => "Queen's Birthday", :regions => [:nz]}],
21
24
  1 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_weekend(date) }, :observed_id => "to_monday_if_weekend", :name => "New Year's Day", :regions => [:nz]},
22
25
  {:mday => 2, :observed => lambda { |date| Holidays.to_weekday_if_boxing_weekend(date) }, :observed_id => "to_weekday_if_boxing_weekend", :name => "Day after New Year's Day", :regions => [:nz]},
23
26
  {:mday => 17, :name => "Southland Anniversary Day", :regions => [:nz_sl]},
24
27
  {:mday => 22, :observed => lambda { |date| Holidays.closest_monday(date) }, :observed_id => "closest_monday", :name => "Wellington Anniversary Day", :regions => [:nz_we]},
25
28
  {:mday => 29, :observed => lambda { |date| Holidays.closest_monday(date) }, :observed_id => "closest_monday", :name => "Auckland Anniversary Day", :regions => [:nz_ak]},
26
29
  {:mday => 29, :observed => lambda { |date| Holidays.closest_monday(date) }, :observed_id => "closest_monday", :name => "Northland Anniversary Day", :regions => [:nz_nl]}],
30
+ 12 => [{:mday => 1, :observed => lambda { |date| Holidays.closest_monday(date) }, :observed_id => "closest_monday", :name => "Westland Anniversary Day", :regions => [:nz_wl]},
31
+ {:mday => 25, :observed => lambda { |date| Holidays.to_monday_if_weekend(date) }, :observed_id => "to_monday_if_weekend", :name => "Christmas Day", :regions => [:nz]},
32
+ {:mday => 26, :observed => lambda { |date| Holidays.to_weekday_if_boxing_weekend(date) }, :observed_id => "to_weekday_if_boxing_weekend", :name => "Boxing Day", :regions => [:nz]}],
27
33
  2 => [{:mday => 1, :observed => lambda { |date| Holidays.closest_monday(date) }, :observed_id => "closest_monday", :name => "Nelson Anniversary Day", :regions => [:nz_ak]},
28
34
  {:mday => 6, :name => "Waitangi Day", :regions => [:nz]}],
29
35
  3 => [{:mday => 23, :observed => lambda { |date| Holidays.closest_monday(date) }, :observed_id => "closest_monday", :name => "Otago Anniversary Day", :regions => [:nz_ot]},
30
36
  {:wday => 1, :week => 2, :name => "Taranaki Anniversary Day", :regions => [:nz_ak]}],
31
- 4 => [{:mday => 25, :name => "ANZAC Day", :regions => [:nz]}],
32
- 6 => [{:wday => 1, :week => 1, :name => "Queen's Birthday", :regions => [:nz]}],
33
37
  9 => [{:wday => 1, :week => 4, :name => "Dominion Day", :regions => [:nz_sc]}],
38
+ 4 => [{:mday => 25, :name => "ANZAC Day", :regions => [:nz]}],
34
39
  10 => [{:wday => 1, :week => 1, :observed => lambda { |date| Holidays.previous_friday(date) }, :observed_id => "previous_friday", :name => "Hawke's bay Anniversary Day", :regions => [:nz_hb]},
35
40
  {:wday => 1, :week => 4, :name => "Labour Day", :regions => [:nz]},
36
- {:wday => 1, :week => 4, :observed => lambda { |date| Holidays.next_week(date) }, :observed_id => "next_week", :name => "Marlborough Anniversary Day", :regions => [:nz_mb]}],
37
- 11 => [{:wday => 5, :week => 2, :name => "Canterbury Anniversary Day", :regions => [:nz_ca]},
38
- {:mday => 30, :observed => lambda { |date| Holidays.closest_monday(date) }, :observed_id => "closest_monday", :name => "Chatham Island Anniversary Day", :regions => [:nz_ch]}],
39
- 12 => [{:mday => 1, :observed => lambda { |date| Holidays.closest_monday(date) }, :observed_id => "closest_monday", :name => "Westland Anniversary Day", :regions => [:nz_wl]},
40
- {:mday => 25, :observed => lambda { |date| Holidays.to_monday_if_weekend(date) }, :observed_id => "to_monday_if_weekend", :name => "Christmas Day", :regions => [:nz]},
41
- {:mday => 26, :observed => lambda { |date| Holidays.to_weekday_if_boxing_weekend(date) }, :observed_id => "to_weekday_if_boxing_weekend", :name => "Boxing Day", :regions => [:nz]}]
41
+ {:wday => 1, :week => 4, :observed => lambda { |date| Holidays.next_week(date) }, :observed_id => "next_week", :name => "Marlborough Anniversary Day", :regions => [:nz_mb]}]
42
42
  }
43
43
  end
44
44
 
@@ -54,15 +54,15 @@ def self.closest_monday(date)
54
54
  end
55
55
 
56
56
 
57
+ def self.next_week(date)
58
+ date + 7
59
+ end
60
+
57
61
  def self.previous_friday(date)
58
62
  date - 3
59
63
  end
60
64
 
61
65
 
62
- def self.next_week(date)
63
- date + 7
64
- end
65
-
66
66
 
67
67
  end
68
68
 
data/lib/holidays/pt.rb CHANGED
@@ -15,20 +15,20 @@ module Holidays
15
15
  DEFINED_REGIONS = [:pt]
16
16
 
17
17
  HOLIDAYS_BY_MONTH = {
18
+ 5 => [{:mday => 1, :name => "Dia do Trabalhador", :regions => [:pt]}],
18
19
  0 => [{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :type => :informal, :name => "Carnaval", :regions => [:pt]},
19
20
  {:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Sexta-feira Santa", :regions => [:pt]},
20
21
  {:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Páscoa", :regions => [:pt]},
21
22
  {:function => lambda { |year| Holidays.easter(year)+60 }, :function_id => "easter(year)+60", :name => "Corpo de Deus", :regions => [:pt]}],
22
- 1 => [{:mday => 1, :name => "Ano Novo", :regions => [:pt]}],
23
- 4 => [{:mday => 25, :name => "Dia da Liberdade", :regions => [:pt]}],
24
- 5 => [{:mday => 1, :name => "Dia do Trabalhador", :regions => [:pt]}],
25
- 6 => [{:mday => 10, :name => "Dia de Portugal", :regions => [:pt]}],
26
- 8 => [{:mday => 15, :name => "Assunção de Nossa Senhora", :regions => [:pt]}],
27
- 10 => [{:mday => 5, :name => "Implantação da República", :regions => [:pt]}],
28
23
  11 => [{:mday => 1, :name => "Todos os Santos", :regions => [:pt]}],
24
+ 6 => [{:mday => 10, :name => "Dia de Portugal", :regions => [:pt]}],
25
+ 1 => [{:mday => 1, :name => "Ano Novo", :regions => [:pt]}],
29
26
  12 => [{:mday => 1, :name => "Restauração da Independência", :regions => [:pt]},
30
27
  {:mday => 8, :name => "Imaculada Conceição", :regions => [:pt]},
31
- {:mday => 25, :name => "Natal", :regions => [:pt]}]
28
+ {:mday => 25, :name => "Natal", :regions => [:pt]}],
29
+ 8 => [{:mday => 15, :name => "Assunção de Nossa Senhora", :regions => [:pt]}],
30
+ 4 => [{:mday => 25, :name => "Dia da Liberdade", :regions => [:pt]}],
31
+ 10 => [{:mday => 5, :name => "Implantação da República", :regions => [:pt]}]
32
32
  }
33
33
  end
34
34
 
@@ -15,6 +15,14 @@ module Holidays
15
15
  DEFINED_REGIONS = [:dk, :no, :is, :se, :fi]
16
16
 
17
17
  HOLIDAYS_BY_MONTH = {
18
+ 5 => [{:mday => 1, :name => "Arbejdernes kampdag", :regions => [:dk]},
19
+ {:mday => 5, :type => :informal, :name => "Danmarks befrielse", :regions => [:dk]},
20
+ {:mday => 1, :name => "Verkalýðsdagurinn", :regions => [:is]},
21
+ {:mday => 13, :name => "Mæðradagurinn", :regions => [:is]},
22
+ {:mday => 1, :name => "1. mai", :regions => [:no]},
23
+ {:mday => 17, :name => "17. mai", :regions => [:no]},
24
+ {:mday => 1, :name => "Första maj", :regions => [:se]},
25
+ {:mday => 1, :name => "Vappu", :regions => [:fi]}],
18
26
  0 => [{:function => lambda { |year| Holidays.easter(year)-49 }, :function_id => "easter(year)-49", :type => :informal, :name => "Fastelavn", :regions => [:dk, :no]},
19
27
  {:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Palmesøndag", :regions => [:dk, :no]},
20
28
  {:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skærtorsdag", :regions => [:dk]},
@@ -52,6 +60,16 @@ module Holidays
52
60
  {:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Helatorstai", :regions => [:fi]},
53
61
  {:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Helluntaipäivä", :regions => [:fi]},
54
62
  {:function => lambda { |year| Holidays.fi_pyhainpaiva(year) }, :function_id => "fi_pyhainpaiva(year)", :name => "Pyhäinpäivä", :regions => [:fi]}],
63
+ 11 => [{:mday => 10, :type => :informal, :name => "Mortensaften", :regions => [:dk]},
64
+ {:mday => 16, :name => "Dagur íslenskrar tungu", :regions => [:is]}],
65
+ 6 => [{:mday => 5, :name => "Grundlovsdag", :regions => [:dk]},
66
+ {:mday => 15, :type => :informal, :name => "Valdemarsdag og Genforeningsdag", :regions => [:dk]},
67
+ {:mday => 23, :type => :informal, :name => "Sankt Hans aften", :regions => [:dk]},
68
+ {:mday => 3, :type => :informal, :name => "Sjómannadagurinn", :regions => [:is]},
69
+ {:mday => 17, :name => "Lýðveldisdagurinn", :regions => [:is]},
70
+ {:mday => 6, :name => "Nationaldagen", :regions => [:se]},
71
+ {:function => lambda { |year| Holidays.se_midsommardagen(year) }, :function_id => "se_midsommardagen(year)", :name => "Midsommardagen", :regions => [:se]},
72
+ {:function => lambda { |year| Holidays.fi_juhannuspaiva(year) }, :function_id => "fi_juhannuspaiva(year)", :name => "Juhannuspäivä", :regions => [:fi]}],
55
73
  1 => [{:mday => 1, :name => "Nytårsdag", :regions => [:dk]},
56
74
  {:mday => 1, :name => "Nýársdagur", :regions => [:is]},
57
75
  {:mday => 6, :name => "Þrettándinn", :regions => [:is]},
@@ -61,28 +79,6 @@ module Holidays
61
79
  {:mday => 6, :name => "Trettondedag jul", :regions => [:se]},
62
80
  {:mday => 1, :name => "Uudenvuodenpäivä", :regions => [:fi]},
63
81
  {:mday => 6, :name => "Loppiainen", :regions => [:fi]}],
64
- 4 => [{:mday => 1, :type => :informal, :name => "1. april", :regions => [:dk]},
65
- {:mday => 9, :type => :informal, :name => "Danmarks besættelse", :regions => [:dk]},
66
- {:mday => 16, :type => :informal, :name => "Dronningens fødselsdag", :regions => [:dk]},
67
- {:function => lambda { |year| Holidays.is_sumardagurinn_fyrsti(year) }, :function_id => "is_sumardagurinn_fyrsti(year)", :name => "Sumardagurinn fyrsti", :regions => [:is]}],
68
- 5 => [{:mday => 1, :name => "Arbejdernes kampdag", :regions => [:dk]},
69
- {:mday => 5, :type => :informal, :name => "Danmarks befrielse", :regions => [:dk]},
70
- {:mday => 1, :name => "Verkalýðsdagurinn", :regions => [:is]},
71
- {:mday => 13, :name => "Mæðradagurinn", :regions => [:is]},
72
- {:mday => 1, :name => "1. mai", :regions => [:no]},
73
- {:mday => 17, :name => "17. mai", :regions => [:no]},
74
- {:mday => 1, :name => "Första maj", :regions => [:se]},
75
- {:mday => 1, :name => "Vappu", :regions => [:fi]}],
76
- 6 => [{:mday => 5, :name => "Grundlovsdag", :regions => [:dk]},
77
- {:mday => 15, :type => :informal, :name => "Valdemarsdag og Genforeningsdag", :regions => [:dk]},
78
- {:mday => 23, :type => :informal, :name => "Sankt Hans aften", :regions => [:dk]},
79
- {:mday => 3, :type => :informal, :name => "Sjómannadagurinn", :regions => [:is]},
80
- {:mday => 17, :name => "Lýðveldisdagurinn", :regions => [:is]},
81
- {:mday => 6, :name => "Nationaldagen", :regions => [:se]},
82
- {:function => lambda { |year| Holidays.se_midsommardagen(year) }, :function_id => "se_midsommardagen(year)", :name => "Midsommardagen", :regions => [:se]},
83
- {:function => lambda { |year| Holidays.fi_juhannuspaiva(year) }, :function_id => "fi_juhannuspaiva(year)", :name => "Juhannuspäivä", :regions => [:fi]}],
84
- 11 => [{:mday => 10, :type => :informal, :name => "Mortensaften", :regions => [:dk]},
85
- {:mday => 16, :name => "Dagur íslenskrar tungu", :regions => [:is]}],
86
82
  12 => [{:mday => 13, :type => :informal, :name => "Sankt Lucia", :regions => [:dk]},
87
83
  {:mday => 24, :name => "Juleaftensdag", :regions => [:dk]},
88
84
  {:mday => 25, :name => "1. juledag", :regions => [:dk, :no]},
@@ -100,10 +96,30 @@ module Holidays
100
96
  {:mday => 25, :name => "Joulupäivä", :regions => [:fi]},
101
97
  {:mday => 26, :name => "Tapaninpäivä", :regions => [:fi]}],
102
98
  2 => [{:mday => 18, :type => :informal, :name => "Konudagur", :regions => [:is]}],
103
- 8 => [{:wday => 1, :week => 1, :name => "Frídagur verslunarmanna", :regions => [:is]}]
99
+ 8 => [{:wday => 1, :week => 1, :name => "Frídagur verslunarmanna", :regions => [:is]}],
100
+ 4 => [{:mday => 1, :type => :informal, :name => "1. april", :regions => [:dk]},
101
+ {:mday => 9, :type => :informal, :name => "Danmarks besættelse", :regions => [:dk]},
102
+ {:mday => 16, :type => :informal, :name => "Dronningens fødselsdag", :regions => [:dk]},
103
+ {:function => lambda { |year| Holidays.is_sumardagurinn_fyrsti(year) }, :function_id => "is_sumardagurinn_fyrsti(year)", :name => "Sumardagurinn fyrsti", :regions => [:is]}]
104
104
  }
105
105
  end
106
106
 
107
+ # Sweden: All Saint's Day (Saturday between Oct 31 and Nov 6)
108
+ def self.se_alla_helgons_dag(year)
109
+ date = Date.civil(year,10,31)
110
+ date += (6 - date.wday)
111
+ date
112
+ end
113
+
114
+
115
+ # Finland: All Saint's Day (Saturday between Oct 31 and Nov 6)
116
+ def self.fi_pyhainpaiva(year)
117
+ date = Date.civil(year,10,31)
118
+ date += (6 - date.wday)
119
+ date
120
+ end
121
+
122
+
107
123
  # Iceland: first day of summer (Thursday after 18 April)
108
124
  def self.is_sumardagurinn_fyrsti(year)
109
125
  date = Date.civil(year,4,18)
@@ -124,14 +140,6 @@ def self.se_midsommardagen(year)
124
140
  end
125
141
 
126
142
 
127
- # Sweden: All Saint's Day (Saturday between Oct 31 and Nov 6)
128
- def self.se_alla_helgons_dag(year)
129
- date = Date.civil(year,10,31)
130
- date += (6 - date.wday)
131
- date
132
- end
133
-
134
-
135
143
  # Finland: Mid-summer (Saturday between June 20–26)
136
144
  def self.fi_juhannuspaiva(year)
137
145
  date = Date.civil(year,6,20)
@@ -140,14 +148,6 @@ def self.fi_juhannuspaiva(year)
140
148
  end
141
149
 
142
150
 
143
- # Finland: All Saint's Day (Saturday between Oct 31 and Nov 6)
144
- def self.fi_pyhainpaiva(year)
145
- date = Date.civil(year,10,31)
146
- date += (6 - date.wday)
147
- date
148
- end
149
-
150
-
151
151
 
152
152
  end
153
153
 
data/lib/holidays/se.rb CHANGED
@@ -15,33 +15,33 @@ module Holidays
15
15
  DEFINED_REGIONS = [:se]
16
16
 
17
17
  HOLIDAYS_BY_MONTH = {
18
+ 5 => [{:mday => 1, :name => "Första maj", :regions => [:se]}],
18
19
  0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Långfredagen", :regions => [:se]},
19
20
  {:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Påskdagen", :regions => [:se]},
20
21
  {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Annandag påsk", :regions => [:se]},
21
22
  {:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi himmelsfärdsdag", :regions => [:se]},
22
23
  {:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pingstdagen", :regions => [:se]},
23
24
  {:function => lambda { |year| Holidays.se_alla_helgons_dag(year) }, :function_id => "se_alla_helgons_dag(year)", :name => "Alla helgons dag", :regions => [:se]}],
24
- 1 => [{:mday => 1, :name => "Nyårsdagen", :regions => [:se]},
25
- {:mday => 6, :name => "Trettondedag jul", :regions => [:se]}],
26
- 5 => [{:mday => 1, :name => "Första maj", :regions => [:se]}],
27
25
  6 => [{:mday => 6, :name => "Nationaldagen", :regions => [:se]},
28
26
  {:function => lambda { |year| Holidays.se_midsommardagen(year) }, :function_id => "se_midsommardagen(year)", :name => "Midsommardagen", :regions => [:se]}],
27
+ 1 => [{:mday => 1, :name => "Nyårsdagen", :regions => [:se]},
28
+ {:mday => 6, :name => "Trettondedag jul", :regions => [:se]}],
29
29
  12 => [{:mday => 25, :name => "Juldagen", :regions => [:se]},
30
30
  {:mday => 26, :name => "Annandag jul", :regions => [:se]}]
31
31
  }
32
32
  end
33
33
 
34
- # Sweden: Mid-summer (Saturday between June 20–26)
35
- def self.se_midsommardagen(year)
36
- date = Date.civil(year,6,20)
34
+ # Sweden: All Saint's Day (Saturday between Oct 31 and Nov 6)
35
+ def self.se_alla_helgons_dag(year)
36
+ date = Date.civil(year,10,31)
37
37
  date += (6 - date.wday)
38
38
  date
39
39
  end
40
40
 
41
41
 
42
- # Sweden: All Saint's Day (Saturday between Oct 31 and Nov 6)
43
- def self.se_alla_helgons_dag(year)
44
- date = Date.civil(year,10,31)
42
+ # Sweden: Mid-summer (Saturday between June 20–26)
43
+ def self.se_midsommardagen(year)
44
+ date = Date.civil(year,6,20)
45
45
  date += (6 - date.wday)
46
46
  date
47
47
  end
data/lib/holidays/ups.rb CHANGED
@@ -15,14 +15,14 @@ module Holidays
15
15
  DEFINED_REGIONS = [:ups]
16
16
 
17
17
  HOLIDAYS_BY_MONTH = {
18
- 1 => [{:mday => 1, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "New Year's Day", :regions => [:ups]}],
19
18
  5 => [{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:ups]}],
20
- 7 => [{:mday => 4, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Independence Day", :regions => [:ups]}],
21
- 9 => [{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:ups]}],
22
19
  11 => [{:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:ups]},
23
20
  {:wday => 5, :week => 4, :name => "Day After Thanksgiving", :regions => [:ups]}],
21
+ 1 => [{:mday => 1, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "New Year's Day", :regions => [:ups]}],
24
22
  12 => [{:mday => 25, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Christmas Day", :regions => [:ups]},
25
- {:mday => 31, :name => "New Year's Eve", :regions => [:ups]}]
23
+ {:mday => 31, :name => "New Year's Eve", :regions => [:ups]}],
24
+ 7 => [{:mday => 4, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Independence Day", :regions => [:ups]}],
25
+ 9 => [{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:ups]}]
26
26
  }
27
27
  end
28
28
 
data/lib/holidays/us.rb CHANGED
@@ -15,25 +15,25 @@ module Holidays
15
15
  DEFINED_REGIONS = [:us, :us_dc, :ca]
16
16
 
17
17
  HOLIDAYS_BY_MONTH = {
18
+ 5 => [{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:us]},
19
+ {:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
18
20
  0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :type => :informal, :name => "Good Friday", :regions => [:us]}],
21
+ 11 => [{:mday => 11, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Veterans Day", :regions => [:us]},
22
+ {:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:us]}],
19
23
  1 => [{:mday => 1, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "New Year's Day", :regions => [:us]},
20
24
  {:wday => 1, :week => 3, :name => "Martin Luther King, Jr. Day", :regions => [:us]},
21
25
  {:function => lambda { |year| Holidays.us_inauguration_day(year) }, :function_id => "us_inauguration_day(year)", :name => "Inauguration Day", :regions => [:us_dc]}],
26
+ 12 => [{:mday => 25, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Christmas Day", :regions => [:us]}],
27
+ 7 => [{:mday => 4, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Independence Day", :regions => [:us]}],
22
28
  2 => [{:wday => 1, :week => 3, :name => "Presidents' Day", :regions => [:us]},
23
29
  {:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
24
30
  {:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
25
- 5 => [{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:us]},
26
- {:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
27
- 7 => [{:mday => 4, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Independence Day", :regions => [:us]}],
28
- 9 => [{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:us]}],
29
- 10 => [{:wday => 1, :week => 2, :name => "Columbus Day", :regions => [:us]},
30
- {:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}],
31
- 11 => [{:mday => 11, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Veterans Day", :regions => [:us]},
32
- {:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:us]}],
33
- 12 => [{:mday => 25, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Christmas Day", :regions => [:us]}],
34
31
  3 => [{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
32
+ 9 => [{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:us]}],
35
33
  4 => [{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
36
- {:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}]
34
+ {:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}],
35
+ 10 => [{:wday => 1, :week => 2, :name => "Columbus Day", :regions => [:us]},
36
+ {:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}]
37
37
  }
38
38
  end
39
39
 
data/lib/holidays/za.rb CHANGED
@@ -15,18 +15,18 @@ module Holidays
15
15
  DEFINED_REGIONS = [:za]
16
16
 
17
17
  HOLIDAYS_BY_MONTH = {
18
+ 5 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Workers Day", :regions => [:za]}],
18
19
  0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:za]},
19
20
  {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Family Day", :regions => [:za]}],
20
- 1 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "New Year's Day", :regions => [:za]}],
21
- 3 => [{:mday => 21, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Human Rights Day", :regions => [:za]}],
22
- 4 => [{:mday => 27, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Freedom Day", :regions => [:za]}],
23
- 5 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Workers Day", :regions => [:za]}],
24
21
  6 => [{:mday => 16, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Youth Day", :regions => [:za]}],
25
- 8 => [{:mday => 9, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "National Women's Day", :regions => [:za]}],
26
- 9 => [{:mday => 24, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Heritage Day", :regions => [:za]}],
22
+ 1 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "New Year's Day", :regions => [:za]}],
27
23
  12 => [{:mday => 16, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Day of Reconciliation", :regions => [:za]},
28
24
  {:mday => 25, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Christmas Day", :regions => [:za]},
29
- {:mday => 26, :observed => lambda { |date| Holidays.to_weekday_if_boxing_weekend(date) }, :observed_id => "to_weekday_if_boxing_weekend", :name => "Day of Goodwill", :regions => [:za]}]
25
+ {:mday => 26, :observed => lambda { |date| Holidays.to_weekday_if_boxing_weekend(date) }, :observed_id => "to_weekday_if_boxing_weekend", :name => "Day of Goodwill", :regions => [:za]}],
26
+ 8 => [{:mday => 9, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "National Women's Day", :regions => [:za]}],
27
+ 3 => [{:mday => 21, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Human Rights Day", :regions => [:za]}],
28
+ 9 => [{:mday => 24, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Heritage Day", :regions => [:za]}],
29
+ 4 => [{:mday => 27, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Freedom Day", :regions => [:za]}]
30
30
  }
31
31
  end
32
32
 
@@ -0,0 +1,28 @@
1
+ # encoding: utf-8
2
+ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
3
+
4
+ # This file is generated by the Ruby Holiday gem.
5
+ #
6
+ # Definitions loaded: data/el.yaml
7
+ class ElDefinitionTests < Test::Unit::TestCase # :nodoc:
8
+
9
+ def test_el
10
+ {Date.civil(2011,1,1) => 'Πρωτοχρονιά',
11
+ Date.civil(2011,1,6) => 'Θεοφάνεια',
12
+ Date.civil(2011,4,22) => 'Μεγάλη Παρασκευή',
13
+ Date.civil(1970,4,25) => 'Μεγάλο Σάββατο',
14
+ Date.civil(1985,4,14) => 'Κυριακή του Πάσχα',
15
+ Date.civil(2011,4,24) => 'Κυριακή του Πάσχα',
16
+ Date.civil(2027,5,2) => 'Κυριακή του Πάσχα',
17
+ Date.civil(2046,4,30) => 'Δευτέρα του Πάσχα',
18
+ Date.civil(2011,5,1) => 'Πρωτομαγιά',
19
+ Date.civil(2011,6,13) => 'Αγίου Πνεύματος',
20
+ Date.civil(2012,6,4) => 'Αγίου Πνεύματος',
21
+ Date.civil(2011,3,7) => 'Καθαρά Δευτέρα',
22
+ Date.civil(2012,2,27) => 'Καθαρά Δευτέρα',
23
+ Date.civil(2011,12,25) => 'Χριστούγεννα',
24
+ Date.civil(2011,12,26) => 'Δεύτερη ημέρα των Χριστουγέννων'}.each do |date, name|
25
+ assert_equal name, (Holidays.on(date, :el, :informal)[0] || {})[:name]
26
+ end
27
+ end
28
+ end
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
3
3
 
4
4
  # This file is generated by the Ruby Holiday gem.
5
5
  #
6
- # Definitions loaded: data/cz.yaml, data/dk.yaml, data/de.yaml, data/es.yaml, data/fr.yaml, data/gb.yaml, data/ie.yaml, data/is.yaml, data/it.yaml, data/nl.yaml, data/no.yaml, data/pt.yaml
6
+ # Definitions loaded: data/cz.yaml, data/dk.yaml, data/de.yaml, data/el.yaml, data/es.yaml, data/fr.yaml, data/gb.yaml, data/ie.yaml, data/is.yaml, data/it.yaml, data/nl.yaml, data/no.yaml, data/pt.yaml
7
7
  class EuropeDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_europe
@@ -84,6 +84,24 @@ assert_equal 'Buß- und Bettag', Date.civil(2006,11,22).holidays(:de_sn)[0][:nam
84
84
  assert_equal 'Buß- und Bettag', Date.civil(2009,11,18).holidays(:de_sn)[0][:name]
85
85
 
86
86
 
87
+ {Date.civil(2011,1,1) => 'Πρωτοχρονιά',
88
+ Date.civil(2011,1,6) => 'Θεοφάνεια',
89
+ Date.civil(2011,4,22) => 'Μεγάλη Παρασκευή',
90
+ Date.civil(1970,4,25) => 'Μεγάλο Σάββατο',
91
+ Date.civil(1985,4,14) => 'Κυριακή του Πάσχα',
92
+ Date.civil(2011,4,24) => 'Κυριακή του Πάσχα',
93
+ Date.civil(2027,5,2) => 'Κυριακή του Πάσχα',
94
+ Date.civil(2046,4,30) => 'Δευτέρα του Πάσχα',
95
+ Date.civil(2011,5,1) => 'Πρωτομαγιά',
96
+ Date.civil(2011,6,13) => 'Αγίου Πνεύματος',
97
+ Date.civil(2012,6,4) => 'Αγίου Πνεύματος',
98
+ Date.civil(2011,3,7) => 'Καθαρά Δευτέρα',
99
+ Date.civil(2012,2,27) => 'Καθαρά Δευτέρα',
100
+ Date.civil(2011,12,25) => 'Χριστούγεννα',
101
+ Date.civil(2011,12,26) => 'Δεύτερη ημέρα των Χριστουγέννων'}.each do |date, name|
102
+ assert_equal name, (Holidays.on(date, :el, :informal)[0] || {})[:name]
103
+ end
104
+
87
105
  {Date.civil(2009,1,1) => 'Año Nuevo',
88
106
  Date.civil(2009,1,6) => 'Día de Reyes',
89
107
  Date.civil(2009,4,10) => 'Viernes Santo',
@@ -102,6 +102,14 @@ class HolidaysTests < Test::Unit::TestCase
102
102
  assert_equal '2067-04-03', Holidays.easter(2067).to_s
103
103
  assert_equal '2099-04-12', Holidays.easter(2099).to_s
104
104
  end
105
+
106
+ def test_orthodox_easter
107
+ assert_equal '2000-04-30', Holidays.orthodox_easter(2000).to_s
108
+ assert_equal '2008-04-27', Holidays.orthodox_easter(2008).to_s
109
+ assert_equal '2009-04-19', Holidays.orthodox_easter(2009).to_s
110
+ assert_equal '2011-04-24', Holidays.orthodox_easter(2011).to_s
111
+ assert_equal '2020-04-19', Holidays.orthodox_easter(2020).to_s
112
+ end
105
113
 
106
114
  def test_easter_lambda
107
115
  [Date.civil(1800,4,11), Date.civil(1899,3,31), Date.civil(1900,4,13),
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 1
9
- version: 1.0.1
8
+ - 2
9
+ version: 1.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Alex Dunae
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-29 00:00:00 -07:00
18
+ date: 2011-05-13 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -29,6 +29,7 @@ extra_rdoc_files:
29
29
  - LICENSE
30
30
  - README.rdoc
31
31
  files:
32
+ - .gitignore
32
33
  - CHANGELOG
33
34
  - LICENSE
34
35
  - README.rdoc
@@ -41,6 +42,7 @@ files:
41
42
  - data/cz.yaml
42
43
  - data/de.yaml
43
44
  - data/dk.yaml
45
+ - data/el.yaml
44
46
  - data/es.yaml
45
47
  - data/fi.yaml
46
48
  - data/fr.yaml
@@ -71,6 +73,7 @@ files:
71
73
  - lib/holidays/cz.rb
72
74
  - lib/holidays/de.rb
73
75
  - lib/holidays/dk.rb
76
+ - lib/holidays/el.rb
74
77
  - lib/holidays/es.rb
75
78
  - lib/holidays/europe.rb
76
79
  - lib/holidays/fi.rb
@@ -100,6 +103,7 @@ files:
100
103
  - test/defs/test_defs_cz.rb
101
104
  - test/defs/test_defs_de.rb
102
105
  - test/defs/test_defs_dk.rb
106
+ - test/defs/test_defs_el.rb
103
107
  - test/defs/test_defs_es.rb
104
108
  - test/defs/test_defs_europe.rb
105
109
  - test/defs/test_defs_fi.rb
@@ -130,8 +134,8 @@ homepage: https://github.com/alexdunae/holidays
130
134
  licenses: []
131
135
 
132
136
  post_install_message:
133
- rdoc_options: []
134
-
137
+ rdoc_options:
138
+ - --charset=UTF-8
135
139
  require_paths:
136
140
  - lib
137
141
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -164,6 +168,7 @@ test_files:
164
168
  - test/defs/test_defs_cz.rb
165
169
  - test/defs/test_defs_de.rb
166
170
  - test/defs/test_defs_dk.rb
171
+ - test/defs/test_defs_el.rb
167
172
  - test/defs/test_defs_es.rb
168
173
  - test/defs/test_defs_europe.rb
169
174
  - test/defs/test_defs_fi.rb