holidays 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. data/LICENSE +21 -0
  2. data/README +76 -0
  3. data/REFERENCES +16 -0
  4. data/data/SYNTAX +111 -0
  5. data/data/au.yaml +106 -0
  6. data/data/build_defs.rb +152 -0
  7. data/data/ca.yaml +141 -0
  8. data/data/de.yaml +115 -0
  9. data/data/dk.yaml +117 -0
  10. data/data/es.yaml +161 -0
  11. data/data/fr.yaml +70 -0
  12. data/data/gb.yaml +106 -0
  13. data/data/ie.yaml +58 -0
  14. data/data/index.yaml +21 -0
  15. data/data/is.yaml +136 -0
  16. data/data/it.yaml +66 -0
  17. data/data/mx.yaml +106 -0
  18. data/data/nl.yaml +67 -0
  19. data/data/north_america_informal.yaml +49 -0
  20. data/data/pt.yaml +85 -0
  21. data/data/se.yaml +91 -0
  22. data/data/united_nations.yaml +188 -0
  23. data/data/us.yaml +81 -0
  24. data/data/za.yaml +78 -0
  25. data/lib/holidays.rb +404 -0
  26. data/lib/holidays/MANIFEST +23 -0
  27. data/lib/holidays/au.rb +41 -0
  28. data/lib/holidays/ca.rb +68 -0
  29. data/lib/holidays/de.rb +52 -0
  30. data/lib/holidays/dk.rb +47 -0
  31. data/lib/holidays/es.rb +52 -0
  32. data/lib/holidays/europe.rb +215 -0
  33. data/lib/holidays/fr.rb +36 -0
  34. data/lib/holidays/gb.rb +40 -0
  35. data/lib/holidays/ie.rb +32 -0
  36. data/lib/holidays/is.rb +61 -0
  37. data/lib/holidays/it.rb +35 -0
  38. data/lib/holidays/mx.rb +51 -0
  39. data/lib/holidays/nl.rb +36 -0
  40. data/lib/holidays/north_america.rb +107 -0
  41. data/lib/holidays/pt.rb +52 -0
  42. data/lib/holidays/scandinavia.rb +114 -0
  43. data/lib/holidays/se.rb +52 -0
  44. data/lib/holidays/united_nations.rb +24 -0
  45. data/lib/holidays/us.rb +48 -0
  46. data/lib/holidays/za.rb +35 -0
  47. data/test/defs/test_defs_au.rb +36 -0
  48. data/test/defs/test_defs_ca.rb +29 -0
  49. data/test/defs/test_defs_de.rb +46 -0
  50. data/test/defs/test_defs_dk.rb +30 -0
  51. data/test/defs/test_defs_es.rb +57 -0
  52. data/test/defs/test_defs_europe.rb +240 -0
  53. data/test/defs/test_defs_fr.rb +26 -0
  54. data/test/defs/test_defs_gb.rb +36 -0
  55. data/test/defs/test_defs_ie.rb +21 -0
  56. data/test/defs/test_defs_is.rb +33 -0
  57. data/test/defs/test_defs_it.rb +25 -0
  58. data/test/defs/test_defs_mx.rb +22 -0
  59. data/test/defs/test_defs_nl.rb +24 -0
  60. data/test/defs/test_defs_north_america.rb +54 -0
  61. data/test/defs/test_defs_pt.rb +32 -0
  62. data/test/defs/test_defs_scandinavia.rb +75 -0
  63. data/test/defs/test_defs_se.rb +32 -0
  64. data/test/defs/test_defs_us.rb +36 -0
  65. data/test/defs/test_defs_za.rb +25 -0
  66. metadata +118 -0
