Added code to check for identical functions
Enforced UTF-8 with SVN mime-type in data/ Updated build_defs.rb Added some European tests
This commit is contained in:
parent
f2c72ffd98
commit
e036b8e50e
|
@ -1,5 +1,11 @@
|
|||
require 'yaml'
|
||||
|
||||
# Functions are stored in generated files as both Procs (:function) and
|
||||
# Strings (:function_id). The String version makes comparisons of Procs much
|
||||
# easier.
|
||||
#
|
||||
# TODO:
|
||||
# - better comparison of existing rules
|
||||
def parse_holiday_defs(module_name, files)
|
||||
regions = []
|
||||
rules_by_month = {}
|
||||
|
@ -24,9 +30,13 @@ def parse_holiday_defs(module_name, files)
|
|||
|
||||
exists = false
|
||||
rules_by_month[month].each do |ex|
|
||||
if ex['name'] == rule['name'] and ex['wday'] == rule['wday'] and ex['mday'] == rule['mday'] and ex['week'] == rule['week'] and ex['function'] == rule['function']
|
||||
if ex['name'] == rule['name'] and ex['wday'] == rule['wday'] and ex['mday'] == rule['mday'] and ex['week'] == rule['week'] and ex['function'] == rule['function']
|
||||
ex['regions'] << rule['regions'].flatten
|
||||
exists = true
|
||||
else
|
||||
if rule['function_id']
|
||||
"Rejecting #{rule['function_id']}"
|
||||
end
|
||||
end
|
||||
end
|
||||
unless exists
|
||||
|
@ -56,7 +66,8 @@ def parse_holiday_defs(module_name, files)
|
|||
if rule['mday']
|
||||
str << ":mday => #{rule['mday']}, "
|
||||
elsif rule['function']
|
||||
str << ":function => #{rule['function']}, "
|
||||
str << ":function => lambda { |year| Holidays.#{rule['function']} }, "
|
||||
str << ":function_id => \"#{rule['function'].to_s}\", "
|
||||
else
|
||||
str << ":wday => #{rule['wday']}, :week => #{rule['week']}, "
|
||||
end
|
||||
|
@ -112,4 +123,6 @@ Holidays.merge_defs(Holidays::#{module_name}::DEFINED_REGIONS, Holidays::#{modul
|
|||
EOC
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -6,16 +6,16 @@ months:
|
|||
0:
|
||||
- name: Good Friday
|
||||
regions: [au]
|
||||
function: lambda { |year| Holidays.easter(year)-2 }
|
||||
function: easter(year)-2
|
||||
- name: Easter Saturday
|
||||
regions: [au]
|
||||
function: lambda { |year| Holidays.easter(year)-1 }
|
||||
function: easter(year)-1
|
||||
- name: Easter Monday
|
||||
regions: [au]
|
||||
function: lambda { |year| Holidays.easter(year)+1 }
|
||||
function: easter(year)+1
|
||||
- name: Easter Monday
|
||||
regions: [au_tas]
|
||||
function: lambda { |year| Holidays.easter(year)+2 }
|
||||
function: easter(year)+2
|
||||
1:
|
||||
- name: New Year's Day
|
||||
regions: [au]
|
||||
|
|
11
data/ca.yaml
11
data/ca.yaml
|
@ -5,10 +5,11 @@ months:
|
|||
0:
|
||||
- name: Good Friday
|
||||
regions: [ca]
|
||||
function: lambda { |year| Holidays.easter(year)-2 }
|
||||
function: easter(year)-2
|
||||
- name: Easter Monday
|
||||
regions: [ca_qc]
|
||||
function: lambda { |year| Holidays.easter(year)+1 }
|
||||
regions: [ca]
|
||||
function: easter(year)+1
|
||||
type: informal
|
||||
1:
|
||||
- name: New Year's Day
|
||||
regions: [ca]
|
||||
|
@ -36,10 +37,10 @@ months:
|
|||
5:
|
||||
- name: Victoria Day
|
||||
regions: [ca]
|
||||
function: lambda { |year| Holidays.ca_victoria_day(year) }
|
||||
function: ca_victoria_day(year)
|
||||
- name: National Patriotes Day
|
||||
regions: [ca_qc]
|
||||
function: lambda { |year| Holidays.ca_victoria_day(year) }
|
||||
function: ca_victoria_day(year)
|
||||
6:
|
||||
- name: Discovery Day
|
||||
regions: [ca_nf]
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
0:
|
||||
- name: Easter Sunday
|
||||
regions: [christian]
|
||||
function: lambda { |year| Holidays.easter(year) }
|
||||
function: easter(year) }
|
||||
- name: Palm Sunday
|
||||
regions: [christian]
|
||||
function: lambda { |year| Holidays.easter(year)-7 }
|
||||
function: easter(year)-7 }
|
||||
- name: Good Friday
|
||||
regions: [christian]
|
||||
function: lambda { |year| Holidays.easter(year)-2 }
|
||||
function: easter(year)-2 }
|
||||
12:
|
||||
- name: Christmas Day
|
||||
regions: [christian]
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
# Common method definitions for the Ruby Holiday gem.
|
||||
# Updated 2008-11-21.
|
||||
---
|
||||
methods:
|
||||
easter: |
|
||||
# Get the date of Easter in a given year.
|
||||
#
|
||||
# +year+ must be a valid Gregorian year.
|
||||
#
|
||||
# Returns a Date object.
|
||||
#--
|
||||
# from http://snippets.dzone.com/posts/show/765
|
||||
# TODO: check year to ensure Gregorian
|
||||
def self.easter(year)
|
||||
y = year
|
||||
a = y % 19
|
||||
b = y / 100
|
||||
c = y % 100
|
||||
d = b / 4
|
||||
e = b % 4
|
||||
f = (b + 8) / 25
|
||||
g = (b - f + 1) / 3
|
||||
h = (19 * a + b - d - g + 15) % 30
|
||||
i = c / 4
|
||||
k = c % 4
|
||||
l = (32 + 2 * e + 2 * i - h - k) % 7
|
||||
m = (a + 11 * h + 22 * l) / 451
|
||||
month = (h + l - 7 * m + 114) / 31
|
||||
day = ((h + l - 7 * m + 114) % 31) + 1
|
||||
Date.civil(year, month, day)
|
||||
end
|
10
data/de.yaml
10
data/de.yaml
|
@ -8,19 +8,19 @@ months:
|
|||
0:
|
||||
- name: Karfreitag
|
||||
regions: [de]
|
||||
function: lambda { |year| Holidays.easter(year)-2 }
|
||||
function: easter(year)-2
|
||||
- name: Ostermontag
|
||||
regions: [de]
|
||||
function: lambda { |year| Holidays.easter(year)+1 }
|
||||
function: easter(year)+1
|
||||
- name: Christi Himmelfahrt
|
||||
regions: [de]
|
||||
function: lambda { |year| Holidays.easter(year)+39 }
|
||||
function: easter(year)+39
|
||||
- name: Pfingstmontag
|
||||
regions: [de]
|
||||
function: lambda { |year| Holidays.easter(year)+50 }
|
||||
function: easter(year)+50
|
||||
- name: Fronleichnam
|
||||
regions: [de_bw, de_by, de_he, de_nw, de_rp, de_sl, de_sn, de_th]
|
||||
function: lambda { |year| Holidays.easter(year)+60 }
|
||||
function: easter(year)+60
|
||||
1:
|
||||
- name: Neujahrstag
|
||||
regions: [de]
|
||||
|
|
22
data/dk.yaml
22
data/dk.yaml
|
@ -10,38 +10,38 @@ months:
|
|||
0:
|
||||
- name: Fastelavn
|
||||
regions: [dk]
|
||||
function: lambda { |year| Holidays.easter(year)-49 }
|
||||
function: easter(year)-49
|
||||
type: informal
|
||||
- name: Palmesøndag
|
||||
regions: [dk]
|
||||
function: lambda { |year| Holidays.easter(year)-7 }
|
||||
function: easter(year)-7
|
||||
- name: Skærtorsdag
|
||||
regions: [dk]
|
||||
function: lambda { |year| Holidays.easter(year)-3 }
|
||||
function: easter(year)-3
|
||||
- name: Langfredag
|
||||
regions: [dk]
|
||||
function: lambda { |year| Holidays.easter(year)-2 }
|
||||
function: easter(year)-2
|
||||
- name: Påskedag
|
||||
regions: [dk]
|
||||
function: lambda { |year| Holidays.easter(year) }
|
||||
function: easter(year)
|
||||
- name: 2. påskedag
|
||||
regions: [dk]
|
||||
function: lambda { |year| Holidays.easter(year)+1 }
|
||||
function: easter(year)+1
|
||||
- name: Store Bededag
|
||||
regions: [dk]
|
||||
function: lambda { |year| Holidays.easter(year)+26 }
|
||||
function: easter(year)+26
|
||||
- name: Kristi Himmelfartsdag
|
||||
regions: [dk]
|
||||
function: lambda { |year| Holidays.easter(year)+40 }
|
||||
function: easter(year)+40
|
||||
- name: Kristi Himmelfartsdag
|
||||
regions: [dk]
|
||||
function: lambda { |year| Holidays.easter(year)+40 }
|
||||
function: easter(year)+40
|
||||
- name: 2. Pinsedag
|
||||
regions: [dk]
|
||||
function: lambda { |year| Holidays.easter(year)+49 }
|
||||
function: easter(year)+49
|
||||
- name: Pinsedag
|
||||
regions: [dk]
|
||||
function: lambda { |year| Holidays.easter(year)+50 }
|
||||
function: easter(year)+50
|
||||
1:
|
||||
- name: Nytårsdag
|
||||
regions: [dk]
|
||||
|
|
|
@ -11,13 +11,13 @@ months:
|
|||
0:
|
||||
- name: Jueves Santo
|
||||
regions: [es_pv, es_ct, es_na, es_v, es_vc]
|
||||
function: lambda { |year| Holidays.easter(year)-3 }
|
||||
function: easter(year)-3
|
||||
- name: Viernes Santo
|
||||
regions: [es]
|
||||
function: lambda { |year| Holidays.easter(year)-2 }
|
||||
function: easter(year)-2
|
||||
- name: Lunes de Pascua
|
||||
regions: [es_pv, es_ct, es_na, es_v, es_vc]
|
||||
function: lambda { |year| Holidays.easter(year)+1 }
|
||||
function: easter(year)+1
|
||||
1:
|
||||
- name: Año Nuevo
|
||||
regions: [es]
|
||||
|
|
|
@ -8,16 +8,16 @@ months:
|
|||
0:
|
||||
- name: Pâques
|
||||
regions: [fr]
|
||||
function: lambda { |year| Holidays.easter(year) }
|
||||
function: easter(year)
|
||||
- name: Ascension
|
||||
regions: [fr]
|
||||
function: lambda { |year| Holidays.easter(year)+40 }
|
||||
function: easter(year)+40
|
||||
- name: Pentecôte
|
||||
regions: [fr]
|
||||
function: lambda { |year| Holidays.easter(year)+49 }
|
||||
function: easter(year)+49
|
||||
- name: Lundi de Pentecôte
|
||||
regions: [fr]
|
||||
function: lambda { |year| Holidays.easter(year)+50 }
|
||||
function: easter(year)+50
|
||||
1:
|
||||
- name: Jour de l'an
|
||||
regions: [fr]
|
||||
|
|
|
@ -13,13 +13,13 @@ months:
|
|||
0:
|
||||
- name: Good Friday
|
||||
regions: [gb]
|
||||
function: lambda { |year| Holidays.easter(year)-2 }
|
||||
function: easter(year)-2
|
||||
- name: Easter Sunday
|
||||
regions: [gb]
|
||||
function: lambda { |year| Holidays.easter(year) }
|
||||
function: easter(year)
|
||||
- name: Easter Monday
|
||||
regions: [gb_eng, gb_wls, gb_eaw, gb_nir]
|
||||
function: lambda { |year| Holidays.easter(year)+1 }
|
||||
function: easter(year)+1
|
||||
1:
|
||||
- name: New Year's Day
|
||||
regions: [gb]
|
||||
|
|
|
@ -7,7 +7,7 @@ months:
|
|||
0:
|
||||
- name: Easter Monday
|
||||
regions: [ie]
|
||||
function: lambda { |year| Holidays.easter(year)+1 }
|
||||
function: easter(year)+1
|
||||
1:
|
||||
- name: New Year's Day
|
||||
regions: [ie]
|
||||
|
|
26
data/is.yaml
26
data/is.yaml
|
@ -10,43 +10,43 @@ months:
|
|||
0:
|
||||
- name: Bolludagur
|
||||
regions: [is]
|
||||
function: lambda { |year| Holidays.easter(year)-48 }
|
||||
function: easter(year)-48
|
||||
- name: Sprengidagur
|
||||
regions: [is]
|
||||
function: lambda { |year| Holidays.easter(year)-47 }
|
||||
function: easter(year)-47
|
||||
- name: Öskudagur
|
||||
regions: [is]
|
||||
function: lambda { |year| Holidays.easter(year)-46 }
|
||||
function: easter(year)-46
|
||||
- name: Pálmasunnudagur
|
||||
regions: [is]
|
||||
function: lambda { |year| Holidays.easter(year)-7 }
|
||||
function: easter(year)-7
|
||||
- name: Skírdagur
|
||||
regions: [is]
|
||||
function: lambda { |year| Holidays.easter(year)-3 }
|
||||
function: easter(year)-3
|
||||
- name: Föstudaginn langi
|
||||
regions: [is]
|
||||
function: lambda { |year| Holidays.easter(year)-2 }
|
||||
function: easter(year)-2
|
||||
- name: Páskadagur
|
||||
regions: [is]
|
||||
function: lambda { |year| Holidays.easter(year) }
|
||||
function: easter(year)
|
||||
- name: Annar í páskum
|
||||
regions: [is]
|
||||
function: lambda { |year| Holidays.easter(year)+1 }
|
||||
function: easter(year)+1
|
||||
- name: Store Bededag
|
||||
regions: [is]
|
||||
function: lambda { |year| Holidays.easter(year)+26 }
|
||||
function: easter(year)+26
|
||||
- name: Kristi Himmelfartsdag
|
||||
regions: [is]
|
||||
function: lambda { |year| Holidays.easter(year)+40 }
|
||||
function: easter(year)+40
|
||||
- name: Kristi Himmelfartsdag
|
||||
regions: [is]
|
||||
function: lambda { |year| Holidays.easter(year)+40 }
|
||||
function: easter(year)+40
|
||||
- name: 2. Pinsedag
|
||||
regions: [is]
|
||||
function: lambda { |year| Holidays.easter(year)+49 }
|
||||
function: easter(year)+49
|
||||
- name: Pinsedag
|
||||
regions: [is]
|
||||
function: lambda { |year| Holidays.easter(year)+50 }
|
||||
function: easter(year)+50
|
||||
1:
|
||||
- name: Nýársdagur
|
||||
regions: [is]
|
||||
|
|
|
@ -8,10 +8,10 @@ months:
|
|||
0:
|
||||
- name: Pasqua
|
||||
regions: [it]
|
||||
function: lambda { |year| Holidays.easter(year) }
|
||||
function: easter(year)
|
||||
- name: Lunedì dell'Angelo
|
||||
regions: [it]
|
||||
function: lambda { |year| Holidays.easter(year)+1 }
|
||||
function: easter(year)+1
|
||||
1:
|
||||
- name: Capodanno
|
||||
regions: [it]
|
||||
|
|
|
@ -8,13 +8,13 @@ months:
|
|||
0:
|
||||
- name: Liela Piektdiena
|
||||
regions: [lv]
|
||||
function: lambda { |year| Holidays.easter(year)-2 }
|
||||
function: easter(year)-2
|
||||
- name: Lieldienas
|
||||
regions: [lv]
|
||||
function: lambda { |year| Holidays.easter(year) }
|
||||
function: easter(year)
|
||||
- name: 2. Lieldienas
|
||||
regions: [lv]
|
||||
function: lambda { |year| Holidays.easter(year)+1 }
|
||||
function: easter(year)+1
|
||||
1:
|
||||
- name: Jaunais Gads
|
||||
regions: [lv]
|
||||
|
|
82
data/mx.yaml
82
data/mx.yaml
|
@ -1,57 +1,91 @@
|
|||
# Mexican holiday definitions for the Ruby Holiday gem.
|
||||
# Updated 2008-11-21.
|
||||
# Updated 2008-11-24.
|
||||
---
|
||||
months:
|
||||
0:
|
||||
- name: Good Thursday
|
||||
regions: [mx]
|
||||
function: lambda { |year| Holidays.easter(year)-3 }
|
||||
- name: Good Friday
|
||||
regions: [mx]
|
||||
function: lambda { |year| Holidays.easter(year)-2 }
|
||||
- name: Easter Sunday
|
||||
regions: [mx]
|
||||
function: lambda { |year| Holidays.easter(year) }
|
||||
1:
|
||||
- name: New Year's Day
|
||||
- name: Año nuevo
|
||||
regions: [mx]
|
||||
mday: 1
|
||||
- name: New Year's Day
|
||||
- name: Dia de los Santos Reyes
|
||||
regions: [mx]
|
||||
mday: 2
|
||||
mday: 6
|
||||
2:
|
||||
- name: D\xC3\xADa de la Constituci\xC3\xB3n
|
||||
- name: Día de la Constitución
|
||||
week: 1
|
||||
regions: [mx]
|
||||
wday: 1
|
||||
3:
|
||||
- name: Natalicio de Benito Ju\xC3\xA1rez
|
||||
- name: Natalicio de Benito Juárez
|
||||
week: 3
|
||||
regions: [mx]
|
||||
wday: 1
|
||||
4:
|
||||
- name: Día del Niño
|
||||
regions: [mx]
|
||||
mday: 30
|
||||
type: informal
|
||||
5:
|
||||
- name: D\xC3\xADa del Trabajo
|
||||
- name: Día del Trabajo
|
||||
regions: [mx]
|
||||
mday: 1
|
||||
- name: La Batalla de Puebla
|
||||
- name: Cinco de Mayo
|
||||
regions: [mx]
|
||||
mday: 5
|
||||
9:
|
||||
- name: D\xC3\xADa de Independencia
|
||||
type: informal
|
||||
- name: La Batalla de Puebla
|
||||
regions: [mx_pue]
|
||||
mday: 5
|
||||
- name: Día de la Madre
|
||||
regions: [mx]
|
||||
mday: 10
|
||||
type: informal
|
||||
- name: Día del Maestro
|
||||
regions: [mx]
|
||||
mday: 15
|
||||
type: informal
|
||||
6:
|
||||
- name: Día del Padre
|
||||
regions: [mx]
|
||||
wday: 0
|
||||
week: 3
|
||||
type: informal
|
||||
9:
|
||||
- name: Grito de Dolores
|
||||
regions: [mx]
|
||||
mday: 15
|
||||
- name: Día de la Independencia
|
||||
regions: [mx]
|
||||
mday: 16
|
||||
10:
|
||||
- name: Día de la Raza
|
||||
regions: [mx]
|
||||
mday: 12
|
||||
type: informal
|
||||
11:
|
||||
- name: Dia de Muertos
|
||||
- name: Todos los Santos
|
||||
regions: [mx]
|
||||
mday: 1
|
||||
type: informal
|
||||
- name: Los Fieles Difuntos
|
||||
regions: [mx]
|
||||
mday: 2
|
||||
- name: D\xC3\xADa de la Revoluci\xC3\xB3n
|
||||
type: informal
|
||||
- name: Día de la Revolución
|
||||
week: 3
|
||||
regions: [mx]
|
||||
wday: 1
|
||||
12:
|
||||
- name: Our Lady of Guadalupe's day
|
||||
- name: Día de la Virgen de Guadalupe
|
||||
regions: [mx]
|
||||
mday: 12
|
||||
- name: Christmas Day
|
||||
type: informal
|
||||
- name: Nochebuena
|
||||
regions: [mx]
|
||||
mday: 24
|
||||
type: informal
|
||||
- name: Navidad
|
||||
regions: [mx]
|
||||
mday: 25
|
||||
- name: Los Santos Inocentes
|
||||
regions: [mx]
|
||||
mday: 28
|
||||
|
|
12
data/nl.yaml
12
data/nl.yaml
|
@ -9,22 +9,22 @@ months:
|
|||
0:
|
||||
- name: Goede Vrijdag
|
||||
regions: [nl]
|
||||
function: lambda { |year| Holidays.easter(year)-2 }
|
||||
function: easter(year)-2
|
||||
- name: Pasen
|
||||
regions: [nl]
|
||||
function: lambda { |year| Holidays.easter(year) }
|
||||
function: easter(year)
|
||||
- name: Pasen
|
||||
regions: [nl]
|
||||
function: lambda { |year| Holidays.easter(year)+1 }
|
||||
function: easter(year)+1
|
||||
- name: Hemelvaartsdag
|
||||
regions: [nl]
|
||||
function: lambda { |year| Holidays.easter(year)+39 }
|
||||
function: easter(year)+39
|
||||
- name: Pinksteren
|
||||
regions: [nl]
|
||||
function: lambda { |year| Holidays.easter(year)+49 }
|
||||
function: easter(year)+49
|
||||
- name: Pinksteren
|
||||
regions: [nl]
|
||||
function: lambda { |year| Holidays.easter(year)+50 }
|
||||
function: easter(year)+50
|
||||
1:
|
||||
- name: Nieuwjaar
|
||||
regions: [nl]
|
||||
|
|
|
@ -2,11 +2,6 @@
|
|||
# Updated 2008-11-22.
|
||||
---
|
||||
months:
|
||||
0:
|
||||
- name: Good Friday
|
||||
regions: [us]
|
||||
function: lambda { |year| Holidays.easter(year)-2 }
|
||||
type: informal
|
||||
2:
|
||||
- name: Groundhog Day
|
||||
regions: [us, ca]
|
||||
|
|
29
data/pt.yaml
29
data/pt.yaml
|
@ -38,7 +38,7 @@ months:
|
|||
6:
|
||||
- name: Dia de Portugal
|
||||
regions: [pt]
|
||||
mday: 6
|
||||
mday: 10
|
||||
8:
|
||||
- name: Assunção de Nossa Senhora
|
||||
regions: [pt]
|
||||
|
@ -61,30 +61,3 @@ months:
|
|||
- name: Natal
|
||||
regions: [pt]
|
||||
mday: 25
|
||||
|
||||
|
||||
|
||||
|
||||
def test_pt
|
||||
{Date.civil(2008,1,1) => 'Ano Novo',
|
||||
Date.civil(2005,2,8) => 'Carnaval',
|
||||
Date.civil(2006,2,28) => 'Carnaval',
|
||||
Date.civil(2007,2,20) => 'Carnaval',
|
||||
Date.civil(2008,2,5) => 'Carnaval',
|
||||
Date.civil(2008,3,24) => 'Sexta-feira Santa',
|
||||
Date.civil(2008,3,26) => 'Páscoa',
|
||||
Date.civil(2008,4,25) => 'Dia da Liberdade',
|
||||
Date.civil(2008,5,1) => 'Dia do Trabalhador',
|
||||
Date.civil(2005,5,26) => 'Corpo de Deus',
|
||||
Date.civil(2007,6,7) => 'Corpo de Deus',
|
||||
Date.civil(2008,5,22) => 'Corpo de Deus',
|
||||
Date.civil(2008,6,10) => 'Dia de Portugal',
|
||||
Date.civil(2008,8,15) => 'Assunção de Nossa Senhora',
|
||||
Date.civil(2008,10,5) => 'Implantação da República',
|
||||
Date.civil(2008,11,1) => 'Todos os Santos',
|
||||
Date.civil(2008,12,1) => 'Restauração da Independência',
|
||||
Date.civil(2008,12,8) => 'Imaculada Conceição',
|
||||
Date.civil(2008,12,25) => 'Natal'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :pt)[0][:name]
|
||||
end
|
||||
end
|
40
data/se.yaml
40
data/se.yaml
|
@ -4,6 +4,8 @@
|
|||
# Sources:
|
||||
# - http://en.wikipedia.org/wiki/Holidays_in_Sweden
|
||||
# - http://www.worldtravelguide.net/country/269/public_holidays/Europe/Sweden.html
|
||||
# - http://hem.passagen.se/farila/midsum.htm
|
||||
# - http://www.timeanddate.com/calendar/?country=21
|
||||
---
|
||||
months:
|
||||
0:
|
||||
|
@ -51,29 +53,17 @@ months:
|
|||
regions: [se]
|
||||
mday: 26
|
||||
methods:
|
||||
se_midsommardagen:
|
||||
# The Saturday during the period 20–26 June. (2007: June 23)
|
||||
se_alla_helgons_dag:
|
||||
# The Saturday during the period October 31–November 6. (2007: November 3)
|
||||
|
||||
|
||||
|
||||
def test_se
|
||||
{Date.civil(2008,1,1) => 'Nyårsdagen',
|
||||
Date.civil(2008,1,6) => 'Trettondedag jul',
|
||||
Date.civil(2008,3,23) => 'Långfredagen',
|
||||
Date.civil(2008,3,21) => 'Påskdagen',
|
||||
Date.civil(2008,3,24) => 'Annandag påsk',
|
||||
Date.civil(2008,5,1) => 'Första maj',
|
||||
Date.civil(2008,5,1) => 'Kristi himmelsfärdsdag',
|
||||
Date.civil(2008,5,11) => 'Pingstdagen',
|
||||
Date.civil(2008,6,6) => 'Nationaldagen',
|
||||
Date.civil(2007,6,23) => 'Midsommardagen',
|
||||
Date.civil(2008,6,21) => 'Midsommardagen',
|
||||
Date.civil(2007,11,3) => 'Alla helgons dag',
|
||||
Date.civil(2008,11,1) => 'Alla helgons dag',
|
||||
Date.civil(2008,12,25) => 'Juldagen',
|
||||
Date.civil(2008,12,25) => 'Annandag jul'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :se)[0][:name]
|
||||
se_midsommardagen: |
|
||||
# The Saturday between June 20–26. (2007: June 23)
|
||||
def self.se_midsommardagen(year)
|
||||
date = Date.civil(year,6,20)
|
||||
date += (6 - date.wday)
|
||||
date
|
||||
end
|
||||
se_alla_helgons_dag: |
|
||||
# The Saturday between Oct 31 and Nov 6.(2007: November 3)
|
||||
def self.se_alla_helgons_dag(year)
|
||||
date = Date.civil(year,10,31)
|
||||
date += (6 - date.wday)
|
||||
date
|
||||
end
|
||||
end
|
15
data/us.yaml
15
data/us.yaml
|
@ -1,9 +1,14 @@
|
|||
# United States holiday definitions for the Ruby Holiday gem.
|
||||
#
|
||||
# Updated: 2008-11-22.
|
||||
# Updated: 2008-11-24.
|
||||
# Source: http://en.wikipedia.org/wiki/Public_holidays_of_the_United_States
|
||||
---
|
||||
months:
|
||||
0:
|
||||
- name: Good Friday
|
||||
regions: [us]
|
||||
function: easter(year)-2
|
||||
type: informal
|
||||
1:
|
||||
- name: New Year's Day
|
||||
regions: [us]
|
||||
|
@ -13,9 +18,9 @@ months:
|
|||
regions: [us]
|
||||
wday: 1
|
||||
- name: Inauguration Day
|
||||
function: lambda { |year| Holidays.us_inauguration_day(year) }
|
||||
regions: [us]
|
||||
3:
|
||||
function: us_inauguration_day(year)
|
||||
regions: [us_dc]
|
||||
2:
|
||||
- name: Presidents' Day
|
||||
week: 3
|
||||
regions: [us]
|
||||
|
@ -43,7 +48,7 @@ months:
|
|||
- name: Veterans Day
|
||||
regions: [us]
|
||||
mday: 11
|
||||
- name: Thanksgiving Day
|
||||
- name: Thanksgiving
|
||||
week: 4
|
||||
regions: [us]
|
||||
wday: 4
|
||||
|
|
|
@ -9,10 +9,10 @@ months:
|
|||
0:
|
||||
- name: Good Friday
|
||||
regions: [za]
|
||||
function: lambda { |year| Holidays.easter(year)-2 }
|
||||
function: easter(year)-2
|
||||
- name: Family Day
|
||||
regions: [za]
|
||||
function: lambda { |year| Holidays.easter(year)+1 }
|
||||
function: easter(year)+1
|
||||
1:
|
||||
- name: New Year's Day
|
||||
regions: [za]
|
||||
|
|
|
@ -1,38 +1,21 @@
|
|||
$:.unshift File.dirname(__FILE__)
|
||||
|
||||
require 'digest/md5'
|
||||
# == Ruby Holidays module
|
||||
|
||||
# === Ruby Holidays module
|
||||
#
|
||||
# === Using regions
|
||||
# ==== Using regions
|
||||
# Holidays can be defined as belonging to one or more regions and sub regions.
|
||||
# The Holidays#on, Holidays#between, Date#holidays and Date#holiday? methods
|
||||
# each allow you to specify a specific region.
|
||||
#
|
||||
# ==== Regions
|
||||
# To select all holidays during May in the CA region (Canada), you might call:
|
||||
# Holidays.between(Date.civil(2008,5,1), Date.civil(2008,5,31), :ca)
|
||||
#
|
||||
# Which would return Victoria Day, a national holiday in Canada.
|
||||
# => [{:name => 'Victoria Day',...}...]
|
||||
#
|
||||
# ==== Sub regions
|
||||
# In the Canadian Province of Québec, there's another holiday in May.
|
||||
# Holidays.between(Date.civil(2008,5,1), Date.civil(2008,5,31), :ca_pq)
|
||||
#
|
||||
# This query would return all holidays in both the parent region (<tt>:ca</tt>) and the
|
||||
# sub region (<tt>:ca_pq</tt>).
|
||||
# => [{:name => 'Victoria Day',...}, {:name => 'Journée nationale des Patriotes',...}...]
|
||||
#
|
||||
# ==== Wildcard sub regions
|
||||
# To avoid having to return enter a long list of regions, you can append an underscore
|
||||
# to the end of the region symbol. This selects an entire region, including its sub-regions.
|
||||
# Holidays.between(Date.civil(2008,5,1), Date.civil(2008,5,31), :ca_)
|
||||
# => [{:name => 'Victoria Day',...}, {:name => 'Journée nationale des Patriotes',...}...]
|
||||
#
|
||||
# ==== All regions
|
||||
# Finally, you can select holidays that occur in any region using <tt>:any</tt>.
|
||||
# There are several different ways that you can specify a region:
|
||||
#
|
||||
# ca:: By region. Return holidays in the CA region (Canada).
|
||||
# ca_:: By region and sub regions. Return holidays in the CA region and all sub regions.
|
||||
#
|
||||
# ca_bc:: By sub region. Return holidays in the CA region and CA_BC sub region.
|
||||
# any:: Any region. Return holidays from any region.
|
||||
module Holidays
|
||||
# Exception thrown when an unknown region is requested.
|
||||
class UnkownRegionError < ArgumentError; end
|
||||
|
@ -104,7 +87,10 @@ module Holidays
|
|||
mday = h[:mday] || Date.calculate_mday(year, month, h[:week], h[:wday])
|
||||
end
|
||||
|
||||
date = Date.new(year, month, mday)
|
||||
begin
|
||||
date = Date.new(year, month, mday)
|
||||
rescue; next; end
|
||||
|
||||
if date.between?(start_date, end_date)
|
||||
holidays << {:date => date, :name => h[:name], :regions => h[:regions]}
|
||||
end
|
||||
|
@ -127,7 +113,31 @@ module Holidays
|
|||
holidays.each do |month, holiday_defs|
|
||||
@@holidays_by_month[month] = [] unless @@holidays_by_month[month]
|
||||
holiday_defs.each do |holiday_def|
|
||||
@@holidays_by_month[month] << holiday_def
|
||||
|
||||
exists = false
|
||||
@@holidays_by_month[month].each do |ex|
|
||||
|
||||
if ex[:name] == holiday_def[:name] and ex[:wday] == holiday_def[:wday] and ex[:mday] == holiday_def[:mday] and ex[:week] == holiday_def[:week] and ex[:function_id] == holiday_def[:function_id]
|
||||
|
||||
# append regions
|
||||
ex[:regions] << holiday_def[:regions]
|
||||
|
||||
# Should do this once we're done
|
||||
ex[:regions].flatten!
|
||||
ex[:regions].uniq!
|
||||
exists = true
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
unless exists
|
||||
@@holidays_by_month[month] << holiday_def
|
||||
if holiday_def[:function]
|
||||
#puts "New func #{holiday_def[:function].methods.join(', ')}"
|
||||
# puts "New func #{holiday_def[:function] }"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -236,7 +246,22 @@ private
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
# === Extending Ruby's Date class with the Holidays gem
|
||||
# The Holidays gem automatically extends Ruby's Date class and gives you access
|
||||
# to three new methods: holiday?, #holidays and #calculate_mday.
|
||||
#
|
||||
# ==== Examples
|
||||
# Lookup Canada Day in the <tt>:ca</tt> region
|
||||
# Date.civil(2008,7,1).holiday?(:ca)
|
||||
# => true
|
||||
#
|
||||
# Lookup Canada Day in the <tt>:fr</tt> region
|
||||
# Date.civil(2008,7,1).holiday?(:fr)
|
||||
# => false
|
||||
#
|
||||
# Lookup holidays in North America in January 1.
|
||||
# Date.civil(2008,1,1).holidays([:ca, :mx, :us])
|
||||
# => [{:name => 'New Year\'s Day'...}]
|
||||
class Date
|
||||
include Holidays
|
||||
|
||||
|
|
|
@ -15,10 +15,10 @@ module Holidays
|
|||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_qld, :au_nt]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :name => "Good Friday", :regions => [:au]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-1 }, :name => "Easter Saturday", :regions => [:au]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :name => "Easter Monday", :regions => [:au]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+2 }, :name => "Easter Monday", :regions => [:au_tas]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:au]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-1 }, :function_id => "easter(year)-1", :name => "Easter Saturday", :regions => [:au]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Easter Monday", :regions => [:au]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+2 }, :function_id => "easter(year)+2", :name => "Easter Monday", :regions => [:au_tas]}],
|
||||
6 => [{:wday => 1, :week => 2, :name => "Queen's Birthday", :regions => [:au]},
|
||||
{:mday => 6, :type => :informal, :name => "Queensland Day", :regions => [:au_qld]}],
|
||||
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:au]},
|
||||
|
|
|
@ -11,14 +11,14 @@ module Holidays
|
|||
#
|
||||
# More definitions are available at http://code.dunae.ca/holidays.
|
||||
module CA # :nodoc:
|
||||
DEFINED_REGIONS = [:ca, :ca_qc, :us, :ca_nf, :ca_nt, :ca_nu, :ca_ab, :ca_on, :ca_sk, :ca_mb, :ca_bc, :ca_ns, :ca_yk]
|
||||
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]
|
||||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:function => lambda { |year| Holidays.ca_victoria_day(year) }, :name => "Victoria Day", :regions => [:ca]},
|
||||
{:function => lambda { |year| Holidays.ca_victoria_day(year) }, :name => "National Patriotes Day", :regions => [:ca_qc]},
|
||||
5 => [{:function => lambda { |year| Holidays.ca_victoria_day(year) }, :function_id => "ca_victoria_day(year)", :name => "Victoria Day", :regions => [:ca]},
|
||||
{:function => lambda { |year| Holidays.ca_victoria_day(year) }, :function_id => "ca_victoria_day(year)", :name => "National Patriotes Day", :regions => [:ca_qc]},
|
||||
{:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :name => "Good Friday", :regions => [:ca, :us]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :name => "Easter Monday", :regions => [:ca_qc]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:ca]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :type => :informal, :name => "Easter Monday", :regions => [:ca]}],
|
||||
11 => [{:mday => 11, :name => "Rememberance Day", :regions => [:ca]}],
|
||||
6 => [{:mday => 24, :name => "Discovery Day", :regions => [:ca_nf]},
|
||||
{:mday => 24, :name => "Fête Nationale", :regions => [:ca_qc]},
|
||||
|
|
|
@ -16,11 +16,11 @@ module Holidays
|
|||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:mday => 1, :name => "Tag der Arbeit", :regions => [:de]},
|
||||
{:mday => 8, :name => "Victoire 1945", :regions => [:de]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :name => "Karfreitag", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :name => "Ostermontag", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :name => "Christi Himmelfahrt", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :name => "Pfingstmontag", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+60 }, :name => "Fronleichnam", :regions => [:de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_sn, :de_th]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Karfreitag", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Ostermontag", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Christi Himmelfahrt", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pfingstmontag", :regions => [:de]},
|
||||
{: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]}],
|
||||
11 => [{:mday => 1, :name => "Allerheiligen", :regions => [:de_bw, :de_by, :de_nw, :de_rp, :de_sl]}],
|
||||
1 => [{:mday => 1, :name => "Neujahrstag", :regions => [:de]},
|
||||
{:mday => 6, :name => "Heilige Drei Könige", :regions => [:de_bw, :de_by]}],
|
||||
|
|
|
@ -16,16 +16,16 @@ module Holidays
|
|||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:mday => 1, :name => "Arbejdernes kampdag", :regions => [:dk]},
|
||||
{:mday => 5, :type => :informal, :name => "Danmarks befrielse", :regions => [:dk]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-49 }, :type => :informal, :name => "Fastelavn", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-7 }, :name => "Palmesøndag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :name => "Skærtorsdag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :name => "Langfredag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :name => "Påskedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :name => "2. påskedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+26 }, :name => "Store Bededag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+40 }, :name => "Kristi Himmelfartsdag", :regions => [:dk, :dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :name => "2. Pinsedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :name => "Pinsedag", :regions => [:dk]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-49 }, :function_id => "easter(year)-49", :type => :informal, :name => "Fastelavn", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Palmesøndag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skærtorsdag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Langfredag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Påskedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "2. påskedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+26 }, :function_id => "easter(year)+26", :name => "Store Bededag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+40 }, :function_id => "easter(year)+40", :name => "Kristi Himmelfartsdag", :regions => [:dk, :dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "2. Pinsedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pinsedag", :regions => [:dk]}],
|
||||
11 => [{:mday => 10, :type => :informal, :name => "Mortensaften", :regions => [:dk]}],
|
||||
6 => [{:mday => 5, :name => "Grundlovsdag", :regions => [:dk]},
|
||||
{:mday => 15, :type => :informal, :name => "Valdemarsdag og Genforeningsdag", :regions => [:dk]},
|
||||
|
|
|
@ -18,9 +18,9 @@ module Holidays
|
|||
{:mday => 2, :name => "Fiesta de la Comunidad", :regions => [:es_m]},
|
||||
{:mday => 30, :name => "Día de las Canarias", :regions => [:es_cn]},
|
||||
{:mday => 31, :name => "Día de la Región Castilla-La Mancha", :regions => [:es_cm]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-3 }, :name => "Jueves Santo", :regions => [:es_pv, :es_ct, :es_na, :es_v, :es_vc]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :name => "Viernes Santo", :regions => [:es]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :name => "Lunes de Pascua", :regions => [:es_pv, :es_ct, :es_na, :es_v, :es_vc]}],
|
||||
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]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Viernes Santo", :regions => [:es]},
|
||||
{: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]}],
|
||||
11 => [{:mday => 1, :name => "Todos los Santos", :regions => [:es]}],
|
||||
6 => [{:mday => 9, :name => "Día de la Región de Murcia", :regions => [:es_mu]},
|
||||
{:mday => 9, :name => "Día de La Rioja", :regions => [:es_lo]}],
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module Holidays
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# 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/lv.yaml
|
||||
# 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/lv.yaml, data/pt.yaml, data/se.yaml
|
||||
#
|
||||
# To use the definitions in this file, load them right after you load the
|
||||
# Holiday gem:
|
||||
|
@ -11,7 +11,7 @@ module Holidays
|
|||
#
|
||||
# More definitions are available at http://code.dunae.ca/holidays.
|
||||
module EUROPE # :nodoc:
|
||||
DEFINED_REGIONS = [:dk, :is, :de, :fr, :de_bw, :de_by, :de_nw, :de_rp, :de_sl, :de_he, :de_sn, :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, :it, :nl, :lv]
|
||||
DEFINED_REGIONS = [:dk, :is, :de, :fr, :de_bw, :de_by, :de_nw, :de_rp, :de_sl, :de_he, :de_sn, :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, :it, :nl, :lv, :pt, :se]
|
||||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:mday => 1, :name => "Arbejdernes kampdag", :regions => [:dk]},
|
||||
|
@ -32,51 +32,63 @@ module Holidays
|
|||
{:mday => 4, :name => "Dodenherdenking", :regions => [:nl]},
|
||||
{:mday => 5, :name => "Bevrijdingsdag", :regions => [:nl]},
|
||||
{:mday => 1, :name => "Darba svetki", :regions => [:lv]},
|
||||
{:mday => 4, :name => "Neatkaribas deklaracijas pasludinašanas diena", :regions => [:lv]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-49 }, :type => :informal, :name => "Fastelavn", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-7 }, :name => "Palmesøndag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :name => "Skærtorsdag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :name => "Langfredag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :name => "Påskedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :name => "2. påskedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+26 }, :name => "Store Bededag", :regions => [:dk, :is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+40 }, :name => "Kristi Himmelfartsdag", :regions => [:dk, :dk, :is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :name => "2. Pinsedag", :regions => [:dk, :is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :name => "Pinsedag", :regions => [:dk, :is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :name => "Karfreitag", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :name => "Ostermontag", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :name => "Christi Himmelfahrt", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :name => "Pfingstmontag", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+60 }, :name => "Fronleichnam", :regions => [:de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_sn, :de_th]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :name => "Jueves Santo", :regions => [:es_pv, :es_ct, :es_na, :es_v, :es_vc]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :name => "Viernes Santo", :regions => [:es]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :name => "Lunes de Pascua", :regions => [:es_pv, :es_ct, :es_na, :es_v, :es_vc]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :name => "Pâques", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+40 }, :name => "Ascension", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :name => "Pentecôte", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :name => "Lundi de Pentecôte", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :name => "Good Friday", :regions => [:gb]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :name => "Easter Sunday", :regions => [:gb]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :name => "Easter Monday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir, :ie]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-48 }, :name => "Bolludagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-47 }, :name => "Sprengidagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-46 }, :name => "Öskudagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-7 }, :name => "Pálmasunnudagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :name => "Skírdagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :name => "Föstudaginn langi", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :name => "Páskadagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :name => "Annar í páskum", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :name => "Pasqua", :regions => [:it]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :name => "Lunedì dell'Angelo", :regions => [:it]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :name => "Goede Vrijdag", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :name => "Pasen", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :name => "Pasen", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :name => "Hemelvaartsdag", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :name => "Pinksteren", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :name => "Pinksteren", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :name => "Liela Piektdiena", :regions => [:lv]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :name => "Lieldienas", :regions => [:lv]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :name => "2. Lieldienas", :regions => [:lv]}],
|
||||
{:mday => 4, :name => "Neatkaribas deklaracijas pasludinašanas diena", :regions => [:lv]},
|
||||
{:mday => 1, :name => "Dia do Trabalhador", :regions => [:pt]},
|
||||
{:mday => 1, :name => "Första maj", :regions => [:se]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-49 }, :function_id => "easter(year)-49", :type => :informal, :name => "Fastelavn", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Palmesøndag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skærtorsdag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Langfredag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Påskedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "2. påskedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+26 }, :function_id => "easter(year)+26", :name => "Store Bededag", :regions => [:dk, :is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+40 }, :function_id => "easter(year)+40", :name => "Kristi Himmelfartsdag", :regions => [:dk, :dk, :is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "2. Pinsedag", :regions => [:dk, :is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pinsedag", :regions => [:dk, :is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Karfreitag", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Ostermontag", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Christi Himmelfahrt", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pfingstmontag", :regions => [:de]},
|
||||
{: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]},
|
||||
{: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]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Viernes Santo", :regions => [:es]},
|
||||
{: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]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pâques", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+40 }, :function_id => "easter(year)+40", :name => "Ascension", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pentecôte", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Lundi de Pentecôte", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:gb]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Easter Sunday", :regions => [:gb]},
|
||||
{: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]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-48 }, :function_id => "easter(year)-48", :name => "Bolludagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :name => "Sprengidagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-46 }, :function_id => "easter(year)-46", :name => "Öskudagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Pálmasunnudagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skírdagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Föstudaginn langi", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Páskadagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Annar í páskum", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pasqua", :regions => [:it]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Lunedì dell'Angelo", :regions => [:it]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Goede Vrijdag", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pasen", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Pasen", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Hemelvaartsdag", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pinksteren", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pinksteren", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Liela Piektdiena", :regions => [:lv]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Lieldienas", :regions => [:lv]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "2. Lieldienas", :regions => [:lv]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :type => :informal, :name => "Carnaval", :regions => [:pt]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Sexta-feira Santa", :regions => [:pt]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Páscoa", :regions => [:pt]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+60 }, :function_id => "easter(year)+60", :name => "Corpo de Deus", :regions => [:pt]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Långfredagen", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Påskdagen", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Annandag påsk", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi himmelsfärdsdag", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pingstdagen", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.se_alla_helgons_dag(year) }, :function_id => "se_alla_helgons_dag(year)", :name => "Alla helgons dag", :regions => [:se]}],
|
||||
11 => [{:mday => 10, :type => :informal, :name => "Mortensaften", :regions => [:dk]},
|
||||
{:mday => 1, :name => "Allerheiligen", :regions => [:de_bw, :de_by, :de_nw, :de_rp, :de_sl]},
|
||||
{:mday => 1, :name => "Todos los Santos", :regions => [:es]},
|
||||
|
@ -84,7 +96,8 @@ module Holidays
|
|||
{:mday => 11, :name => "Armistice 1918", :regions => [:fr]},
|
||||
{:mday => 16, :name => "Dagur íslenskrar tungu", :regions => [:is]},
|
||||
{:mday => 1, :name => "Ognissanti", :regions => [:it]},
|
||||
{:mday => 18, :name => "Latvijas Republikas proklamešanas diena", :regions => [:lv]}],
|
||||
{:mday => 18, :name => "Latvijas Republikas proklamešanas diena", :regions => [:lv]},
|
||||
{:mday => 1, :name => "Todos os Santos", :regions => [:pt]}],
|
||||
6 => [{:mday => 5, :name => "Grundlovsdag", :regions => [:dk]},
|
||||
{:mday => 15, :type => :informal, :name => "Valdemarsdag og Genforeningsdag", :regions => [:dk]},
|
||||
{:mday => 23, :type => :informal, :name => "Sankt Hans aften", :regions => [:dk]},
|
||||
|
@ -93,7 +106,10 @@ module Holidays
|
|||
{:wday => 1, :week => 1, :name => "Labour Day/May Day", :regions => [:ie]},
|
||||
{:mday => 2, :name => "Festa della Repubblica", :regions => [:it]},
|
||||
{:mday => 23, :name => "Ligo Diena", :regions => [:lv]},
|
||||
{:mday => 24, :name => "Jani", :regions => [:lv]}],
|
||||
{:mday => 24, :name => "Jani", :regions => [:lv]},
|
||||
{:mday => 10, :name => "Dia de Portugal", :regions => [:pt]},
|
||||
{:mday => 6, :name => "Nationaldagen", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.se_midsommardagen(year) }, :function_id => "se_midsommardagen(year)", :name => "Midsommardagen", :regions => [:se]}],
|
||||
1 => [{:mday => 1, :name => "Nytårsdag", :regions => [:dk]},
|
||||
{:mday => 1, :name => "Neujahrstag", :regions => [:de]},
|
||||
{:mday => 6, :name => "Heilige Drei Könige", :regions => [:de_bw, :de_by]},
|
||||
|
@ -108,7 +124,10 @@ module Holidays
|
|||
{:mday => 1, :name => "Capodanno", :regions => [:it]},
|
||||
{:mday => 6, :name => "Epifania", :regions => [:it]},
|
||||
{:mday => 1, :name => "Nieuwjaar", :regions => [:nl]},
|
||||
{:mday => 1, :name => "Jaunais Gads", :regions => [:lv]}],
|
||||
{:mday => 1, :name => "Jaunais Gads", :regions => [:lv]},
|
||||
{:mday => 1, :name => "Ano Novo", :regions => [:pt]},
|
||||
{:mday => 1, :name => "Nyårsdagen", :regions => [:se]},
|
||||
{:mday => 6, :name => "Trettondedag jul", :regions => [:se]}],
|
||||
12 => [{:mday => 13, :type => :informal, :name => "Sankt Lucia", :regions => [:dk]},
|
||||
{:mday => 24, :name => "Juleaftensdag", :regions => [:dk]},
|
||||
{:mday => 25, :name => "1. juledag", :regions => [:dk]},
|
||||
|
@ -135,7 +154,12 @@ module Holidays
|
|||
{:mday => 26, :name => "Kerstmis", :regions => [:nl]},
|
||||
{:mday => 25, :name => "Ziemassvetki", :regions => [:lv]},
|
||||
{:mday => 25, :name => "2. Ziemassvetki", :regions => [:lv]},
|
||||
{:mday => 31, :name => "Vecgada vakars", :regions => [:lv]}],
|
||||
{:mday => 31, :name => "Vecgada vakars", :regions => [:lv]},
|
||||
{:mday => 1, :name => "Restauração da Independência", :regions => [:pt]},
|
||||
{:mday => 8, :name => "Imaculada Conceição", :regions => [:pt]},
|
||||
{:mday => 25, :name => "Natal", :regions => [:pt]},
|
||||
{:mday => 25, :name => "Juldagen", :regions => [:se]},
|
||||
{:mday => 26, :name => "Annandag jul", :regions => [:se]}],
|
||||
7 => [{:mday => 23, :name => "Santiago Apostol", :regions => [:es_ga]},
|
||||
{:mday => 14, :name => "Fête nationale", :regions => [:fr]},
|
||||
{:mday => 5, :name => "Tynwald Day", :regions => [:im, :gb_iom]},
|
||||
|
@ -149,7 +173,8 @@ module Holidays
|
|||
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb_eng, :gb_wls, :gb_eaw]},
|
||||
{:wday => 1, :week => 1, :name => "August Holiday", :regions => [:ie]},
|
||||
{:wday => 1, :week => 1, :name => "Frídagur verslunarmanna", :regions => [:is]},
|
||||
{:mday => 15, :name => "Assunzione", :regions => [:it]}],
|
||||
{:mday => 15, :name => "Assunzione", :regions => [:it]},
|
||||
{:mday => 15, :name => "Assunção de Nossa Senhora", :regions => [:pt]}],
|
||||
3 => [{:mday => 1, :name => "Día de las Islas Baleares", :regions => [:es_ib]},
|
||||
{:mday => 19, :name => "San José", :regions => [:es_v, :es_vc, :es_cm, :es_mu, :es_m]},
|
||||
{:mday => 5, :name => "St. Piran's Day", :regions => [:gb_con]},
|
||||
|
@ -164,12 +189,14 @@ module Holidays
|
|||
{:mday => 23, :name => "San Jorge", :regions => [:es_ar, :es_cl]},
|
||||
{:mday => 23, :name => "Día de Aragón", :regions => [:es_ar]},
|
||||
{:mday => 25, :name => "Festa della Liberazione", :regions => [:it]},
|
||||
{:mday => 30, :name => "Koninginnedag", :regions => [:nl]}],
|
||||
{:mday => 30, :name => "Koninginnedag", :regions => [:nl]},
|
||||
{:mday => 25, :name => "Dia da Liberdade", :regions => [:pt]}],
|
||||
10 => [{:mday => 3, :name => "Tag der Deutschen Einheit", :regions => [:de]},
|
||||
{:mday => 31, :name => "Reformationstag", :regions => [:de_bb, :de_mv, :de_sn, :de_st, :de_th]},
|
||||
{:mday => 9, :name => "Día de Valencia", :regions => [:es_vc, :es_v]},
|
||||
{:mday => 12, :name => "Día de la Hispanidad", :regions => [:es]},
|
||||
{:wday => 1, :week => -1, :name => "October Holiday", :regions => [:ie]}]
|
||||
{:wday => 1, :week => -1, :name => "October Holiday", :regions => [:ie]},
|
||||
{:mday => 5, :name => "Implantação da República", :regions => [:pt]}]
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -184,6 +211,22 @@ def self.is_sumardagurinn_fyrsti(year)
|
|||
date
|
||||
end
|
||||
|
||||
# The Saturday between Oct 31 and Nov 6.(2007: November 3)
|
||||
def self.se_alla_helgons_dag(year)
|
||||
date = Date.civil(year,10,31)
|
||||
date += (6 - date.wday)
|
||||
date
|
||||
end
|
||||
|
||||
|
||||
# The Saturday between June 20–26. (2007: June 23)
|
||||
def self.se_midsommardagen(year)
|
||||
date = Date.civil(year,6,20)
|
||||
date += (6 - date.wday)
|
||||
date
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -16,10 +16,10 @@ module Holidays
|
|||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:mday => 1, :name => "Fête du travail", :regions => [:fr]},
|
||||
{:mday => 8, :name => "Victoire 1945", :regions => [:fr]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year) }, :name => "Pâques", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+40 }, :name => "Ascension", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :name => "Pentecôte", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :name => "Lundi de Pentecôte", :regions => [:fr]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pâques", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+40 }, :function_id => "easter(year)+40", :name => "Ascension", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pentecôte", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Lundi de Pentecôte", :regions => [:fr]}],
|
||||
11 => [{:mday => 1, :name => "Toussaint", :regions => [:fr]},
|
||||
{:mday => 11, :name => "Armistice 1918", :regions => [:fr]}],
|
||||
1 => [{:mday => 1, :name => "Jour de l'an", :regions => [:fr]}],
|
||||
|
|
|
@ -17,9 +17,9 @@ module Holidays
|
|||
5 => [{:wday => 1, :week => 1, :name => "May Day", :regions => [:gb]},
|
||||
{:mday => 9, :name => "Liberation Day", :regions => [:je, :gb_jsy, :gg, :gb_gsy]},
|
||||
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :name => "Good Friday", :regions => [:gb]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :name => "Easter Sunday", :regions => [:gb]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :name => "Easter Monday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:gb]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Easter Sunday", :regions => [:gb]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Easter Monday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir]}],
|
||||
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:gb]},
|
||||
{:mday => 2, :name => "New Year's", :regions => [:gb_sct]}],
|
||||
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:gb]},
|
||||
|
|
|
@ -15,7 +15,7 @@ module Holidays
|
|||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:wday => 1, :week => 1, :name => "May Day", :regions => [:ie]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)+1 }, :name => "Easter Monday", :regions => [:ie]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Easter Monday", :regions => [:ie]}],
|
||||
6 => [{:wday => 1, :week => 1, :name => "Labour Day/May Day", :regions => [:ie]}],
|
||||
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:ie]}],
|
||||
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:ie]},
|
||||
|
|
|
@ -16,18 +16,18 @@ module Holidays
|
|||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:mday => 3, :type => :informal, :name => "Sjómannadagurinn", :regions => [:is]},
|
||||
{:mday => 17, :name => "Lýðveldisdagurinn", :regions => [:is]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-48 }, :name => "Bolludagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-47 }, :name => "Sprengidagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-46 }, :name => "Öskudagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-7 }, :name => "Pálmasunnudagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :name => "Skírdagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :name => "Föstudaginn langi", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :name => "Páskadagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :name => "Annar í páskum", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+26 }, :name => "Store Bededag", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+40 }, :name => "Kristi Himmelfartsdag", :regions => [:is, :is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :name => "2. Pinsedag", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :name => "Pinsedag", :regions => [:is]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-48 }, :function_id => "easter(year)-48", :name => "Bolludagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :name => "Sprengidagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-46 }, :function_id => "easter(year)-46", :name => "Öskudagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Pálmasunnudagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skírdagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Föstudaginn langi", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Páskadagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Annar í páskum", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+26 }, :function_id => "easter(year)+26", :name => "Store Bededag", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+40 }, :function_id => "easter(year)+40", :name => "Kristi Himmelfartsdag", :regions => [:is, :is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "2. Pinsedag", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pinsedag", :regions => [:is]}],
|
||||
11 => [{:mday => 16, :name => "Dagur íslenskrar tungu", :regions => [:is]}],
|
||||
1 => [{:mday => 1, :name => "Nýársdagur", :regions => [:is]},
|
||||
{:mday => 6, :name => "Þrettándinn", :regions => [:is]},
|
||||
|
|
|
@ -15,8 +15,8 @@ module Holidays
|
|||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:mday => 1, :name => "Festa dei Lavoratori", :regions => [:it]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year) }, :name => "Pasqua", :regions => [:it]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :name => "Lunedì dell'Angelo", :regions => [:it]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pasqua", :regions => [:it]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Lunedì dell'Angelo", :regions => [:it]}],
|
||||
11 => [{:mday => 1, :name => "Ognissanti", :regions => [:it]}],
|
||||
6 => [{:mday => 2, :name => "Festa della Repubblica", :regions => [:it]}],
|
||||
1 => [{:mday => 1, :name => "Capodanno", :regions => [:it]},
|
||||
|
|
|
@ -16,9 +16,9 @@ module Holidays
|
|||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:mday => 1, :name => "Darba svetki", :regions => [:lv]},
|
||||
{:mday => 4, :name => "Neatkaribas deklaracijas pasludinašanas diena", :regions => [:lv]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :name => "Liela Piektdiena", :regions => [:lv]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :name => "Lieldienas", :regions => [:lv]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :name => "2. Lieldienas", :regions => [:lv]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Liela Piektdiena", :regions => [:lv]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Lieldienas", :regions => [:lv]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "2. Lieldienas", :regions => [:lv]}],
|
||||
11 => [{:mday => 18, :name => "Latvijas Republikas proklamešanas diena", :regions => [:lv]}],
|
||||
6 => [{:mday => 23, :name => "Ligo Diena", :regions => [:lv]},
|
||||
{:mday => 24, :name => "Jani", :regions => [:lv]}],
|
||||
|
|
|
@ -11,30 +11,37 @@ module Holidays
|
|||
#
|
||||
# More definitions are available at http://code.dunae.ca/holidays.
|
||||
module MX # :nodoc:
|
||||
DEFINED_REGIONS = [:mx, :us, :ca]
|
||||
DEFINED_REGIONS = [:mx, :mx_pue, :us, :ca]
|
||||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:mday => 1, :name => "D\xC3\xADa del Trabajo", :regions => [:mx]},
|
||||
{:mday => 5, :name => "La Batalla de Puebla", :regions => [:mx]},
|
||||
5 => [{:mday => 1, :name => "Día del Trabajo", :regions => [:mx]},
|
||||
{:mday => 5, :type => :informal, :name => "Cinco de Mayo", :regions => [:mx]},
|
||||
{:mday => 5, :name => "La Batalla de Puebla", :regions => [:mx_pue]},
|
||||
{:mday => 10, :type => :informal, :name => "Día de la Madre", :regions => [:mx]},
|
||||
{:mday => 15, :type => :informal, :name => "Día del Maestro", :regions => [:mx]},
|
||||
{:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-3 }, :name => "Good Thursday", :regions => [:mx]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :name => "Good Friday", :regions => [:mx, :us]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :name => "Easter Sunday", :regions => [:mx]}],
|
||||
11 => [{:mday => 2, :name => "Dia de Muertos", :regions => [:mx]},
|
||||
{:wday => 1, :week => 3, :name => "D\xC3\xADa de la Revoluci\xC3\xB3n", :regions => [:mx]}],
|
||||
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:mx]},
|
||||
{:mday => 2, :name => "New Year's Day", :regions => [:mx]}],
|
||||
12 => [{:mday => 12, :name => "Our Lady of Guadalupe's day", :regions => [:mx]},
|
||||
{:mday => 25, :name => "Christmas Day", :regions => [:mx]}],
|
||||
2 => [{:wday => 1, :week => 1, :name => "D\xC3\xADa de la Constituci\xC3\xB3n", :regions => [:mx]},
|
||||
11 => [{:mday => 1, :type => :informal, :name => "Todos los Santos", :regions => [:mx]},
|
||||
{:mday => 2, :type => :informal, :name => "Los Fieles Difuntos", :regions => [:mx]},
|
||||
{:wday => 1, :week => 3, :name => "Día de la Revolución", :regions => [:mx]}],
|
||||
6 => [{:wday => 0, :week => 3, :type => :informal, :name => "Día del Padre", :regions => [:mx]}],
|
||||
1 => [{:mday => 1, :name => "Año nuevo", :regions => [:mx]},
|
||||
{:mday => 6, :name => "Dia de los Santos Reyes", :regions => [:mx]}],
|
||||
12 => [{:mday => 12, :type => :informal, :name => "Día de la Virgen de Guadalupe", :regions => [:mx]},
|
||||
{:mday => 24, :type => :informal, :name => "Nochebuena", :regions => [:mx]},
|
||||
{:mday => 25, :name => "Navidad", :regions => [:mx]},
|
||||
{:mday => 28, :name => "Los Santos Inocentes", :regions => [:mx]}],
|
||||
2 => [{:wday => 1, :week => 1, :name => "Día de la Constitución", :regions => [:mx]},
|
||||
{:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
|
||||
{:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
|
||||
3 => [{:wday => 1, :week => 3, :name => "Natalicio de Benito Ju\xC3\xA1rez", :regions => [:mx]},
|
||||
3 => [{:wday => 1, :week => 3, :name => "Natalicio de Benito Juárez", :regions => [:mx]},
|
||||
{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
|
||||
9 => [{:mday => 16, :name => "D\xC3\xADa de Independencia", :regions => [:mx]}],
|
||||
4 => [{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
|
||||
9 => [{:mday => 15, :name => "Grito de Dolores", :regions => [:mx]},
|
||||
{:mday => 16, :name => "Día de la Independencia", :regions => [:mx]}],
|
||||
4 => [{:mday => 30, :type => :informal, :name => "Día del Niño", :regions => [:mx]},
|
||||
{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
|
||||
{:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}],
|
||||
10 => [{:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}]
|
||||
10 => [{:mday => 12, :type => :informal, :name => "Día de la Raza", :regions => [:mx]},
|
||||
{:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}]
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -16,12 +16,12 @@ module Holidays
|
|||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:mday => 4, :name => "Dodenherdenking", :regions => [:nl]},
|
||||
{:mday => 5, :name => "Bevrijdingsdag", :regions => [:nl]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :name => "Goede Vrijdag", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :name => "Pasen", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :name => "Pasen", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :name => "Hemelvaartsdag", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :name => "Pinksteren", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :name => "Pinksteren", :regions => [:nl]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Goede Vrijdag", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pasen", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Pasen", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Hemelvaartsdag", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pinksteren", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pinksteren", :regions => [:nl]}],
|
||||
1 => [{:mday => 1, :name => "Nieuwjaar", :regions => [:nl]}],
|
||||
12 => [{:mday => 5, :type => :informal, :name => "Sinterklaas", :regions => [:nl]},
|
||||
{:mday => 25, :name => "Kerstmis", :regions => [:nl]},
|
||||
|
|
|
@ -11,35 +11,42 @@ module Holidays
|
|||
#
|
||||
# More definitions are available at http://code.dunae.ca/holidays.
|
||||
module NORTH_AMERICA # :nodoc:
|
||||
DEFINED_REGIONS = [:ca, :ca_qc, :us, :mx, :ca_nf, :ca_nt, :ca_nu, :ca_ab, :ca_on, :ca_sk, :ca_mb, :ca_bc, :ca_ns, :ca_yk]
|
||||
DEFINED_REGIONS = [:ca, :ca_qc, :us, :ca_nf, :ca_nt, :ca_nu, :ca_ab, :ca_on, :ca_sk, :ca_mb, :ca_bc, :ca_ns, :ca_yk, :mx, :mx_pue, :us_dc]
|
||||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:function => lambda { |year| Holidays.ca_victoria_day(year) }, :name => "Victoria Day", :regions => [:ca]},
|
||||
{:function => lambda { |year| Holidays.ca_victoria_day(year) }, :name => "National Patriotes Day", :regions => [:ca_qc]},
|
||||
5 => [{:function => lambda { |year| Holidays.ca_victoria_day(year) }, :function_id => "ca_victoria_day(year)", :name => "Victoria Day", :regions => [:ca]},
|
||||
{:function => lambda { |year| Holidays.ca_victoria_day(year) }, :function_id => "ca_victoria_day(year)", :name => "National Patriotes Day", :regions => [:ca_qc]},
|
||||
{:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]},
|
||||
{:mday => 1, :name => "D\xC3\xADa del Trabajo", :regions => [:mx]},
|
||||
{:mday => 5, :name => "La Batalla de Puebla", :regions => [:mx]},
|
||||
{:mday => 1, :name => "Día del Trabajo", :regions => [:mx]},
|
||||
{:mday => 5, :type => :informal, :name => "Cinco de Mayo", :regions => [:mx]},
|
||||
{:mday => 5, :name => "La Batalla de Puebla", :regions => [:mx_pue]},
|
||||
{:mday => 10, :type => :informal, :name => "Día de la Madre", :regions => [:mx]},
|
||||
{:mday => 15, :type => :informal, :name => "Día del Maestro", :regions => [:mx]},
|
||||
{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:us]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :name => "Good Friday", :regions => [:ca, :us, :mx]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :name => "Easter Monday", :regions => [:ca_qc]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :name => "Good Thursday", :regions => [:mx]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :name => "Easter Sunday", :regions => [:mx]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:ca, :us]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :type => :informal, :name => "Easter Monday", :regions => [:ca]}],
|
||||
11 => [{:mday => 11, :name => "Rememberance Day", :regions => [:ca]},
|
||||
{:mday => 2, :name => "Dia de Muertos", :regions => [:mx]},
|
||||
{:wday => 1, :week => 3, :name => "D\xC3\xADa de la Revoluci\xC3\xB3n", :regions => [:mx]},
|
||||
{:mday => 1, :type => :informal, :name => "Todos los Santos", :regions => [:mx]},
|
||||
{:mday => 2, :type => :informal, :name => "Los Fieles Difuntos", :regions => [:mx]},
|
||||
{:wday => 1, :week => 3, :name => "Día de la Revolución", :regions => [:mx]},
|
||||
{:mday => 11, :name => "Veterans Day", :regions => [:us]},
|
||||
{:wday => 4, :week => 4, :name => "Thanksgiving Day", :regions => [:us]}],
|
||||
{:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:us]}],
|
||||
6 => [{:mday => 24, :name => "Discovery Day", :regions => [:ca_nf]},
|
||||
{:mday => 24, :name => "Fête Nationale", :regions => [:ca_qc]},
|
||||
{:mday => 21, :name => "National Aboriginal Day", :regions => [:ca_nt]}],
|
||||
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:ca, :mx, :us]},
|
||||
{:mday => 21, :name => "National Aboriginal Day", :regions => [:ca_nt]},
|
||||
{:wday => 0, :week => 3, :type => :informal, :name => "Día del Padre", :regions => [:mx]}],
|
||||
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:ca, :us]},
|
||||
{:mday => 2, :name => "New Year's", :regions => [:ca_qc]},
|
||||
{:mday => 2, :name => "New Year's Day", :regions => [:mx]},
|
||||
{:mday => 1, :name => "Año nuevo", :regions => [:mx]},
|
||||
{:mday => 6, :name => "Dia de los Santos Reyes", :regions => [:mx]},
|
||||
{:wday => 1, :week => 3, :name => "Martin Luther King, Jr. Day", :regions => [:us]},
|
||||
{:function => lambda { |year| Holidays.us_inauguration_day(year) }, :name => "Inauguration Day", :regions => [:us]}],
|
||||
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:ca, :mx, :us]},
|
||||
{:function => lambda { |year| Holidays.us_inauguration_day(year) }, :function_id => "us_inauguration_day(year)", :name => "Inauguration Day", :regions => [:us_dc]}],
|
||||
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:ca, :us]},
|
||||
{:mday => 26, :name => "Boxing Day", :regions => [:ca]},
|
||||
{:mday => 12, :name => "Our Lady of Guadalupe's day", :regions => [:mx]}],
|
||||
{:mday => 12, :type => :informal, :name => "Día de la Virgen de Guadalupe", :regions => [:mx]},
|
||||
{:mday => 24, :type => :informal, :name => "Nochebuena", :regions => [:mx]},
|
||||
{:mday => 25, :name => "Navidad", :regions => [:mx]},
|
||||
{:mday => 28, :name => "Los Santos Inocentes", :regions => [:mx]}],
|
||||
7 => [{:mday => 1, :name => "Canada Day", :regions => [:ca]},
|
||||
{:mday => 12, :name => "Orangemen's Day", :regions => [:ca_nf]},
|
||||
{:mday => 9, :name => "Nunavut Day", :regions => [:ca_nu]},
|
||||
|
@ -48,7 +55,8 @@ module Holidays
|
|||
{:wday => 1, :week => 3, :name => "Louis Riel Day", :regions => [:ca_mb]},
|
||||
{:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
|
||||
{:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]},
|
||||
{:wday => 1, :week => 1, :name => "D\xC3\xADa de la Constituci\xC3\xB3n", :regions => [:mx]}],
|
||||
{:wday => 1, :week => 1, :name => "Día de la Constitución", :regions => [:mx]},
|
||||
{:wday => 1, :week => 3, :name => "Presidents' Day", :regions => [:us]}],
|
||||
8 => [{:wday => 1, :week => 1, :name => "BC Day", :regions => [:ca_bc]},
|
||||
{:wday => 1, :week => 1, :name => "Saskatchewan Day", :regions => [:ca_sk]},
|
||||
{:wday => 1, :week => 1, :name => "Heritage Day", :regions => [:ca_ab]},
|
||||
|
@ -57,15 +65,17 @@ module Holidays
|
|||
{:wday => 1, :week => 3, :name => "Discovery Day", :regions => [:ca_yk]}],
|
||||
3 => [{:mday => 23, :name => "St. George's Day", :regions => [:ca_nf]},
|
||||
{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]},
|
||||
{:wday => 1, :week => 3, :name => "Natalicio de Benito Ju\xC3\xA1rez", :regions => [:mx]},
|
||||
{:wday => 1, :week => 3, :name => "Presidents' Day", :regions => [:us]}],
|
||||
{:wday => 1, :week => 3, :name => "Natalicio de Benito Juárez", :regions => [:mx]}],
|
||||
9 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:ca]},
|
||||
{:mday => 16, :name => "D\xC3\xADa de Independencia", :regions => [:mx]},
|
||||
{:mday => 15, :name => "Grito de Dolores", :regions => [:mx]},
|
||||
{:mday => 16, :name => "Día de la Independencia", :regions => [:mx]},
|
||||
{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:us]}],
|
||||
4 => [{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
|
||||
{:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}],
|
||||
{:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]},
|
||||
{:mday => 30, :type => :informal, :name => "Día del Niño", :regions => [:mx]}],
|
||||
10 => [{:wday => 1, :week => 2, :name => "Thanksgiving", :regions => [:ca]},
|
||||
{:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]},
|
||||
{:mday => 12, :type => :informal, :name => "Día de la Raza", :regions => [:mx]},
|
||||
{:wday => 1, :week => 2, :name => "Columbus Day", :regions => [:us]}]
|
||||
}
|
||||
end
|
||||
|
|
|
@ -18,24 +18,24 @@ module Holidays
|
|||
{:mday => 5, :type => :informal, :name => "Danmarks befrielse", :regions => [:dk]},
|
||||
{:mday => 3, :type => :informal, :name => "Sjómannadagurinn", :regions => [:is]},
|
||||
{:mday => 17, :name => "Lýðveldisdagurinn", :regions => [:is]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-49 }, :type => :informal, :name => "Fastelavn", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-7 }, :name => "Palmesøndag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :name => "Skærtorsdag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :name => "Langfredag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :name => "Påskedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :name => "2. påskedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+26 }, :name => "Store Bededag", :regions => [:dk, :is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+40 }, :name => "Kristi Himmelfartsdag", :regions => [:dk, :dk, :is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :name => "2. Pinsedag", :regions => [:dk, :is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :name => "Pinsedag", :regions => [:dk, :is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-48 }, :name => "Bolludagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-47 }, :name => "Sprengidagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-46 }, :name => "Öskudagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-7 }, :name => "Pálmasunnudagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :name => "Skírdagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :name => "Föstudaginn langi", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :name => "Páskadagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :name => "Annar í páskum", :regions => [:is]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-49 }, :function_id => "easter(year)-49", :type => :informal, :name => "Fastelavn", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Palmesøndag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skærtorsdag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Langfredag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Påskedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "2. påskedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+26 }, :function_id => "easter(year)+26", :name => "Store Bededag", :regions => [:dk, :is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+40 }, :function_id => "easter(year)+40", :name => "Kristi Himmelfartsdag", :regions => [:dk, :dk, :is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "2. Pinsedag", :regions => [:dk, :is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pinsedag", :regions => [:dk, :is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-48 }, :function_id => "easter(year)-48", :name => "Bolludagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :name => "Sprengidagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-46 }, :function_id => "easter(year)-46", :name => "Öskudagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Pálmasunnudagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skírdagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Föstudaginn langi", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Páskadagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Annar í páskum", :regions => [:is]}],
|
||||
11 => [{:mday => 10, :type => :informal, :name => "Mortensaften", :regions => [:dk]},
|
||||
{:mday => 16, :name => "Dagur íslenskrar tungu", :regions => [:is]}],
|
||||
6 => [{:mday => 5, :name => "Grundlovsdag", :regions => [:dk]},
|
||||
|
|
|
@ -11,23 +11,23 @@ module Holidays
|
|||
#
|
||||
# More definitions are available at http://code.dunae.ca/holidays.
|
||||
module US # :nodoc:
|
||||
DEFINED_REGIONS = [:us, :ca]
|
||||
DEFINED_REGIONS = [:us, :us_dc, :ca]
|
||||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:us]},
|
||||
{:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :type => :informal, :name => "Good Friday", :regions => [:us]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :type => :informal, :name => "Good Friday", :regions => [:us]}],
|
||||
11 => [{:mday => 11, :name => "Veterans Day", :regions => [:us]},
|
||||
{:wday => 4, :week => 4, :name => "Thanksgiving Day", :regions => [:us]}],
|
||||
{:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:us]}],
|
||||
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:us]},
|
||||
{:wday => 1, :week => 3, :name => "Martin Luther King, Jr. Day", :regions => [:us]},
|
||||
{:function => lambda { |year| Holidays.us_inauguration_day(year) }, :name => "Inauguration Day", :regions => [:us]}],
|
||||
{:function => lambda { |year| Holidays.us_inauguration_day(year) }, :function_id => "us_inauguration_day(year)", :name => "Inauguration Day", :regions => [:us_dc]}],
|
||||
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:us]}],
|
||||
7 => [{:mday => 4, :name => "Independence Day", :regions => [:us]}],
|
||||
2 => [{:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
|
||||
2 => [{:wday => 1, :week => 3, :name => "Presidents' Day", :regions => [:us]},
|
||||
{:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
|
||||
{:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
|
||||
3 => [{:wday => 1, :week => 3, :name => "Presidents' Day", :regions => [:us]},
|
||||
{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
|
||||
3 => [{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
|
||||
9 => [{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:us]}],
|
||||
4 => [{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
|
||||
{:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}],
|
||||
|
|
|
@ -15,8 +15,8 @@ module Holidays
|
|||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:mday => 1, :name => "Workers' Day", :regions => [:za]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :name => "Good Friday", :regions => [:za]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :name => "Family Day", :regions => [:za]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:za]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Family Day", :regions => [:za]}],
|
||||
6 => [{:mday => 16, :name => "Youth Day", :regions => [:za]}],
|
||||
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:za]}],
|
||||
12 => [{:mday => 16, :name => "Day of Reconciliation", :regions => [:za]},
|
||||
|
|
20
rakefile.rb
20
rakefile.rb
|
@ -20,6 +20,8 @@ def_list = {
|
|||
:lv => ['data/lv.yaml'],
|
||||
:mx => ['data/mx.yaml', 'data/north_america_informal.yaml'],
|
||||
:nl => ['data/nl.yaml'],
|
||||
:pt => ['data/pt.yaml'],
|
||||
:se => ['data/se.yaml'],
|
||||
:us => ['data/us.yaml', 'data/north_america_informal.yaml'],
|
||||
:united_nations => ['data/united_nations.yaml'],
|
||||
:za => ['data/za.yaml']
|
||||
|
@ -29,7 +31,7 @@ def_list[:north_america] = def_list[:ca] | def_list[:mx] | def_list[:us]
|
|||
|
||||
def_list[:scandinavia] = def_list[:dk] | def_list[:is]
|
||||
|
||||
def_list[:europe] = def_list[:dk] | def_list[:de] | def_list[:es] | def_list[:fr] | def_list[:gb] | def_list[:ie] | def_list[:is] | def_list[:it] |def_list[:nl] |def_list[:lv]
|
||||
def_list[:europe] = def_list[:dk] | def_list[:de] | def_list[:es] | def_list[:fr] | def_list[:gb] | def_list[:ie] | def_list[:is] | def_list[:it] | def_list[:nl] | def_list[:lv] | def_list[:pt] | def_list[:se]
|
||||
|
||||
|
||||
desc 'Run the unit tests.'
|
||||
|
@ -54,6 +56,22 @@ namespace 'definitions' do
|
|||
end
|
||||
end
|
||||
|
||||
namespace 'definitions' do
|
||||
task :nl do
|
||||
region = :nl
|
||||
files = def_list[region]
|
||||
#def_list.each do |region, files|
|
||||
puts "Building #{region.to_s.upcase} definition module:"
|
||||
files.uniq!
|
||||
parsed = parse_holiday_defs(region.to_s.upcase, files)
|
||||
File.open("lib/holidays/#{region.to_s}.rb","w") do |file|
|
||||
file.puts parsed
|
||||
end
|
||||
puts "Done.\n\n"
|
||||
#end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
task :manifest do
|
||||
File.open("lib/holidays/MANIFEST","w") do |file|
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
require File.dirname(__FILE__) + '/test_helper'
|
||||
|
||||
require 'holidays/ca'
|
||||
|
||||
# Re-include CA defs via holidays/north_america to ensure that individual
|
||||
# defs aren't duplicated.
|
||||
require 'holidays/north_america'
|
||||
|
||||
class HolidaysTests < Test::Unit::TestCase
|
||||
def setup
|
||||
@date = Date.civil(2008,1,1)
|
||||
|
|
|
@ -2,7 +2,6 @@ require File.dirname(__FILE__) + '/test_helper'
|
|||
require 'holidays/gb'
|
||||
require 'holidays/ie'
|
||||
|
||||
|
||||
class MultipleRegionsTests < Test::Unit::TestCase
|
||||
def setup
|
||||
@date = Date.civil(2008,1,1)
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
require File.dirname(__FILE__) + '/test_helper'
|
||||
|
||||
class CATests < Test::Unit::TestCase
|
||||
def test_ca_victoria_day
|
||||
[Date.civil(2004,5,24), Date.civil(2005,5,23), Date.civil(2006,5,22),
|
||||
Date.civil(2007,5,21), Date.civil(2008,5,19)].each do |date|
|
||||
assert_equal 'Victoria Day', Holidays.on(date, :ca)[0][:name]
|
||||
end
|
||||
end
|
||||
end
|
89
test/test_region_europe.rb
Normal file
89
test/test_region_europe.rb
Normal file
|
@ -0,0 +1,89 @@
|
|||
require File.dirname(__FILE__) + '/test_helper'
|
||||
require 'holidays/europe'
|
||||
|
||||
class RegionTests < Test::Unit::TestCase
|
||||
def test_nl
|
||||
{Date.civil(2008,1,1) => 'Nieuwjaar',
|
||||
Date.civil(2008,3,21) => 'Goede Vrijdag',
|
||||
Date.civil(2008,3,23) => 'Pasen',
|
||||
Date.civil(2008,3,24) => 'Pasen',
|
||||
Date.civil(2008,4,30) => 'Koninginnedag',
|
||||
Date.civil(2008,5,1) => 'Hemelvaartsdag', # Ascension, Easter+39
|
||||
Date.civil(2008,5,5) => 'Bevrijdingsdag',
|
||||
Date.civil(2008,5,11) => 'Pinksteren', # Pentecost, Easter+49
|
||||
Date.civil(2008,5,12) => 'Pinksteren', # Pentecost, Easter+50
|
||||
Date.civil(2008,12,25) => 'Kerstmis',
|
||||
Date.civil(2008,12,26) => 'Kerstmis'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :nl)[0][:name]
|
||||
end
|
||||
end
|
||||
|
||||
def test_pt
|
||||
{Date.civil(2008,1,1) => 'Ano Novo',
|
||||
Date.civil(2005,2,8) => 'Carnaval',
|
||||
Date.civil(2006,2,28) => 'Carnaval',
|
||||
Date.civil(2007,2,20) => 'Carnaval',
|
||||
Date.civil(2008,2,5) => 'Carnaval',
|
||||
Date.civil(2008,3,21) => 'Sexta-feira Santa',
|
||||
Date.civil(2008,3,23) => 'Páscoa',
|
||||
Date.civil(2008,4,25) => 'Dia da Liberdade',
|
||||
Date.civil(2008,5,1) => 'Dia do Trabalhador',
|
||||
Date.civil(2005,5,26) => 'Corpo de Deus',
|
||||
Date.civil(2007,6,7) => 'Corpo de Deus',
|
||||
Date.civil(2008,5,22) => 'Corpo de Deus',
|
||||
Date.civil(2008,6,10) => 'Dia de Portugal',
|
||||
Date.civil(2008,8,15) => 'Assunção de Nossa Senhora',
|
||||
Date.civil(2008,10,5) => 'Implantação da República',
|
||||
Date.civil(2008,11,1) => 'Todos os Santos',
|
||||
Date.civil(2008,12,1) => 'Restauração da Independência',
|
||||
Date.civil(2008,12,8) => 'Imaculada Conceição',
|
||||
Date.civil(2008,12,25) => 'Natal'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :pt)[0][:name]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def test_it
|
||||
{Date.civil(2007,1,1) => 'Capodanno',
|
||||
Date.civil(2007,1,6) => 'Epifania',
|
||||
Date.civil(2007,4,8) => 'Pasqua',
|
||||
Date.civil(2007,4,9) => 'Lunedì dell\'Angelo',
|
||||
Date.civil(2007,4,25) => 'Festa della Liberazione',
|
||||
Date.civil(2007,5,1) => 'Festa dei Lavoratori',
|
||||
Date.civil(2007,6,2) => 'Festa della Repubblica',
|
||||
Date.civil(2007,8,15) => 'Assunzione',
|
||||
Date.civil(2007,11,1) => 'Ognissanti',
|
||||
Date.civil(2007,12,8) => 'Immacolata Concezione',
|
||||
Date.civil(2007,12,25) => 'Natale',
|
||||
Date.civil(2007,12,26) => 'Santo Stefano'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :it)[0][:name]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def test_se
|
||||
{Date.civil(2008,1,1) => 'Nyårsdagen',
|
||||
Date.civil(2008,1,6) => 'Trettondedag jul',
|
||||
Date.civil(2008,3,21) => 'Långfredagen',
|
||||
Date.civil(2008,3,23) => 'Påskdagen',
|
||||
Date.civil(2008,3,24) => 'Annandag påsk',
|
||||
Date.civil(2008,5,1) => 'Första maj',
|
||||
Date.civil(2008,5,1) => 'Kristi himmelsfärdsdag',
|
||||
Date.civil(2008,5,11) => 'Pingstdagen',
|
||||
Date.civil(2008,6,6) => 'Nationaldagen',
|
||||
Date.civil(2005,6,25) => 'Midsommardagen',
|
||||
Date.civil(2006,6,24) => 'Midsommardagen',
|
||||
Date.civil(2007,6,23) => 'Midsommardagen',
|
||||
Date.civil(2008,6,21) => 'Midsommardagen',
|
||||
Date.civil(2005,11,5) => 'Alla helgons dag',
|
||||
Date.civil(2006,11,4) => 'Alla helgons dag',
|
||||
Date.civil(2007,11,3) => 'Alla helgons dag',
|
||||
Date.civil(2008,11,1) => 'Alla helgons dag',
|
||||
Date.civil(2008,12,25) => 'Juldagen',
|
||||
Date.civil(2008,12,26) => 'Annandag jul'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :se)[0][:name]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
|
@ -1,53 +0,0 @@
|
|||
require File.dirname(__FILE__) + '/test_helper'
|
||||
require 'holidays/europe'
|
||||
|
||||
class RegionTests < Test::Unit::TestCase
|
||||
|
||||
|
||||
# ==== Netherlands
|
||||
# New Year's Day 1 January
|
||||
# Good Friday 21 March
|
||||
# Easter Sunday 23 March
|
||||
# Easter Monday 24 March
|
||||
# Queen's Birthday 30 April
|
||||
# Ascension Day 1 May
|
||||
# Liberation Day 5 May
|
||||
# Whit Sunday 11 May
|
||||
# Whit Monday 12 May
|
||||
# Christmas Day 25 December
|
||||
# Boxing Day 26 December
|
||||
def test_nl
|
||||
{Date.civil(2008,1,1) => 'Nieuwjaar',
|
||||
Date.civil(2008,3,21) => 'Goede Vrijdag',
|
||||
Date.civil(2008,3,23) => 'Pasen',
|
||||
Date.civil(2008,3,24) => 'Pasen',
|
||||
Date.civil(2008,4,30) => 'Koninginnedag',
|
||||
Date.civil(2008,5,1) => 'Hemelvaartsdag', # Ascension, Easter+39
|
||||
Date.civil(2008,5,5) => 'Bevrijdingsdag',
|
||||
Date.civil(2008,5,11) => 'Pinksteren', # Pentecost, Easter+49
|
||||
Date.civil(2008,5,12) => 'Pinksteren', # Pentecost, Easter+50
|
||||
Date.civil(2008,12,25) => 'Kerstmis',
|
||||
Date.civil(2008,12,26) => 'Kerstmis'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :nl)[0][:name]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def test_it
|
||||
{Date.civil(2007,1,1) => 'Capodanno',
|
||||
Date.civil(2007,1,6) => 'Epifania',
|
||||
Date.civil(2007,4,8) => 'Pasqua',
|
||||
Date.civil(2007,4,9) => 'Lunedì dell\'Angelo',
|
||||
Date.civil(2007,4,25) => 'Festa della Liberazione',
|
||||
Date.civil(2007,5,1) => 'Festa dei Lavoratori',
|
||||
Date.civil(2007,6,2) => 'Festa della Repubblica',
|
||||
Date.civil(2007,8,15) => 'Assunzione',
|
||||
Date.civil(2007,11,1) => 'Ognissanti',
|
||||
Date.civil(2007,12,8) => 'Immacolata Concezione',
|
||||
Date.civil(2007,12,25) => 'Natale',
|
||||
Date.civil(2007,12,26) => 'Santo Stefano'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :it)[0][:name]
|
||||
end
|
||||
end
|
||||
|
||||
end
|
65
test/test_regions_north_america.rb
Normal file
65
test/test_regions_north_america.rb
Normal file
|
@ -0,0 +1,65 @@
|
|||
require File.dirname(__FILE__) + '/test_helper'
|
||||
|
||||
require 'holidays/north_america'
|
||||
|
||||
class North_AmericaTests < Test::Unit::TestCase
|
||||
|
||||
def test_ca
|
||||
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
||||
Date.civil(2008,3,21) => 'Good Friday',
|
||||
Date.civil(2008,3,24) => 'Easter Monday',
|
||||
Date.civil(2008,5,19) => 'Victoria Day',
|
||||
Date.civil(2008,7,1) => 'Canada Day',
|
||||
Date.civil(2008,9,1) => 'Labour Day',
|
||||
Date.civil(2008,10,13) => 'Thanksgiving',
|
||||
Date.civil(2008,11,11) => 'Rememberance Day',
|
||||
Date.civil(2008,12,25) => 'Christmas Day',
|
||||
Date.civil(2008,12,26) => 'Boxing Day'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :ca)[0][:name]
|
||||
end
|
||||
end
|
||||
|
||||
def test_ca_victoria_day
|
||||
[Date.civil(2004,5,24), Date.civil(2005,5,23), Date.civil(2006,5,22),
|
||||
Date.civil(2007,5,21), Date.civil(2008,5,19)].each do |date|
|
||||
assert_equal 'Victoria Day', Holidays.on(date, :ca)[0][:name]
|
||||
end
|
||||
end
|
||||
|
||||
# from
|
||||
# - http://www.britishembassy.gov.uk/servlet/Front?pagename=OpenMarket/Xcelerate/ShowPage&c=Page&cid=1125561634963
|
||||
# - http://www.usembassy-mexico.gov/eng/holidays.html
|
||||
def test_mx
|
||||
{Date.civil(2007,1,1) => 'Año nuevo',
|
||||
Date.civil(2007,2,5) => 'Día de la Constitución',
|
||||
Date.civil(2007,5,1) => 'Día del Trabajo',
|
||||
Date.civil(2007,5,5) => 'Cinco de Mayo',
|
||||
Date.civil(2007,9,16) => 'Día de la Independencia',
|
||||
Date.civil(2007,11,1) => 'Todos los Santos',
|
||||
Date.civil(2007,11,2) => 'Los Fieles Difuntos',
|
||||
Date.civil(2007,11,19) => 'Día de la Revolución',
|
||||
Date.civil(2007,12,25) => 'Navidad'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :mx)[0][:name]
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
def test_us
|
||||
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
||||
Date.civil(2008,1,21) => 'Martin Luther King, Jr. Day',
|
||||
Date.civil(2008,2,18) => 'Presidents\' Day',
|
||||
Date.civil(2008,5,26) => 'Memorial Day',
|
||||
Date.civil(2008,7,4) => 'Independence Day',
|
||||
Date.civil(2008,9,1) => 'Labor Day',
|
||||
Date.civil(2008,10,13) => 'Columbus Day',
|
||||
Date.civil(2008,11,11) => 'Veterans Day',
|
||||
Date.civil(2008,11,27) => 'Thanksgiving',
|
||||
Date.civil(2008,12,25) => 'Christmas Day'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :us)[0][:name]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
Loading…
Reference in a new issue