2007-11-29 02:01:40 +01:00
|
|
|
|
# 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
|
2007-11-29 03:24:00 +01:00
|
|
|
|
# - http://hem.passagen.se/farila/midsum.htm
|
|
|
|
|
# - http://www.timeanddate.com/calendar/?country=21
|
2007-11-29 02:01:40 +01:00
|
|
|
|
---
|
|
|
|
|
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:
|
2007-11-29 03:24:00 +01:00
|
|
|
|
se_midsommardagen: |
|
2007-11-29 03:56:32 +01:00
|
|
|
|
# Sweden: Mid-summer (Saturday between June 20–26)
|
2007-11-29 03:24:00 +01:00
|
|
|
|
def self.se_midsommardagen(year)
|
|
|
|
|
date = Date.civil(year,6,20)
|
|
|
|
|
date += (6 - date.wday)
|
|
|
|
|
date
|
|
|
|
|
end
|
|
|
|
|
se_alla_helgons_dag: |
|
2007-11-29 03:56:32 +01:00
|
|
|
|
# Sweden: All Saint's Day (Saturday between Oct 31 and Nov 6)
|
2007-11-29 03:24:00 +01:00
|
|
|
|
def self.se_alla_helgons_dag(year)
|
|
|
|
|
date = Date.civil(year,10,31)
|
|
|
|
|
date += (6 - date.wday)
|
|
|
|
|
date
|
2007-11-29 02:01:40 +01:00
|
|
|
|
end
|
2007-12-05 23:27:05 +01:00
|
|
|
|
tests: |
|
|
|
|
|
{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, :informal)[0][:name]
|
|
|
|
|
end
|