@@ -0,0 +1,23 @@
1
+ ==== Regional definitions
2
+ The following definition files are included in this installation:
3
+
4
+ * holidays/au
5
+ * holidays/ca
6
+ * holidays/de
7
+ * holidays/dk
8
+ * holidays/es
9
+ * holidays/europe
10
+ * holidays/fr
11
+ * holidays/gb
12
+ * holidays/ie
13
+ * holidays/is
14
+ * holidays/it
15
+ * holidays/mx
16
+ * holidays/nl
17
+ * holidays/north_america
18
+ * holidays/pt
19
+ * holidays/scandinavia
20
+ * holidays/se
21
+ * holidays/united_nations
22
+ * holidays/us
23
+ * holidays/za
@@ -0,0 +1,41 @@
1
+ module Holidays
2
+ # This file is generated by the Ruby Holiday gem.
3
+ #
4
+ # Definitions loaded: data/au.yaml
5
+ #
6
+ # To use the definitions in this file, load them right after you load the
7
+ # Holiday gem:
8
+ #
9
+ # require 'holidays'
10
+ # require 'holidays/au'
11
+ #
12
+ # More definitions are available at http://code.dunae.ca/holidays.
13
+ module AU # :nodoc:
14
+ DEFINED_REGIONS = [:au_qld, :au_nt, :au, :au_tas, :au_wa, :au_act, :au_nsw, :au_sa, :au_vic]
15
+
16
+ HOLIDAYS_BY_MONTH = {
17
+ 5 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_qld]},
18
+ {:wday => 1, :week => 1, :name => "May Day", :regions => [:au_nt]}],
19
+ 0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:au]},
20
+ {:function => lambda { |year| Holidays.easter(year)-1 }, :function_id => "easter(year)-1", :name => "Easter Saturday", :regions => [:au]},
21
+ {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Easter Monday", :regions => [:au]},
22
+ {:function => lambda { |year| Holidays.easter(year)+2 }, :function_id => "easter(year)+2", :name => "Easter Monday", :regions => [:au_tas]}],
23
+ 6 => [{:wday => 1, :week => 1, :name => "Foundation Day", :regions => [:au_wa]},
24
+ {:wday => 1, :week => 2, :name => "Queen's Birthday", :regions => [:au_act, :au_nsw, :au_sa, :au_tas, :au_nt, :au_qld, :au_vic]},
25
+ {:mday => 6, :type => :informal, :name => "Queensland Day", :regions => [:au_qld]}],
26
+ 1 => [{:mday => 1, :name => "New Year's Day", :regions => [:au]},
27
+ {:mday => 26, :name => "Australia Day", :regions => [:au]}],
28
+ 12 => [{:mday => 25, :name => "Christmas Day", :regions => [:au]},
29
+ {:mday => 26, :name => "Boxing Day", :regions => [:au]}],
30
+ 3 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_wa]},
31
+ {:wday => 1, :week => 2, :name => "Eight Hours Day", :regions => [:au_tas]},
32
+ {:wday => 1, :week => 2, :name => "Labour Day", :regions => [:au_vic]}],
33
+ 4 => [{:mday => 25, :name => "ANZAC Day", :regions => [:au]}],
34
+ 10 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_act, :au_nsw, :au_sa]}]
35
+ }
36
+ end
37
+
38
+
39
+ end
40
+
41
+ Holidays.merge_defs(Holidays::AU::DEFINED_REGIONS, Holidays::AU::HOLIDAYS_BY_MONTH)
@@ -0,0 +1,68 @@
1
+ module Holidays
2
+ # This file is generated by the Ruby Holiday gem.
3
+ #
4
+ # Definitions loaded: data/ca.yaml, data/north_america_informal.yaml
5
+ #
6
+ # To use the definitions in this file, load them right after you load the
7
+ # Holiday gem:
8
+ #
9
+ # require 'holidays'
10
+ # require 'holidays/ca'
11
+ #
12
+ # More definitions are available at http://code.dunae.ca/holidays.
13
+ module CA # :nodoc:
14
+ DEFINED_REGIONS = [:ca, :ca_qc, :ca_nf, :ca_nt, :ca_nu, :ca_ab, :ca_on, :ca_sk, :ca_mb, :ca_bc, :ca_ns, :ca_yk, :us]
15
+
16
+ HOLIDAYS_BY_MONTH = {
17
+ 5 => [{:function => lambda { |year| Holidays.ca_victoria_day(year) }, :function_id => "ca_victoria_day(year)", :name => "Victoria Day", :regions => [:ca]},
18
+ {:function => lambda { |year| Holidays.ca_victoria_day(year) }, :function_id => "ca_victoria_day(year)", :name => "National Patriotes Day", :regions => [:ca_qc]},
19
+ {:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
20
+ 0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:ca]},
21
+ {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :type => :informal, :name => "Easter Monday", :regions => [:ca]}],
22
+ 11 => [{:mday => 11, :name => "Rememberance Day", :regions => [:ca]}],
23
+ 6 => [{:mday => 24, :name => "Discovery Day", :regions => [:ca_nf]},
24
+ {:mday => 24, :name => "Fête Nationale", :regions => [:ca_qc]},
25
+ {:mday => 21, :name => "National Aboriginal Day", :regions => [:ca_nt]}],
26
+ 1 => [{:mday => 1, :name => "New Year's Day", :regions => [:ca]},
27
+ {:mday => 2, :name => "New Year's", :regions => [:ca_qc]}],
28
+ 12 => [{:mday => 25, :name => "Christmas Day", :regions => [:ca]},
29
+ {:mday => 26, :name => "Boxing Day", :regions => [:ca]}],
30
+ 7 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Canada Day", :regions => [:ca]},
31
+ {:mday => 12, :name => "Orangemen's Day", :regions => [:ca_nf]},
32
+ {:mday => 9, :name => "Nunavut Day", :regions => [:ca_nu]}],
33
+ 2 => [{:wday => 1, :week => 3, :name => "Family Day", :regions => [:ca_ab, :ca_on, :ca_sk]},
34
+ {:wday => 1, :week => 3, :name => "Louis Riel Day", :regions => [:ca_mb]},
35
+ {:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
36
+ {:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
37
+ 8 => [{:wday => 1, :week => 1, :name => "BC Day", :regions => [:ca_bc]},
38
+ {:wday => 1, :week => 1, :name => "Saskatchewan Day", :regions => [:ca_sk]},
39
+ {:wday => 1, :week => 1, :name => "Heritage Day", :regions => [:ca_ab]},
40
+ {:wday => 1, :week => 1, :name => "Natal Day", :regions => [:ca_ns]},
41
+ {:wday => 1, :week => 1, :name => "Civic Holiday", :regions => [:ca_on]},
42
+ {:wday => 1, :week => 3, :name => "Discovery Day", :regions => [:ca_yk]}],
43
+ 3 => [{:mday => 23, :name => "St. George's Day", :regions => [:ca_nf]},
44
+ {:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
45
+ 9 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:ca]}],
46
+ 4 => [{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
47
+ {:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}],
48
+ 10 => [{:wday => 1, :week => 2, :name => "Thanksgiving", :regions => [:ca]},
49
+ {:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}]
50
+ }
51
+ end
52
+
53
+ # Monday on or before May 24
54
+ def self.ca_victoria_day(year)
55
+ date = Date.civil(year,5,24)
56
+ if date.wday > 1
57
+ date -= (date.wday - 1)
58
+ elsif date.wday == 0
59
+ date -= 6
60
+ end
61
+ date
62
+ end
63
+
64
+
65
+
66
+ end
67
+
68
+ Holidays.merge_defs(Holidays::CA::DEFINED_REGIONS, Holidays::CA::HOLIDAYS_BY_MONTH)
@@ -0,0 +1,52 @@
1
+ module Holidays
2
+ # This file is generated by the Ruby Holiday gem.
3
+ #
4
+ # Definitions loaded: data/de.yaml
5
+ #
6
+ # To use the definitions in this file, load them right after you load the
7
+ # Holiday gem:
8
+ #
9
+ # require 'holidays'
10
+ # require 'holidays/de'
11
+ #
12
+ # More definitions are available at http://code.dunae.ca/holidays.
13
+ module DE # :nodoc:
14
+ DEFINED_REGIONS = [:de, :de_bw, :de_by, :de_nw, :de_rp, :de_sl, :de_sn, :de_he, :de_th, :de_bb, :de_mv, :de_st]
15
+
16
+ HOLIDAYS_BY_MONTH = {
17
+ 5 => [{:mday => 1, :name => "Tag der Arbeit", :regions => [:de]},
18
+ {:mday => 8, :name => "Victoire 1945", :regions => [:de]}],
19
+ 0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Karfreitag", :regions => [:de]},
20
+ {:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :type => :informal, :name => "Ostern", :regions => [:de]},
21
+ {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Ostermontag", :regions => [:de]},
22
+ {:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Christi Himmelfahrt", :regions => [:de]},
23
+ {:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pfingstmontag", :regions => [:de]},
24
+ {:function => lambda { |year| Holidays.easter(year)+60 }, :function_id => "easter(year)+60", :name => "Fronleichnam", :regions => [:de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_sn, :de_th]}],
25
+ 11 => [{:mday => 1, :name => "Allerheiligen", :regions => [:de_bw, :de_by, :de_nw, :de_rp, :de_sl]},
26
+ {:function => lambda { |year| Holidays.de_buss_und_bettag(year) }, :function_id => "de_buss_und_bettag(year)", :name => "Buß- und Bettag", :regions => [:de_by, :de_sn]}],
27
+ 1 => [{:mday => 1, :name => "Neujahrstag", :regions => [:de]},
28
+ {:mday => 6, :name => "Heilige Drei Könige", :regions => [:de_bw, :de_by]}],
29
+ 12 => [{:mday => 25, :name => "1. Weihnachtstag", :regions => [:de]},
30
+ {:mday => 26, :name => "2. Weihnachtstag", :regions => [:de]}],
31
+ 8 => [{:mday => 15, :name => "Mariä Himmelfahrt", :regions => [:de_by, :de_sl]}],
32
+ 10 => [{:mday => 3, :name => "Tag der Deutschen Einheit", :regions => [:de]},
33
+ {:mday => 31, :name => "Reformationstag", :regions => [:de_bb, :de_mv, :de_sn, :de_st, :de_th]}]
34
+ }
35
+ end
36
+
37
+ # Germany: Wednesday before November 23
38
+ def self.de_buss_und_bettag(year)
39
+ date = Date.civil(year,11,23)
40
+ if date.wday > 3
41
+ date -= (date.wday - 3)
42
+ else
43
+ date -= (date.wday + 4)
44
+ end
45
+ date
46
+ end
47
+
48
+
49
+
50
+ end
51
+
52
+ Holidays.merge_defs(Holidays::DE::DEFINED_REGIONS, Holidays::DE::HOLIDAYS_BY_MONTH)
@@ -0,0 +1,47 @@
1
+ module Holidays
2
+ # This file is generated by the Ruby Holiday gem.
3
+ #
4
+ # Definitions loaded: data/dk.yaml
5
+ #
6
+ # To use the definitions in this file, load them right after you load the
7
+ # Holiday gem:
8
+ #
9
+ # require 'holidays'
10
+ # require 'holidays/dk'
11
+ #
12
+ # More definitions are available at http://code.dunae.ca/holidays.
13
+ module DK # :nodoc:
14
+ DEFINED_REGIONS = [:dk]
15
+
16
+ HOLIDAYS_BY_MONTH = {
17
+ 5 => [{:mday => 1, :name => "Arbejdernes kampdag", :regions => [:dk]},
18
+ {:mday => 5, :type => :informal, :name => "Danmarks befrielse", :regions => [:dk]}],
19
+ 0 => [{:function => lambda { |year| Holidays.easter(year)-49 }, :function_id => "easter(year)-49", :type => :informal, :name => "Fastelavn", :regions => [:dk]},
20
+ {:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Palmesøndag", :regions => [:dk]},
21
+ {:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skærtorsdag", :regions => [:dk]},
22
+ {:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Langfredag", :regions => [:dk]},
23
+ {:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Påskedag", :regions => [:dk]},
24
+ {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "2. påskedag", :regions => [:dk]},
25
+ {:function => lambda { |year| Holidays.easter(year)+26 }, :function_id => "easter(year)+26", :name => "Store Bededag", :regions => [:dk]},
26
+ {:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi Himmelfartsdag", :regions => [:dk]},
27
+ {:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pinsedag", :regions => [:dk]},
28
+ {:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "2. Pinsedag", :regions => [:dk]}],
29
+ 11 => [{:mday => 10, :type => :informal, :name => "Mortensaften", :regions => [:dk]}],
30
+ 6 => [{:mday => 5, :name => "Grundlovsdag", :regions => [:dk]},
31
+ {:mday => 15, :type => :informal, :name => "Valdemarsdag og Genforeningsdag", :regions => [:dk]},
32
+ {:mday => 23, :type => :informal, :name => "Sankt Hans aften", :regions => [:dk]}],
33
+ 1 => [{:mday => 1, :name => "Nytårsdag", :regions => [:dk]}],
34
+ 12 => [{:mday => 13, :type => :informal, :name => "Sankt Lucia", :regions => [:dk]},
35
+ {:mday => 24, :name => "Juleaftensdag", :regions => [:dk]},
36
+ {:mday => 25, :name => "1. juledag", :regions => [:dk]},
37
+ {:mday => 26, :name => "2. juledag", :regions => [:dk]}],
38
+ 4 => [{:mday => 1, :type => :informal, :name => "1. april", :regions => [:dk]},
39
+ {:mday => 9, :type => :informal, :name => "Danmarks besættelse", :regions => [:dk]},
40
+ {:mday => 16, :type => :informal, :name => "Dronningens fødselsdag", :regions => [:dk]}]
41
+ }
42
+ end
43
+
44
+
45
+ end
46
+
47
+ Holidays.merge_defs(Holidays::DK::DEFINED_REGIONS, Holidays::DK::HOLIDAYS_BY_MONTH)
@@ -0,0 +1,52 @@
1
+ module Holidays
2
+ # This file is generated by the Ruby Holiday gem.
3
+ #
4
+ # Definitions loaded: data/es.yaml
5
+ #
6
+ # To use the definitions in this file, load them right after you load the
7
+ # Holiday gem:
8
+ #
9
+ # require 'holidays'
10
+ # require 'holidays/es'
11
+ #
12
+ # More definitions are available at http://code.dunae.ca/holidays.
13
+ module ES # :nodoc:
14
+ DEFINED_REGIONS = [:es, :es_m, :es_cn, :es_cm, :es_pv, :es_ct, :es_na, :es_v, :es_vc, :es_mu, :es_lo, :es_ib, :es_ga, :es_an, :es_ce, :es_o, :es_ex, :es_ar, :es_cl]
15
+
16
+ HOLIDAYS_BY_MONTH = {
17
+ 5 => [{:mday => 1, :name => "Día del Trabajador", :regions => [:es]},
18
+ {:mday => 2, :name => "Fiesta de la Comunidad", :regions => [:es_m]},
19
+ {:mday => 30, :name => "Día de las Canarias", :regions => [:es_cn]},
20
+ {:mday => 31, :name => "Día de la Región Castilla-La Mancha", :regions => [:es_cm]}],
21
+ 0 => [{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Jueves Santo", :regions => [:es_pv, :es_ct, :es_na, :es_v, :es_vc]},
22
+ {:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Viernes Santo", :regions => [:es]},
23
+ {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Lunes de Pascua", :regions => [:es_pv, :es_ct, :es_na, :es_v, :es_vc]}],
24
+ 11 => [{:mday => 1, :name => "Todos los Santos", :regions => [:es]}],
25
+ 6 => [{:mday => 9, :name => "Día de la Región de Murcia", :regions => [:es_mu]},
26
+ {:mday => 9, :name => "Día de La Rioja", :regions => [:es_lo]}],
27
+ 1 => [{:mday => 1, :name => "Año Nuevo", :regions => [:es]},
28
+ {:mday => 6, :name => "Día de Reyes", :regions => [:es]}],
29
+ 12 => [{:mday => 6, :name => "Día de la Constitución", :regions => [:es]},
30
+ {:mday => 8, :name => "Inmaculada Concepción", :regions => [:es]},
31
+ {:mday => 25, :name => "Navidad del Señor", :regions => [:es]},
32
+ {:mday => 26, :name => "San Esteban", :regions => [:es_ib, :es_ct]}],
33
+ 7 => [{:mday => 23, :name => "Santiago Apostol", :regions => [:es_ga]}],
34
+ 2 => [{:mday => 28, :name => "Día de Andalucía", :regions => [:es_an]}],
35
+ 8 => [{:mday => 15, :name => "Asunción", :regions => [:es]}],
36
+ 3 => [{:mday => 1, :name => "Día de las Islas Baleares", :regions => [:es_ib]},
37
+ {:mday => 19, :name => "San José", :regions => [:es_v, :es_vc, :es_cm, :es_mu, :es_m]}],
38
+ 9 => [{:mday => 2, :name => "Día de Ceuta", :regions => [:es_ce]},
39
+ {:mday => 8, :name => "Día de Asturias", :regions => [:es_o]},
40
+ {:mday => 8, :name => "Día de Extremadura", :regions => [:es_ex]},
41
+ {:mday => 11, :name => "Fiesta Nacional de Cataluña", :regions => [:es_ct]}],
42
+ 4 => [{:mday => 23, :name => "San Jorge", :regions => [:es_ar, :es_cl]},
43
+ {:mday => 23, :name => "Día de Aragón", :regions => [:es_ar]}],
44
+ 10 => [{:mday => 9, :name => "Día de Valencia", :regions => [:es_vc, :es_v]},
45
+ {:mday => 12, :name => "Día de la Hispanidad", :regions => [:es]}]
46
+ }
47
+ end
48
+
49
+
50
+ end
51
+
52
+ Holidays.merge_defs(Holidays::ES::DEFINED_REGIONS, Holidays::ES::HOLIDAYS_BY_MONTH)
@@ -0,0 +1,215 @@
1
+ module Holidays
2
+ # This file is generated by the Ruby Holiday gem.
3
+ #
4
+ # Definitions loaded: 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/pt.yaml
5
+ #
6
+ # To use the definitions in this file, load them right after you load the
7
+ # Holiday gem:
8
+ #
9
+ # require 'holidays'
10
+ # require 'holidays/europe'
11
+ #
12
+ # More definitions are available at http://code.dunae.ca/holidays.
13
+ module Europe # :nodoc:
14
+ DEFINED_REGIONS = [:dk, :de, :fr, :de_bw, :de_by, :de_nw, :de_rp, :de_sl, :de_sn, :de_he, :de_th, :de_bb, :de_mv, :de_st, :es, :es_m, :es_cn, :es_cm, :es_pv, :es_ct, :es_na, :es_v, :es_vc, :es_mu, :es_lo, :es_ib, :es_ga, :es_an, :es_ce, :es_o, :es_ex, :es_ar, :es_cl, :gb, :ie, :je, :gb_jsy, :gg, :gb_gsy, :gb_eng, :gb_wls, :gb_eaw, :gb_nir, :gb_sct, :im, :gb_iom, :gb_con, :is, :it, :nl, :pt]
15
+
16
+ HOLIDAYS_BY_MONTH = {
17
+ 5 => [{:mday => 1, :name => "Arbejdernes kampdag", :regions => [:dk]},
18
+ {:mday => 5, :type => :informal, :name => "Danmarks befrielse", :regions => [:dk]},
19
+ {:mday => 1, :name => "Tag der Arbeit", :regions => [:de]},
20
+ {:mday => 8, :name => "Victoire 1945", :regions => [:de, :fr]},
21
+ {:mday => 1, :name => "Día del Trabajador", :regions => [:es]},
22
+ {:mday => 2, :name => "Fiesta de la Comunidad", :regions => [:es_m]},
23
+ {:mday => 30, :name => "Día de las Canarias", :regions => [:es_cn]},
24
+ {:mday => 31, :name => "Día de la Región Castilla-La Mancha", :regions => [:es_cm]},
25
+ {:mday => 1, :name => "Fête du travail", :regions => [:fr]},
26
+ {:wday => 1, :week => 1, :name => "May Day", :regions => [:gb, :ie]},
27
+ {:mday => 9, :name => "Liberation Day", :regions => [:je, :gb_jsy, :gg, :gb_gsy]},
28
+ {:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb]},
29
+ {:mday => 1, :name => "Verkalýðsdagurinn", :regions => [:is]},
30
+ {:mday => 13, :name => "Mæðradagurinn", :regions => [:is]},
31
+ {:mday => 1, :name => "Festa dei Lavoratori", :regions => [:it]},
32
+ {:mday => 4, :name => "Dodenherdenking", :regions => [:nl]},
33
+ {:mday => 5, :name => "Bevrijdingsdag", :regions => [:nl]},
34
+ {:mday => 1, :name => "Dia do Trabalhador", :regions => [:pt]}],
35
+ 0 => [{:function => lambda { |year| Holidays.easter(year)-49 }, :function_id => "easter(year)-49", :type => :informal, :name => "Fastelavn", :regions => [:dk]},
36
+ {:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Palmesøndag", :regions => [:dk]},
37
+ {:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skærtorsdag", :regions => [:dk]},
38
+ {:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Langfredag", :regions => [:dk]},
39
+ {:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Påskedag", :regions => [:dk]},
40
+ {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "2. påskedag", :regions => [:dk]},
41
+ {:function => lambda { |year| Holidays.easter(year)+26 }, :function_id => "easter(year)+26", :name => "Store Bededag", :regions => [:dk]},
42
+ {:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi Himmelfartsdag", :regions => [:dk]},
43
+ {:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pinsedag", :regions => [:dk]},
44
+ {:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "2. Pinsedag", :regions => [:dk]},
45
+ {:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Karfreitag", :regions => [:de]},
46
+ {:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :type => :informal, :name => "Ostern", :regions => [:de]},
47
+ {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Ostermontag", :regions => [:de]},
48
+ {:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Christi Himmelfahrt", :regions => [:de]},
49
+ {:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pfingstmontag", :regions => [:de]},
50
+ {:function => lambda { |year| Holidays.easter(year)+60 }, :function_id => "easter(year)+60", :name => "Fronleichnam", :regions => [:de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_sn, :de_th]},
51
+ {:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Jueves Santo", :regions => [:es_pv, :es_ct, :es_na, :es_v, :es_vc]},
52
+ {:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Viernes Santo", :regions => [:es]},
53
+ {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Lunes de Pascua", :regions => [:es_pv, :es_ct, :es_na, :es_v, :es_vc]},
54
+ {:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pâques", :regions => [:fr]},
55
+ {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Lundi de Pâques", :regions => [:fr]},
56
+ {:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Ascension", :regions => [:fr]},
57
+ {:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pentecôte", :regions => [:fr]},
58
+ {:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Lundi de Pentecôte", :regions => [:fr]},
59
+ {:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:gb]},
60
+ {:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Easter Sunday", :regions => [:gb]},
61
+ {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Easter Monday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir, :ie]},
62
+ {:function => lambda { |year| Holidays.easter(year)-48 }, :function_id => "easter(year)-48", :name => "Bolludagur", :regions => [:is]},
63
+ {:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :name => "Sprengidagur", :regions => [:is]},
64
+ {:function => lambda { |year| Holidays.easter(year)-46 }, :function_id => "easter(year)-46", :name => "Öskudagur", :regions => [:is]},
65
+ {:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Pálmasunnudagur", :regions => [:is]},
66
+ {:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skírdagur", :regions => [:is]},
67
+ {:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Föstudaginn langi", :regions => [:is]},
68
+ {:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Páskadagur", :regions => [:is]},
69
+ {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Annar í páskum", :regions => [:is]},
70
+ {:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Uppstigningardagur", :regions => [:is]},
71
+ {:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Hvítasunnudagur", :regions => [:is]},
72
+ {:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Annar í hvítasunnu", :regions => [:is]},
73
+ {:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pasqua", :regions => [:it]},
74
+ {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Lunedì dell'Angelo", :regions => [:it]},
75
+ {:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Goede Vrijdag", :regions => [:nl]},
76
+ {:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pasen", :regions => [:nl]},
77
+ {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Pasen", :regions => [:nl]},
78
+ {:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Hemelvaartsdag", :regions => [:nl]},
79
+ {:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pinksteren", :regions => [:nl]},
80
+ {:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pinksteren", :regions => [:nl]},
81
+ {:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :type => :informal, :name => "Carnaval", :regions => [:pt]},
82
+ {:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Sexta-feira Santa", :regions => [:pt]},
83
+ {:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Páscoa", :regions => [:pt]},
84
+ {:function => lambda { |year| Holidays.easter(year)+60 }, :function_id => "easter(year)+60", :name => "Corpo de Deus", :regions => [:pt]}],
85
+ 11 => [{:mday => 10, :type => :informal, :name => "Mortensaften", :regions => [:dk]},
86
+ {:mday => 1, :name => "Allerheiligen", :regions => [:de_bw, :de_by, :de_nw, :de_rp, :de_sl]},
87
+ {:function => lambda { |year| Holidays.de_buss_und_bettag(year) }, :function_id => "de_buss_und_bettag(year)", :name => "Buß- und Bettag", :regions => [:de_by, :de_sn]},
88
+ {:mday => 1, :name => "Todos los Santos", :regions => [:es]},
89
+ {:mday => 1, :name => "Toussaint", :regions => [:fr]},
90
+ {:mday => 11, :name => "Armistice 1918", :regions => [:fr]},
91
+ {:mday => 5, :type => :informal, :name => "Guy Fawkes Day", :regions => [:gb]},
92
+ {:mday => 16, :name => "Dagur íslenskrar tungu", :regions => [:is]},
93
+ {:mday => 1, :name => "Ognissanti", :regions => [:it]},
94
+ {:mday => 1, :name => "Todos os Santos", :regions => [:pt]}],
95
+ 6 => [{:mday => 5, :name => "Grundlovsdag", :regions => [:dk]},
96
+ {:mday => 15, :type => :informal, :name => "Valdemarsdag og Genforeningsdag", :regions => [:dk]},
97
+ {:mday => 23, :type => :informal, :name => "Sankt Hans aften", :regions => [:dk]},
98
+ {:mday => 9, :name => "Día de la Región de Murcia", :regions => [:es_mu]},
99
+ {:mday => 9, :name => "Día de La Rioja", :regions => [:es_lo]},
100
+ {:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:ie]},
101
+ {:mday => 3, :type => :informal, :name => "Sjómannadagurinn", :regions => [:is]},
102
+ {:mday => 17, :name => "Lýðveldisdagurinn", :regions => [:is]},
103
+ {:mday => 2, :name => "Festa della Repubblica", :regions => [:it]},
104
+ {:mday => 10, :name => "Dia de Portugal", :regions => [:pt]}],
105
+ 1 => [{:mday => 1, :name => "Nytårsdag", :regions => [:dk]},
106
+ {:mday => 1, :name => "Neujahrstag", :regions => [:de]},
107
+ {:mday => 6, :name => "Heilige Drei Könige", :regions => [:de_bw, :de_by]},
108
+ {:mday => 1, :name => "Año Nuevo", :regions => [:es]},
109
+ {:mday => 6, :name => "Día de Reyes", :regions => [:es]},
110
+ {:mday => 1, :name => "Jour de l'an", :regions => [:fr]},
111
+ {:mday => 1, :name => "New Year's Day", :regions => [:gb, :ie]},
112
+ {:mday => 2, :name => "New Year's", :regions => [:gb_sct]},
113
+ {:mday => 1, :name => "Nýársdagur", :regions => [:is]},
114
+ {:mday => 6, :name => "Þrettándinn", :regions => [:is]},
115
+ {:mday => 19, :type => :informal, :name => "Bóndadagur", :regions => [:is]},
116
+ {:mday => 1, :name => "Capodanno", :regions => [:it]},
117
+ {:mday => 6, :name => "Epifania", :regions => [:it]},
118
+ {:mday => 1, :name => "Nieuwjaar", :regions => [:nl]},
119
+ {:mday => 1, :name => "Ano Novo", :regions => [:pt]}],
120
+ 12 => [{:mday => 13, :type => :informal, :name => "Sankt Lucia", :regions => [:dk]},
121
+ {:mday => 24, :name => "Juleaftensdag", :regions => [:dk]},
122
+ {:mday => 25, :name => "1. juledag", :regions => [:dk]},
123
+ {:mday => 26, :name => "2. juledag", :regions => [:dk]},
124
+ {:mday => 25, :name => "1. Weihnachtstag", :regions => [:de]},
125
+ {:mday => 26, :name => "2. Weihnachtstag", :regions => [:de]},
126
+ {:mday => 6, :name => "Día de la Constitución", :regions => [:es]},
127
+ {:mday => 8, :name => "Inmaculada Concepción", :regions => [:es]},
128
+ {:mday => 25, :name => "Navidad del Señor", :regions => [:es]},
129
+ {:mday => 26, :name => "San Esteban", :regions => [:es_ib, :es_ct]},
130
+ {:mday => 25, :name => "Nöel", :regions => [:fr]},
131
+ {:mday => 25, :observed => lambda { |date| Holidays.to_monday_if_weekend(date) }, :observed_id => "to_monday_if_weekend", :name => "Christmas Day", :regions => [:gb]},
132
+ {:mday => 26, :observed => lambda { |date| Holidays.to_weekday_if_boxing_weekend(date) }, :observed_id => "to_weekday_if_boxing_weekend", :name => "Boxing Day", :regions => [:gb]},
133
+ {:mday => 25, :name => "Christmas Day", :regions => [:ie]},
134
+ {:mday => 26, :name => "St. Stephen's Day", :regions => [:ie]},
135
+ {:mday => 24, :name => "Jól", :regions => [:is]},
136
+ {:mday => 25, :name => "Jól", :regions => [:is]},
137
+ {:mday => 26, :name => "Jól", :regions => [:is]},
138
+ {:mday => 31, :name => "Gamlárskvöld", :regions => [:is]},
139
+ {:mday => 8, :name => "Immacolata Concezione", :regions => [:it]},
140
+ {:mday => 25, :name => "Natale", :regions => [:it]},
141
+ {:mday => 26, :name => "Santo Stefano", :regions => [:it]},
142
+ {:mday => 5, :type => :informal, :name => "Sinterklaas", :regions => [:nl]},
143
+ {:mday => 25, :name => "Kerstmis", :regions => [:nl]},
144
+ {:mday => 26, :name => "Kerstmis", :regions => [:nl]},
145
+ {:mday => 1, :name => "Restauração da Independência", :regions => [:pt]},
146
+ {:mday => 8, :name => "Imaculada Conceição", :regions => [:pt]},
147
+ {:mday => 25, :name => "Natal", :regions => [:pt]}],
148
+ 7 => [{:mday => 23, :name => "Santiago Apostol", :regions => [:es_ga]},
149
+ {:mday => 14, :name => "Fête nationale", :regions => [:fr]},
150
+ {:mday => 5, :name => "Tynwald Day", :regions => [:im, :gb_iom]},
151
+ {:mday => 12, :name => "Battle of the Boyne", :regions => [:gb_nir]}],
152
+ 2 => [{:mday => 28, :name => "Día de Andalucía", :regions => [:es_an]},
153
+ {:mday => 18, :type => :informal, :name => "Konudagur", :regions => [:is]}],
154
+ 8 => [{:mday => 15, :name => "Mariä Himmelfahrt", :regions => [:de_by, :de_sl]},
155
+ {:mday => 15, :name => "Asunción", :regions => [:es]},
156
+ {:mday => 15, :name => "Assomption", :regions => [:fr]},
157
+ {:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:gb_sct, :ie]},
158
+ {:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir]},
159
+ {:wday => 1, :week => 1, :name => "Frídagur verslunarmanna", :regions => [:is]},
160
+ {:mday => 15, :name => "Assunzione", :regions => [:it]},
161
+ {:mday => 15, :name => "Assunção de Nossa Senhora", :regions => [:pt]}],
162
+ 3 => [{:mday => 1, :name => "Día de las Islas Baleares", :regions => [:es_ib]},
163
+ {:mday => 19, :name => "San José", :regions => [:es_v, :es_vc, :es_cm, :es_mu, :es_m]},
164
+ {:mday => 5, :name => "St. Piran's Day", :regions => [:gb_con]},
165
+ {:mday => 17, :name => "St. Patrick's Day", :regions => [:gb_nir, :ie]}],
166
+ 9 => [{:mday => 2, :name => "Día de Ceuta", :regions => [:es_ce]},
167
+ {:mday => 8, :name => "Día de Asturias", :regions => [:es_o]},
168
+ {:mday => 8, :name => "Día de Extremadura", :regions => [:es_ex]},
169
+ {:mday => 11, :name => "Fiesta Nacional de Cataluña", :regions => [:es_ct]}],
170
+ 4 => [{:mday => 1, :type => :informal, :name => "1. april", :regions => [:dk]},
171
+ {:mday => 9, :type => :informal, :name => "Danmarks besættelse", :regions => [:dk]},
172
+ {:mday => 16, :type => :informal, :name => "Dronningens fødselsdag", :regions => [:dk]},
173
+ {:mday => 23, :name => "San Jorge", :regions => [:es_ar, :es_cl]},
174
+ {:mday => 23, :name => "Día de Aragón", :regions => [:es_ar]},
175
+ {:function => lambda { |year| Holidays.is_sumardagurinn_fyrsti(year) }, :function_id => "is_sumardagurinn_fyrsti(year)", :name => "Sumardagurinn fyrsti", :regions => [:is]},
176
+ {:mday => 25, :name => "Festa della Liberazione", :regions => [:it]},
177
+ {:mday => 30, :name => "Koninginnedag", :regions => [:nl]},
178
+ {:mday => 25, :name => "Dia da Liberdade", :regions => [:pt]}],
179
+ 10 => [{:mday => 3, :name => "Tag der Deutschen Einheit", :regions => [:de]},
180
+ {:mday => 31, :name => "Reformationstag", :regions => [:de_bb, :de_mv, :de_sn, :de_st, :de_th]},
181
+ {:mday => 9, :name => "Día de Valencia", :regions => [:es_vc, :es_v]},
182
+ {:mday => 12, :name => "Día de la Hispanidad", :regions => [:es]},
183
+ {:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:ie]},
184
+ {:mday => 5, :name => "Implantação da República", :regions => [:pt]}]
185
+ }
186
+ end
187
+
188
+ # Germany: Wednesday before November 23
189
+ def self.de_buss_und_bettag(year)
190
+ date = Date.civil(year,11,23)
191
+ if date.wday > 3
192
+ date -= (date.wday - 3)
193
+ else
194
+ date -= (date.wday + 4)
195
+ end
196
+ date
197
+ end
198
+
199
+
200
+ # Iceland: first day of summer (Thursday after 18 April)
201
+ def self.is_sumardagurinn_fyrsti(year)
202
+ date = Date.civil(year,4,18)
203
+ if date.wday < 4
204
+ date += (4 - date.wday)
205
+ else date
206
+ date += (11 - date.wday)
207
+ end
208
+ date
209
+ end
210
+
211
+
212
+
213
+ end
214
+
215
+ Holidays.merge_defs(Holidays::Europe::DEFINED_REGIONS, Holidays::Europe::HOLIDAYS_BY_MONTH)