holidays/data/de.yaml

114 lines
3.4 KiB
YAML
Raw Normal View History

2007-11-24 01:45:30 +01:00
# German holiday definitions for the Ruby Holiday gem.
#
2009-11-05 21:30:46 +01:00
# Updated: 2009-11-05.
2007-11-24 01:45:30 +01:00
# Sources:
# - http://en.wikipedia.org/wiki/Holidays_in_Germany
2007-11-29 21:05:17 +01:00
# - http://www.timeanddate.com/calendar/index.html?country=8
# - http://www.germany.info/relaunch/welcome/travel/holidays.html
2007-11-24 01:45:30 +01:00
---
months:
0:
- name: Karfreitag
regions: [de]
function: easter(year)-2
2007-11-24 01:45:30 +01:00
- name: Ostermontag
regions: [de]
function: easter(year)+1
2007-11-24 01:45:30 +01:00
- name: Christi Himmelfahrt
regions: [de]
function: easter(year)+39
2007-11-24 01:45:30 +01:00
- name: Pfingstmontag
regions: [de]
function: easter(year)+50
2007-11-24 01:45:30 +01:00
- name: Fronleichnam
2009-11-05 21:30:46 +01:00
regions: [de_bw, de_by, de_he, de_nw, de_rp, de_sl]
function: easter(year)+60
2007-11-24 01:45:30 +01:00
1:
- name: Neujahrstag
regions: [de]
mday: 1
2007-11-25 00:22:10 +01:00
- name: Heilige Drei Könige
2009-11-05 21:30:46 +01:00
regions: [de_bw, de_by, de_st]
2007-11-24 01:45:30 +01:00
mday: 6
5:
- name: Tag der Arbeit
regions: [de]
mday: 1
8:
2007-11-25 00:22:10 +01:00
- name: Mariä Himmelfahrt
2007-11-29 21:05:17 +01:00
regions: [de_by, de_sl]
2007-11-24 01:45:30 +01:00
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
2007-11-29 21:05:17 +01:00
- name: Buß- und Bettag
2009-11-05 21:30:46 +01:00
regions: [de_sn]
2007-11-29 21:05:17 +01:00
function: de_buss_und_bettag(year)
2007-11-24 01:45:30 +01:00
12:
- name: 1. Weihnachtstag
regions: [de]
mday: 25
- name: 2. Weihnachtstag
regions: [de]
2007-11-29 21:05:17 +01:00
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
2007-12-05 23:27:05 +01:00
end
tests: |
{Date.civil(2009,1,1) => 'Neujahrstag',
Date.civil(2009,4,10) => 'Karfreitag',
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]
2007-12-05 23:27:05 +01:00
end
2009-11-05 21:30:46 +01:00
[:de_bw, :de_by, :de_st, :de_].each do |r|
assert_equal 'Heilige Drei Könige', Date.civil(2009,1,6).holidays(r)[0][:name]
end
[:de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_].each do |r|
2007-12-05 23:27:05 +01:00
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
assert !Date.civil(2010,5,8).holiday?(:de), '2010-05-08 is not a holiday in Germany'
2007-12-05 23:27:05 +01:00
# 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]