GB and SE test cases
This commit is contained in:
parent
e036b8e50e
commit
c75146cdb5
13 changed files with 230 additions and 102 deletions
13
data/gb.yaml
13
data/gb.yaml
|
@ -3,11 +3,13 @@
|
||||||
# Including England, Wales, Scotland, N. Ireland, the Isle of Man, Guernsey
|
# Including England, Wales, Scotland, N. Ireland, the Isle of Man, Guernsey
|
||||||
# and Jersey.
|
# and Jersey.
|
||||||
#
|
#
|
||||||
# Updated: 2008-11-22.
|
# Updated: 2008-11-28.
|
||||||
# Source: http://en.wikipedia.org/wiki/List_of_holidays_by_country#United_Kingdom_and_Crown_dependencies
|
# Sources:
|
||||||
|
# - http://en.wikipedia.org/wiki/List_of_holidays_by_country#United_Kingdom_and_Crown_dependencies
|
||||||
#
|
#
|
||||||
# Notes:
|
# Notes:
|
||||||
# - Jersey, Guernsey and the Isle of Man are encode with both their ISO 3166-1 and ISO 3-3166-2 codes.
|
# - Jersey, Guernsey and the Isle of Man are encode with both their ISO 3166-1 and ISO 3-3166-2 codes.
|
||||||
|
# - England and Wales together should be encoded as [gb_eng, gb_wls, gb_eaw...]
|
||||||
---
|
---
|
||||||
months:
|
months:
|
||||||
0:
|
0:
|
||||||
|
@ -59,9 +61,14 @@ months:
|
||||||
week: 1
|
week: 1
|
||||||
wday: 1
|
wday: 1
|
||||||
- name: Bank Holiday
|
- name: Bank Holiday
|
||||||
regions: [gb_eng, gb_wls, gb_eaw]
|
regions: [gb_eng, gb_wls, gb_eaw, gb_nir]
|
||||||
week: -1
|
week: -1
|
||||||
wday: 1
|
wday: 1
|
||||||
|
11:
|
||||||
|
- name: Guy Fawkes Day
|
||||||
|
regions: [gb]
|
||||||
|
mday: 5
|
||||||
|
type: informal
|
||||||
12:
|
12:
|
||||||
- name: Christmas Day
|
- name: Christmas Day
|
||||||
regions: [gb]
|
regions: [gb]
|
||||||
|
|
12
data/ie.yaml
12
data/ie.yaml
|
@ -1,7 +1,9 @@
|
||||||
# Ireland holiday definitions for the Ruby Holiday gem.
|
# Ireland holiday definitions for the Ruby Holiday gem.
|
||||||
#
|
#
|
||||||
# Updated: 2008-11-22.
|
# Updated: 2008-11-28.
|
||||||
# Source: http://en.wikipedia.org/wiki/Public_holidays_in_the_Republic_of_Ireland
|
# Sources:
|
||||||
|
# - http://en.wikipedia.org/wiki/Public_holidays_in_the_Republic_of_Ireland
|
||||||
|
# - http://www.citizensinformation.ie/categories/employment/employment-rights-and-conditions/leave-and-holidays/public-holidays-in-ireland
|
||||||
---
|
---
|
||||||
months:
|
months:
|
||||||
0:
|
0:
|
||||||
|
@ -22,17 +24,17 @@ months:
|
||||||
week: 1
|
week: 1
|
||||||
wday: 1
|
wday: 1
|
||||||
6:
|
6:
|
||||||
- name: Labour Day/May Day
|
- name: Bank Holiday
|
||||||
regions: [ie]
|
regions: [ie]
|
||||||
week: 1
|
week: 1
|
||||||
wday: 1
|
wday: 1
|
||||||
8:
|
8:
|
||||||
- name: August Holiday
|
- name: Bank Holiday
|
||||||
regions: [ie]
|
regions: [ie]
|
||||||
week: 1
|
week: 1
|
||||||
wday: 1
|
wday: 1
|
||||||
10:
|
10:
|
||||||
- name: October Holiday
|
- name: Bank Holiday
|
||||||
regions: [ie]
|
regions: [ie]
|
||||||
week: -1
|
week: -1
|
||||||
wday: 1
|
wday: 1
|
||||||
|
|
|
@ -54,14 +54,14 @@ months:
|
||||||
mday: 26
|
mday: 26
|
||||||
methods:
|
methods:
|
||||||
se_midsommardagen: |
|
se_midsommardagen: |
|
||||||
# The Saturday between June 20–26. (2007: June 23)
|
# Sweden: Mid-summer (Saturday between June 20–26)
|
||||||
def self.se_midsommardagen(year)
|
def self.se_midsommardagen(year)
|
||||||
date = Date.civil(year,6,20)
|
date = Date.civil(year,6,20)
|
||||||
date += (6 - date.wday)
|
date += (6 - date.wday)
|
||||||
date
|
date
|
||||||
end
|
end
|
||||||
se_alla_helgons_dag: |
|
se_alla_helgons_dag: |
|
||||||
# The Saturday between Oct 31 and Nov 6.(2007: November 3)
|
# Sweden: All Saint's Day (Saturday between Oct 31 and Nov 6)
|
||||||
def self.se_alla_helgons_dag(year)
|
def self.se_alla_helgons_dag(year)
|
||||||
date = Date.civil(year,10,31)
|
date = Date.civil(year,10,31)
|
||||||
date += (6 - date.wday)
|
date += (6 - date.wday)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
module Holidays
|
module Holidays
|
||||||
# This file is generated by the Ruby Holiday gem.
|
# 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, data/pt.yaml, data/se.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/pt.yaml, data/se.yaml
|
||||||
#
|
#
|
||||||
# To use the definitions in this file, load them right after you load the
|
# To use the definitions in this file, load them right after you load the
|
||||||
# Holiday gem:
|
# Holiday gem:
|
||||||
|
@ -11,7 +11,7 @@ module Holidays
|
||||||
#
|
#
|
||||||
# More definitions are available at http://code.dunae.ca/holidays.
|
# More definitions are available at http://code.dunae.ca/holidays.
|
||||||
module EUROPE # :nodoc:
|
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, :pt, :se]
|
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, :pt, :se]
|
||||||
|
|
||||||
HOLIDAYS_BY_MONTH = {
|
HOLIDAYS_BY_MONTH = {
|
||||||
5 => [{:mday => 1, :name => "Arbejdernes kampdag", :regions => [:dk]},
|
5 => [{:mday => 1, :name => "Arbejdernes kampdag", :regions => [:dk]},
|
||||||
|
@ -31,8 +31,6 @@ module Holidays
|
||||||
{:mday => 1, :name => "Festa dei Lavoratori", :regions => [:it]},
|
{:mday => 1, :name => "Festa dei Lavoratori", :regions => [:it]},
|
||||||
{:mday => 4, :name => "Dodenherdenking", :regions => [:nl]},
|
{:mday => 4, :name => "Dodenherdenking", :regions => [:nl]},
|
||||||
{:mday => 5, :name => "Bevrijdingsdag", :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]},
|
|
||||||
{:mday => 1, :name => "Dia do Trabalhador", :regions => [:pt]},
|
{:mday => 1, :name => "Dia do Trabalhador", :regions => [:pt]},
|
||||||
{:mday => 1, :name => "Första maj", :regions => [:se]}],
|
{: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]},
|
0 => [{:function => lambda { |year| Holidays.easter(year)-49 }, :function_id => "easter(year)-49", :type => :informal, :name => "Fastelavn", :regions => [:dk]},
|
||||||
|
@ -76,9 +74,6 @@ module Holidays
|
||||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Hemelvaartsdag", :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)+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)+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)-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)-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) }, :function_id => "easter(year)", :name => "Páscoa", :regions => [:pt]},
|
||||||
|
@ -94,19 +89,17 @@ module Holidays
|
||||||
{:mday => 1, :name => "Todos los Santos", :regions => [:es]},
|
{:mday => 1, :name => "Todos los Santos", :regions => [:es]},
|
||||||
{:mday => 1, :name => "Toussaint", :regions => [:fr]},
|
{:mday => 1, :name => "Toussaint", :regions => [:fr]},
|
||||||
{:mday => 11, :name => "Armistice 1918", :regions => [:fr]},
|
{:mday => 11, :name => "Armistice 1918", :regions => [:fr]},
|
||||||
|
{:mday => 5, :type => :informal, :name => "Guy Fawkes Day", :regions => [:gb]},
|
||||||
{:mday => 16, :name => "Dagur íslenskrar tungu", :regions => [:is]},
|
{:mday => 16, :name => "Dagur íslenskrar tungu", :regions => [:is]},
|
||||||
{:mday => 1, :name => "Ognissanti", :regions => [:it]},
|
{:mday => 1, :name => "Ognissanti", :regions => [:it]},
|
||||||
{:mday => 18, :name => "Latvijas Republikas proklamešanas diena", :regions => [:lv]},
|
|
||||||
{:mday => 1, :name => "Todos os Santos", :regions => [:pt]}],
|
{:mday => 1, :name => "Todos os Santos", :regions => [:pt]}],
|
||||||
6 => [{:mday => 5, :name => "Grundlovsdag", :regions => [:dk]},
|
6 => [{:mday => 5, :name => "Grundlovsdag", :regions => [:dk]},
|
||||||
{:mday => 15, :type => :informal, :name => "Valdemarsdag og Genforeningsdag", :regions => [:dk]},
|
{:mday => 15, :type => :informal, :name => "Valdemarsdag og Genforeningsdag", :regions => [:dk]},
|
||||||
{:mday => 23, :type => :informal, :name => "Sankt Hans aften", :regions => [:dk]},
|
{:mday => 23, :type => :informal, :name => "Sankt Hans aften", :regions => [:dk]},
|
||||||
{:mday => 9, :name => "Día de la Región de Murcia", :regions => [:es_mu]},
|
{: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]},
|
{:mday => 9, :name => "Día de La Rioja", :regions => [:es_lo]},
|
||||||
{:wday => 1, :week => 1, :name => "Labour Day/May Day", :regions => [:ie]},
|
{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:ie]},
|
||||||
{:mday => 2, :name => "Festa della Repubblica", :regions => [:it]},
|
{:mday => 2, :name => "Festa della Repubblica", :regions => [:it]},
|
||||||
{:mday => 23, :name => "Ligo Diena", :regions => [:lv]},
|
|
||||||
{:mday => 24, :name => "Jani", :regions => [:lv]},
|
|
||||||
{:mday => 10, :name => "Dia de Portugal", :regions => [:pt]},
|
{:mday => 10, :name => "Dia de Portugal", :regions => [:pt]},
|
||||||
{:mday => 6, :name => "Nationaldagen", :regions => [:se]},
|
{:mday => 6, :name => "Nationaldagen", :regions => [:se]},
|
||||||
{:function => lambda { |year| Holidays.se_midsommardagen(year) }, :function_id => "se_midsommardagen(year)", :name => "Midsommardagen", :regions => [:se]}],
|
{:function => lambda { |year| Holidays.se_midsommardagen(year) }, :function_id => "se_midsommardagen(year)", :name => "Midsommardagen", :regions => [:se]}],
|
||||||
|
@ -124,7 +117,6 @@ module Holidays
|
||||||
{:mday => 1, :name => "Capodanno", :regions => [:it]},
|
{:mday => 1, :name => "Capodanno", :regions => [:it]},
|
||||||
{:mday => 6, :name => "Epifania", :regions => [:it]},
|
{:mday => 6, :name => "Epifania", :regions => [:it]},
|
||||||
{:mday => 1, :name => "Nieuwjaar", :regions => [:nl]},
|
{:mday => 1, :name => "Nieuwjaar", :regions => [:nl]},
|
||||||
{:mday => 1, :name => "Jaunais Gads", :regions => [:lv]},
|
|
||||||
{:mday => 1, :name => "Ano Novo", :regions => [:pt]},
|
{:mday => 1, :name => "Ano Novo", :regions => [:pt]},
|
||||||
{:mday => 1, :name => "Nyårsdagen", :regions => [:se]},
|
{:mday => 1, :name => "Nyårsdagen", :regions => [:se]},
|
||||||
{:mday => 6, :name => "Trettondedag jul", :regions => [:se]}],
|
{:mday => 6, :name => "Trettondedag jul", :regions => [:se]}],
|
||||||
|
@ -152,9 +144,6 @@ module Holidays
|
||||||
{:mday => 5, :type => :informal, :name => "Sinterklaas", :regions => [:nl]},
|
{:mday => 5, :type => :informal, :name => "Sinterklaas", :regions => [:nl]},
|
||||||
{:mday => 25, :name => "Kerstmis", :regions => [:nl]},
|
{:mday => 25, :name => "Kerstmis", :regions => [:nl]},
|
||||||
{:mday => 26, :name => "Kerstmis", :regions => [:nl]},
|
{: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 => 1, :name => "Restauração da Independência", :regions => [:pt]},
|
{:mday => 1, :name => "Restauração da Independência", :regions => [:pt]},
|
||||||
{:mday => 8, :name => "Imaculada Conceição", :regions => [:pt]},
|
{:mday => 8, :name => "Imaculada Conceição", :regions => [:pt]},
|
||||||
{:mday => 25, :name => "Natal", :regions => [:pt]},
|
{:mday => 25, :name => "Natal", :regions => [:pt]},
|
||||||
|
@ -169,9 +158,8 @@ module Holidays
|
||||||
8 => [{:mday => 15, :name => "Mariä Himmelfahrt", :regions => [:de_by]},
|
8 => [{:mday => 15, :name => "Mariä Himmelfahrt", :regions => [:de_by]},
|
||||||
{:mday => 15, :name => "Asunción", :regions => [:es]},
|
{:mday => 15, :name => "Asunción", :regions => [:es]},
|
||||||
{:mday => 15, :name => "Assomption", :regions => [:fr]},
|
{:mday => 15, :name => "Assomption", :regions => [:fr]},
|
||||||
{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:gb_sct]},
|
{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:gb_sct, :ie]},
|
||||||
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb_eng, :gb_wls, :gb_eaw]},
|
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir]},
|
||||||
{:wday => 1, :week => 1, :name => "August Holiday", :regions => [:ie]},
|
|
||||||
{:wday => 1, :week => 1, :name => "Frídagur verslunarmanna", :regions => [:is]},
|
{: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]}],
|
{:mday => 15, :name => "Assunção de Nossa Senhora", :regions => [:pt]}],
|
||||||
|
@ -195,7 +183,7 @@ module Holidays
|
||||||
{:mday => 31, :name => "Reformationstag", :regions => [:de_bb, :de_mv, :de_sn, :de_st, :de_th]},
|
{: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 => 9, :name => "Día de Valencia", :regions => [:es_vc, :es_v]},
|
||||||
{:mday => 12, :name => "Día de la Hispanidad", :regions => [:es]},
|
{:mday => 12, :name => "Día de la Hispanidad", :regions => [:es]},
|
||||||
{:wday => 1, :week => -1, :name => "October Holiday", :regions => [:ie]},
|
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:ie]},
|
||||||
{:mday => 5, :name => "Implantação da República", :regions => [:pt]}]
|
{:mday => 5, :name => "Implantação da República", :regions => [:pt]}]
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -211,7 +199,7 @@ def self.is_sumardagurinn_fyrsti(year)
|
||||||
date
|
date
|
||||||
end
|
end
|
||||||
|
|
||||||
# The Saturday between Oct 31 and Nov 6.(2007: November 3)
|
# Sweden: All Saint's Day (Saturday between Oct 31 and Nov 6)
|
||||||
def self.se_alla_helgons_dag(year)
|
def self.se_alla_helgons_dag(year)
|
||||||
date = Date.civil(year,10,31)
|
date = Date.civil(year,10,31)
|
||||||
date += (6 - date.wday)
|
date += (6 - date.wday)
|
||||||
|
@ -219,7 +207,7 @@ def self.se_alla_helgons_dag(year)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# The Saturday between June 20–26. (2007: June 23)
|
# Sweden: Mid-summer (Saturday between June 20–26)
|
||||||
def self.se_midsommardagen(year)
|
def self.se_midsommardagen(year)
|
||||||
date = Date.civil(year,6,20)
|
date = Date.civil(year,6,20)
|
||||||
date += (6 - date.wday)
|
date += (6 - date.wday)
|
||||||
|
|
|
@ -20,6 +20,7 @@ module Holidays
|
||||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:gb]},
|
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) }, :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]}],
|
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Easter Monday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir]}],
|
||||||
|
11 => [{:mday => 5, :type => :informal, :name => "Guy Fawkes Day", :regions => [:gb]}],
|
||||||
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:gb]},
|
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:gb]},
|
||||||
{:mday => 2, :name => "New Year's", :regions => [:gb_sct]}],
|
{:mday => 2, :name => "New Year's", :regions => [:gb_sct]}],
|
||||||
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:gb]},
|
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:gb]},
|
||||||
|
@ -27,7 +28,7 @@ module Holidays
|
||||||
7 => [{:mday => 5, :name => "Tynwald Day", :regions => [:im, :gb_iom]},
|
7 => [{:mday => 5, :name => "Tynwald Day", :regions => [:im, :gb_iom]},
|
||||||
{:mday => 12, :name => "Battle of the Boyne", :regions => [:gb_nir]}],
|
{:mday => 12, :name => "Battle of the Boyne", :regions => [:gb_nir]}],
|
||||||
8 => [{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:gb_sct]},
|
8 => [{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:gb_sct]},
|
||||||
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb_eng, :gb_wls, :gb_eaw]}],
|
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir]}],
|
||||||
3 => [{:mday => 5, :name => "St. Piran's Day", :regions => [:gb_con]},
|
3 => [{:mday => 5, :name => "St. Piran's Day", :regions => [:gb_con]},
|
||||||
{:mday => 17, :name => "St. Patrick's Day", :regions => [:gb_nir]}]
|
{:mday => 17, :name => "St. Patrick's Day", :regions => [:gb_nir]}]
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,13 +16,13 @@ module Holidays
|
||||||
HOLIDAYS_BY_MONTH = {
|
HOLIDAYS_BY_MONTH = {
|
||||||
5 => [{:wday => 1, :week => 1, :name => "May Day", :regions => [:ie]}],
|
5 => [{:wday => 1, :week => 1, :name => "May Day", :regions => [:ie]}],
|
||||||
0 => [{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "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]}],
|
6 => [{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:ie]}],
|
||||||
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:ie]}],
|
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:ie]}],
|
||||||
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:ie]},
|
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:ie]},
|
||||||
{:mday => 26, :name => "St. Stephen's Day", :regions => [:ie]}],
|
{:mday => 26, :name => "St. Stephen's Day", :regions => [:ie]}],
|
||||||
8 => [{:wday => 1, :week => 1, :name => "August Holiday", :regions => [:ie]}],
|
8 => [{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:ie]}],
|
||||||
3 => [{:mday => 17, :name => "St. Patrick's Day", :regions => [:ie]}],
|
3 => [{:mday => 17, :name => "St. Patrick's Day", :regions => [:ie]}],
|
||||||
10 => [{:wday => 1, :week => -1, :name => "October Holiday", :regions => [:ie]}]
|
10 => [{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:ie]}]
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
module Holidays
|
|
||||||
# This file is generated by the Ruby Holiday gem.
|
|
||||||
#
|
|
||||||
# Definitions loaded: data/lv.yaml
|
|
||||||
#
|
|
||||||
# To use the definitions in this file, load them right after you load the
|
|
||||||
# Holiday gem:
|
|
||||||
#
|
|
||||||
# require 'holidays'
|
|
||||||
# require 'holidays/lv'
|
|
||||||
#
|
|
||||||
# More definitions are available at http://code.dunae.ca/holidays.
|
|
||||||
module LV # :nodoc:
|
|
||||||
DEFINED_REGIONS = [:lv]
|
|
||||||
|
|
||||||
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 }, :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]}],
|
|
||||||
1 => [{:mday => 1, :name => "Jaunais Gads", :regions => [:lv]}],
|
|
||||||
12 => [{:mday => 25, :name => "Ziemassvetki", :regions => [:lv]},
|
|
||||||
{:mday => 25, :name => "2. Ziemassvetki", :regions => [:lv]},
|
|
||||||
{:mday => 31, :name => "Vecgada vakars", :regions => [:lv]}]
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
Holidays.merge_defs(Holidays::LV::DEFINED_REGIONS, Holidays::LV::HOLIDAYS_BY_MONTH)
|
|
37
lib/holidays/pt.rb
Normal file
37
lib/holidays/pt.rb
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
module Holidays
|
||||||
|
# This file is generated by the Ruby Holiday gem.
|
||||||
|
#
|
||||||
|
# Definitions loaded: data/pt.yaml
|
||||||
|
#
|
||||||
|
# To use the definitions in this file, load them right after you load the
|
||||||
|
# Holiday gem:
|
||||||
|
#
|
||||||
|
# require 'holidays'
|
||||||
|
# require 'holidays/pt'
|
||||||
|
#
|
||||||
|
# More definitions are available at http://code.dunae.ca/holidays.
|
||||||
|
module PT # :nodoc:
|
||||||
|
DEFINED_REGIONS = [:pt]
|
||||||
|
|
||||||
|
HOLIDAYS_BY_MONTH = {
|
||||||
|
5 => [{:mday => 1, :name => "Dia do Trabalhador", :regions => [:pt]}],
|
||||||
|
0 => [{: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]}],
|
||||||
|
11 => [{:mday => 1, :name => "Todos os Santos", :regions => [:pt]}],
|
||||||
|
6 => [{:mday => 10, :name => "Dia de Portugal", :regions => [:pt]}],
|
||||||
|
1 => [{:mday => 1, :name => "Ano Novo", :regions => [:pt]}],
|
||||||
|
12 => [{:mday => 1, :name => "Restauração da Independência", :regions => [:pt]},
|
||||||
|
{:mday => 8, :name => "Imaculada Conceição", :regions => [:pt]},
|
||||||
|
{:mday => 25, :name => "Natal", :regions => [:pt]}],
|
||||||
|
8 => [{:mday => 15, :name => "Assunção de Nossa Senhora", :regions => [:pt]}],
|
||||||
|
4 => [{:mday => 25, :name => "Dia da Liberdade", :regions => [:pt]}],
|
||||||
|
10 => [{:mday => 5, :name => "Implantação da República", :regions => [:pt]}]
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
Holidays.merge_defs(Holidays::PT::DEFINED_REGIONS, Holidays::PT::HOLIDAYS_BY_MONTH)
|
|
@ -1,7 +1,7 @@
|
||||||
module Holidays
|
module Holidays
|
||||||
# This file is generated by the Ruby Holiday gem.
|
# This file is generated by the Ruby Holiday gem.
|
||||||
#
|
#
|
||||||
# Definitions loaded: data/dk.yaml, data/is.yaml
|
# Definitions loaded: data/dk.yaml, data/is.yaml, data/se.yaml
|
||||||
#
|
#
|
||||||
# To use the definitions in this file, load them right after you load the
|
# To use the definitions in this file, load them right after you load the
|
||||||
# Holiday gem:
|
# Holiday gem:
|
||||||
|
@ -11,13 +11,14 @@ module Holidays
|
||||||
#
|
#
|
||||||
# More definitions are available at http://code.dunae.ca/holidays.
|
# More definitions are available at http://code.dunae.ca/holidays.
|
||||||
module SCANDINAVIA # :nodoc:
|
module SCANDINAVIA # :nodoc:
|
||||||
DEFINED_REGIONS = [:dk, :is]
|
DEFINED_REGIONS = [:dk, :is, :se]
|
||||||
|
|
||||||
HOLIDAYS_BY_MONTH = {
|
HOLIDAYS_BY_MONTH = {
|
||||||
5 => [{:mday => 1, :name => "Arbejdernes kampdag", :regions => [:dk]},
|
5 => [{:mday => 1, :name => "Arbejdernes kampdag", :regions => [:dk]},
|
||||||
{:mday => 5, :type => :informal, :name => "Danmarks befrielse", :regions => [:dk]},
|
{:mday => 5, :type => :informal, :name => "Danmarks befrielse", :regions => [:dk]},
|
||||||
{:mday => 3, :type => :informal, :name => "Sjómannadagurinn", :regions => [:is]},
|
{:mday => 3, :type => :informal, :name => "Sjómannadagurinn", :regions => [:is]},
|
||||||
{:mday => 17, :name => "Lýðveldisdagurinn", :regions => [:is]}],
|
{:mday => 17, :name => "Lýðveldisdagurinn", :regions => [:is]},
|
||||||
|
{: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]},
|
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)-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)-3 }, :function_id => "easter(year)-3", :name => "Skærtorsdag", :regions => [:dk]},
|
||||||
|
@ -35,16 +36,26 @@ module Holidays
|
||||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skírdagur", :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)-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) }, :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)+1 }, :function_id => "easter(year)+1", :name => "Annar í páskum", :regions => [:is]},
|
||||||
|
{: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]},
|
11 => [{:mday => 10, :type => :informal, :name => "Mortensaften", :regions => [:dk]},
|
||||||
{:mday => 16, :name => "Dagur íslenskrar tungu", :regions => [:is]}],
|
{:mday => 16, :name => "Dagur íslenskrar tungu", :regions => [:is]}],
|
||||||
6 => [{:mday => 5, :name => "Grundlovsdag", :regions => [:dk]},
|
6 => [{:mday => 5, :name => "Grundlovsdag", :regions => [:dk]},
|
||||||
{:mday => 15, :type => :informal, :name => "Valdemarsdag og Genforeningsdag", :regions => [:dk]},
|
{:mday => 15, :type => :informal, :name => "Valdemarsdag og Genforeningsdag", :regions => [:dk]},
|
||||||
{:mday => 23, :type => :informal, :name => "Sankt Hans aften", :regions => [:dk]}],
|
{:mday => 23, :type => :informal, :name => "Sankt Hans aften", :regions => [:dk]},
|
||||||
|
{: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]},
|
1 => [{:mday => 1, :name => "Nytårsdag", :regions => [:dk]},
|
||||||
{:mday => 1, :name => "Nýársdagur", :regions => [:is]},
|
{:mday => 1, :name => "Nýársdagur", :regions => [:is]},
|
||||||
{:mday => 6, :name => "Þrettándinn", :regions => [:is]},
|
{:mday => 6, :name => "Þrettándinn", :regions => [:is]},
|
||||||
{:mday => 19, :type => :informal, :name => "Bóndadagur", :regions => [:is]}],
|
{:mday => 19, :type => :informal, :name => "Bóndadagur", :regions => [:is]},
|
||||||
|
{:mday => 1, :name => "Nyårsdagen", :regions => [:se]},
|
||||||
|
{:mday => 6, :name => "Trettondedag jul", :regions => [:se]}],
|
||||||
12 => [{:mday => 13, :type => :informal, :name => "Sankt Lucia", :regions => [:dk]},
|
12 => [{:mday => 13, :type => :informal, :name => "Sankt Lucia", :regions => [:dk]},
|
||||||
{:mday => 24, :name => "Juleaftensdag", :regions => [:dk]},
|
{:mday => 24, :name => "Juleaftensdag", :regions => [:dk]},
|
||||||
{:mday => 25, :name => "1. juledag", :regions => [:dk]},
|
{:mday => 25, :name => "1. juledag", :regions => [:dk]},
|
||||||
|
@ -52,7 +63,9 @@ module Holidays
|
||||||
{:mday => 24, :name => "Jól", :regions => [:is]},
|
{:mday => 24, :name => "Jól", :regions => [:is]},
|
||||||
{:mday => 25, :name => "Jól", :regions => [:is]},
|
{:mday => 25, :name => "Jól", :regions => [:is]},
|
||||||
{:mday => 26, :name => "Jól", :regions => [:is]},
|
{:mday => 26, :name => "Jól", :regions => [:is]},
|
||||||
{:mday => 31, :name => "Gamlárskvöld", :regions => [:is]}],
|
{:mday => 31, :name => "Gamlárskvöld", :regions => [:is]},
|
||||||
|
{:mday => 25, :name => "Juldagen", :regions => [:se]},
|
||||||
|
{:mday => 26, :name => "Annandag jul", :regions => [:se]}],
|
||||||
2 => [{:mday => 18, :type => :informal, :name => "Konudagur", :regions => [:is]}],
|
2 => [{:mday => 18, :type => :informal, :name => "Konudagur", :regions => [:is]}],
|
||||||
8 => [{:wday => 1, :week => 1, :name => "Frídagur verslunarmanna", :regions => [:is]}],
|
8 => [{:wday => 1, :week => 1, :name => "Frídagur verslunarmanna", :regions => [:is]}],
|
||||||
4 => [{:mday => 1, :type => :informal, :name => "1. april", :regions => [:dk]},
|
4 => [{:mday => 1, :type => :informal, :name => "1. april", :regions => [:dk]},
|
||||||
|
@ -72,6 +85,22 @@ def self.is_sumardagurinn_fyrsti(year)
|
||||||
date
|
date
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Sweden: All Saint's Day (Saturday between Oct 31 and Nov 6)
|
||||||
|
def self.se_alla_helgons_dag(year)
|
||||||
|
date = Date.civil(year,10,31)
|
||||||
|
date += (6 - date.wday)
|
||||||
|
date
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
# Sweden: Mid-summer (Saturday between June 20–26)
|
||||||
|
def self.se_midsommardagen(year)
|
||||||
|
date = Date.civil(year,6,20)
|
||||||
|
date += (6 - date.wday)
|
||||||
|
date
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
52
lib/holidays/se.rb
Normal file
52
lib/holidays/se.rb
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
module Holidays
|
||||||
|
# This file is generated by the Ruby Holiday gem.
|
||||||
|
#
|
||||||
|
# Definitions loaded: data/se.yaml
|
||||||
|
#
|
||||||
|
# To use the definitions in this file, load them right after you load the
|
||||||
|
# Holiday gem:
|
||||||
|
#
|
||||||
|
# require 'holidays'
|
||||||
|
# require 'holidays/se'
|
||||||
|
#
|
||||||
|
# More definitions are available at http://code.dunae.ca/holidays.
|
||||||
|
module SE # :nodoc:
|
||||||
|
DEFINED_REGIONS = [:se]
|
||||||
|
|
||||||
|
HOLIDAYS_BY_MONTH = {
|
||||||
|
5 => [{:mday => 1, :name => "Första maj", :regions => [:se]}],
|
||||||
|
0 => [{: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]}],
|
||||||
|
6 => [{: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 => "Nyårsdagen", :regions => [:se]},
|
||||||
|
{:mday => 6, :name => "Trettondedag jul", :regions => [:se]}],
|
||||||
|
12 => [{:mday => 25, :name => "Juldagen", :regions => [:se]},
|
||||||
|
{:mday => 26, :name => "Annandag jul", :regions => [:se]}]
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
# Sweden: All Saint's Day (Saturday between Oct 31 and Nov 6)
|
||||||
|
def self.se_alla_helgons_dag(year)
|
||||||
|
date = Date.civil(year,10,31)
|
||||||
|
date += (6 - date.wday)
|
||||||
|
date
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
# Sweden: Mid-summer (Saturday between June 20–26)
|
||||||
|
def self.se_midsommardagen(year)
|
||||||
|
date = Date.civil(year,6,20)
|
||||||
|
date += (6 - date.wday)
|
||||||
|
date
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
Holidays.merge_defs(Holidays::SE::DEFINED_REGIONS, Holidays::SE::HOLIDAYS_BY_MONTH)
|
19
rakefile.rb
19
rakefile.rb
|
@ -17,7 +17,6 @@ def_list = {
|
||||||
:ie => ['data/ie.yaml'],
|
:ie => ['data/ie.yaml'],
|
||||||
:is => ['data/is.yaml'],
|
:is => ['data/is.yaml'],
|
||||||
:it => ['data/it.yaml'],
|
:it => ['data/it.yaml'],
|
||||||
:lv => ['data/lv.yaml'],
|
|
||||||
:mx => ['data/mx.yaml', 'data/north_america_informal.yaml'],
|
:mx => ['data/mx.yaml', 'data/north_america_informal.yaml'],
|
||||||
:nl => ['data/nl.yaml'],
|
:nl => ['data/nl.yaml'],
|
||||||
:pt => ['data/pt.yaml'],
|
:pt => ['data/pt.yaml'],
|
||||||
|
@ -27,11 +26,23 @@ def_list = {
|
||||||
:za => ['data/za.yaml']
|
:za => ['data/za.yaml']
|
||||||
}
|
}
|
||||||
|
|
||||||
def_list[:north_america] = def_list[:ca] | def_list[:mx] | def_list[:us]
|
def_list[:north_america] = []
|
||||||
|
[:ca, :mx, :us].each do |r|
|
||||||
|
def_list[:north_america] += def_list[r]
|
||||||
|
end
|
||||||
|
def_list[:north_america].uniq!
|
||||||
|
|
||||||
def_list[:scandinavia] = def_list[:dk] | def_list[:is]
|
def_list[:scandinavia] = []
|
||||||
|
[:dk, :is, :se].each do |r|
|
||||||
|
def_list[:scandinavia] += def_list[r]
|
||||||
|
end
|
||||||
|
def_list[:scandinavia].uniq!
|
||||||
|
|
||||||
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]
|
def_list[:europe] = []
|
||||||
|
[:dk, :de, :es, :fr, :gb, :ie, :is, :it, :nl, :pt, :se].each do |r|
|
||||||
|
def_list[:europe] += def_list[r]
|
||||||
|
end
|
||||||
|
def_list[:europe].uniq!
|
||||||
|
|
||||||
|
|
||||||
desc 'Run the unit tests.'
|
desc 'Run the unit tests.'
|
||||||
|
|
|
@ -18,6 +18,61 @@ class RegionTests < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_gb
|
||||||
|
# Holidays.between(Date.civil(2008,1,1),Date.civil(2008,12,1),:gb_).each do |h|
|
||||||
|
# puts "#{h[:name]} on #{h[:date]}"
|
||||||
|
# end
|
||||||
|
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
||||||
|
Date.civil(2008,3,21) => 'Good Friday',
|
||||||
|
Date.civil(2008,3,23) => 'Easter Sunday',
|
||||||
|
Date.civil(2008,5,5) => 'May Day',
|
||||||
|
Date.civil(2008,5,26) => 'Bank Holiday',
|
||||||
|
Date.civil(2008,11,5) => 'Guy Fawkes 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, :gb)[0][:name]
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_equal 'St. Patrick\'s Day', Date.civil(2008,3,17).holidays(:gb_nir)[0][:name]
|
||||||
|
|
||||||
|
[:gb_wls, :gb_eng, :gb_nir, :gb_eaw, :gb_].each do |r|
|
||||||
|
assert_equal 'Easter Monday', Date.civil(2008,3,24).holidays(r)[0][:name]
|
||||||
|
assert_equal 'Bank Holiday', Date.civil(2008,8,25).holidays(r)[0][:name]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def test_ie
|
||||||
|
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
||||||
|
Date.civil(2008,3,17) => 'St. Patrick\'s Day',
|
||||||
|
Date.civil(2008,3,24) => 'Easter Monday',
|
||||||
|
Date.civil(2008,5,5) => 'May Day',
|
||||||
|
Date.civil(2008,6,2) => 'Bank Holiday',
|
||||||
|
Date.civil(2008,8,4) => 'Bank Holiday',
|
||||||
|
Date.civil(2008,12,25) => 'Christmas Day',
|
||||||
|
Date.civil(2008,12,26) => 'St. Stephen\'s Day'}.each do |date, name|
|
||||||
|
assert_equal name, Holidays.on(date, :ie)[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_pt
|
def test_pt
|
||||||
{Date.civil(2008,1,1) => 'Ano Novo',
|
{Date.civil(2008,1,1) => 'Ano Novo',
|
||||||
Date.civil(2005,2,8) => 'Carnaval',
|
Date.civil(2005,2,8) => 'Carnaval',
|
||||||
|
@ -42,25 +97,6 @@ class RegionTests < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
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
|
def test_se
|
||||||
{Date.civil(2008,1,1) => 'Nyårsdagen',
|
{Date.civil(2008,1,1) => 'Nyårsdagen',
|
||||||
Date.civil(2008,1,6) => 'Trettondedag jul',
|
Date.civil(2008,1,6) => 'Trettondedag jul',
|
||||||
|
|
|
@ -17,13 +17,13 @@ class North_AmericaTests < Test::Unit::TestCase
|
||||||
Date.civil(2008,12,26) => 'Boxing Day'}.each do |date, name|
|
Date.civil(2008,12,26) => 'Boxing Day'}.each do |date, name|
|
||||||
assert_equal name, Holidays.on(date, :ca)[0][:name]
|
assert_equal name, Holidays.on(date, :ca)[0][:name]
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def test_ca_victoria_day
|
# Victoria Day
|
||||||
[Date.civil(2004,5,24), Date.civil(2005,5,23), Date.civil(2006,5,22),
|
[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|
|
Date.civil(2007,5,21), Date.civil(2008,5,19)].each do |date|
|
||||||
assert_equal 'Victoria Day', Holidays.on(date, :ca)[0][:name]
|
assert_equal 'Victoria Day', Holidays.on(date, :ca)[0][:name]
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# from
|
# from
|
||||||
|
|
Loading…
Reference in a new issue