holidays/data/de.yaml
2007-12-05 22:27:05 +00:00

116 lines
3.4 KiB
YAML

# German holiday definitions for the Ruby Holiday gem.
#
# Updated: 2008-11-29.
# Sources:
# - http://en.wikipedia.org/wiki/Holidays_in_Germany
# - http://www.timeanddate.com/calendar/index.html?country=8
# - http://www.germany.info/relaunch/welcome/travel/holidays.html
---
months:
0:
- name: Karfreitag
regions: [de]
function: easter(year)-2
- name: Ostern
regions: [de]
function: easter(year)
type: informal
- name: Ostermontag
regions: [de]
function: easter(year)+1
- name: Christi Himmelfahrt
regions: [de]
function: easter(year)+39
- name: Pfingstmontag
regions: [de]
function: easter(year)+50
- name: Fronleichnam
regions: [de_bw, de_by, de_he, de_nw, de_rp, de_sl, de_sn, de_th]
function: easter(year)+60
1:
- name: Neujahrstag
regions: [de]
mday: 1
- name: Heilige Drei Könige
regions: [de_bw, de_by]
mday: 6
5:
- name: Tag der Arbeit
regions: [de]
mday: 1
- name: Victoire 1945
regions: [de]
mday: 8
8:
- name: Mariä Himmelfahrt
regions: [de_by, de_sl]
mday: 15
10:
- name: Tag der Deutschen Einheit
regions: [de]
mday: 3
- name: Reformationstag
regions: [de_bb, de_mv, de_sn, de_st, de_th]
mday: 31
11:
- name: Allerheiligen
regions: [de_bw, de_by, de_nw, de_rp, de_sl]
mday: 1
- name: Buß- und Bettag
regions: [de_by, de_sn]
function: de_buss_und_bettag(year)
12:
- name: 1. Weihnachtstag
regions: [de]
mday: 25
- name: 2. Weihnachtstag
regions: [de]
mday: 26
methods:
de_buss_und_bettag: |
# Germany: Wednesday before November 23
def self.de_buss_und_bettag(year)
date = Date.civil(year,11,23)
if date.wday > 3
date -= (date.wday - 3)
else
date -= (date.wday + 4)
end
date
end
tests: |
{Date.civil(2009,1,1) => 'Neujahrstag',
Date.civil(2009,4,10) => 'Karfreitag',
Date.civil(2009,4,12) => 'Ostern',
Date.civil(2009,4,13) => 'Ostermontag',
Date.civil(2009,5,1) => 'Tag der Arbeit',
Date.civil(2009,5,21) => 'Christi Himmelfahrt',
Date.civil(2009,6,1) => 'Pfingstmontag',
Date.civil(2009,10,3) => 'Tag der Deutschen Einheit',
Date.civil(2009,12,25) => '1. Weihnachtstag',
Date.civil(2009,12,26) => '2. Weihnachtstag'}.each do |date, name|
assert_equal name, Holidays.on(date, :de, :informal)[0][:name]
end
[:de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_sn, :de_th, :de_].each do |r|
assert_equal 'Fronleichnam', Date.civil(2009,6,11).holidays(r)[0][:name]
end
[:de_by, :de_sl, :de_].each do |r|
assert_equal 'Mariä Himmelfahrt', Date.civil(2009,8,15).holidays(r)[0][:name]
end
[:de_bb, :de_mv, :de_sn, :de_st, :de_th, :de_].each do |r|
assert_equal 'Reformationstag', Date.civil(2009,10,31).holidays(r)[0][:name]
end
[:de_bw, :de_by, :de_nw, :de_rp, :de_sl, :de_].each do |r|
assert_equal 'Allerheiligen', Date.civil(2009,11,1).holidays(r)[0][:name]
end
# Repentance Day
assert_equal 'Buß- und Bettag', Date.civil(2004,11,17).holidays(:de_sn)[0][:name]
assert_equal 'Buß- und Bettag', Date.civil(2005,11,16).holidays(:de_sn)[0][:name]
assert_equal 'Buß- und Bettag', Date.civil(2006,11,22).holidays(:de_sn)[0][:name]
assert_equal 'Buß- und Bettag', Date.civil(2009,11,18).holidays(:de_sn)[0][:name]