From f2c72ffd98d65768d4d0bf7e951696c199b70e7d Mon Sep 17 00:00:00 2001 From: Alex Dunae Date: Thu, 29 Nov 2007 01:01:40 +0000 Subject: [PATCH] Added PT and SE --- data/pt.yaml | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++ data/se.yaml | 79 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 169 insertions(+) create mode 100644 data/pt.yaml create mode 100644 data/se.yaml diff --git a/data/pt.yaml b/data/pt.yaml new file mode 100644 index 0000000..9e22779 --- /dev/null +++ b/data/pt.yaml @@ -0,0 +1,90 @@ +# Portugese holiday definitions for the Ruby Holiday gem. +# +# Updated: 2008-11-28. +# Sources: +# - http://en.wikipedia.org/wiki/Holidays_in_Portugal +# - http://www.kidlink.org/KIDPROJ/MCC/mcc0006.html +# - http://www.worldtravelguide.net/country/227/public_holidays/Europe/Portugal.html +# - http://en.wikipedia.org/wiki/Portugal_Day +# - http://www.timeanddate.com/calendar/custom.html?year=2008&country=15 +--- +months: + 0: + - name: Carnaval # same as Shrove Tuesday + regions: [pt] + function: easter(year)-47 + type: informal + - name: Sexta-feira Santa + regions: [pt] + function: easter(year)-2 + - name: Páscoa + regions: [pt] + function: easter(year) + - name: Corpo de Deus + regions: [pt] + function: easter(year)+60 + 1: + - name: Ano Novo + regions: [pt] + mday: 1 + 4: + - name: Dia da Liberdade + regions: [pt] + mday: 25 + 5: + - name: Dia do Trabalhador + regions: [pt] + mday: 1 + 6: + - name: Dia de Portugal + regions: [pt] + mday: 6 + 8: + - name: Assunção de Nossa Senhora + regions: [pt] + mday: 15 + 10: + - name: Implantação da República + regions: [pt] + mday: 5 + 11: + - name: Todos os Santos + regions: [pt] + mday: 1 + 12: + - name: Restauração da Independência + regions: [pt] + mday: 1 + - name: Imaculada Conceição + regions: [pt] + mday: 8 + - 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 \ No newline at end of file diff --git a/data/se.yaml b/data/se.yaml new file mode 100644 index 0000000..0a305eb --- /dev/null +++ b/data/se.yaml @@ -0,0 +1,79 @@ +# Swedish holiday definitions for the Ruby Holiday gem. +# +# Updated: 2008-11-28. +# Sources: +# - http://en.wikipedia.org/wiki/Holidays_in_Sweden +# - http://www.worldtravelguide.net/country/269/public_holidays/Europe/Sweden.html +--- +months: + 0: + - name: Långfredagen + regions: [se] + function: easter(year)-2 + - name: Påskdagen + regions: [se] + function: easter(year) + - name: Annandag påsk + regions: [se] + function: easter(year)+1 + - name: Kristi himmelsfärdsdag # Ascension Day + regions: [se] + function: easter(year)+39 + - name: Pingstdagen # Whitsunday + regions: [se] + function: easter(year)+49 + - name: Alla helgons dag # All Saint's Day + regions: [se] + function: se_alla_helgons_dag(year) + 1: + - name: Nyårsdagen + regions: [se] + mday: 1 + - name: Trettondedag jul + regions: [se] + mday: 6 + 5: + - name: Första maj + regions: [se] + mday: 1 + 6: + - name: Nationaldagen + regions: [se] + mday: 6 + - name: Midsommardagen + regions: [se] + function: se_midsommardagen(year) + 12: + - name: Juldagen + regions: [se] + mday: 25 + - name: Annandag jul + 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] + end + end \ No newline at end of file