Add Austrian holiday definitions -- thanks Vogel Siegried
This commit is contained in:
parent
cd82b4d043
commit
46c39f82b3
4 changed files with 234 additions and 141 deletions
68
data/at.yaml
Normal file
68
data/at.yaml
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
# Austrian holiday definitions for the Ruby Holiday gem.
|
||||||
|
#
|
||||||
|
# Updated: 2011-08-31 by VGSG
|
||||||
|
# Sources:
|
||||||
|
# - http://de.wikipedia.org/wiki/Feiertage_in_%C3%96sterreich
|
||||||
|
# - http://www.timeanddate.com/calendar/index.html?country=8
|
||||||
|
# - http://www.germany.info/relaunch/welcome/travel/holidays.html
|
||||||
|
---
|
||||||
|
months:
|
||||||
|
0:
|
||||||
|
- name: Ostermontag
|
||||||
|
regions: [at]
|
||||||
|
function: easter(year)+1
|
||||||
|
- name: Christi Himmelfahrt
|
||||||
|
regions: [at]
|
||||||
|
function: easter(year)+39
|
||||||
|
- name: Pfingstmontag
|
||||||
|
regions: [at]
|
||||||
|
function: easter(year)+50
|
||||||
|
- name: Fronleichnam
|
||||||
|
regions: [at]
|
||||||
|
function: easter(year)+60
|
||||||
|
1:
|
||||||
|
- name: Neujahrstag
|
||||||
|
regions: [at]
|
||||||
|
mday: 1
|
||||||
|
- name: Heilige Drei Könige
|
||||||
|
regions: [at]
|
||||||
|
mday: 6
|
||||||
|
5:
|
||||||
|
- name: Staatsfeiertag
|
||||||
|
regions: [at]
|
||||||
|
mday: 1
|
||||||
|
8:
|
||||||
|
- name: Mariä Himmelfahrt
|
||||||
|
regions: [at]
|
||||||
|
mday: 15
|
||||||
|
10:
|
||||||
|
- name: Nationalfeiertag
|
||||||
|
regions: [at]
|
||||||
|
mday: 26
|
||||||
|
11:
|
||||||
|
- name: Allerheiligen
|
||||||
|
regions: [at]
|
||||||
|
mday: 1
|
||||||
|
12:
|
||||||
|
- name: Mariä Empfängnis
|
||||||
|
regions: [at]
|
||||||
|
mday: 8
|
||||||
|
- name: 1. Weihnachtstag
|
||||||
|
regions: [at]
|
||||||
|
mday: 25
|
||||||
|
- name: 2. Weihnachtstag
|
||||||
|
regions: [at]
|
||||||
|
mday: 26
|
||||||
|
tests: |
|
||||||
|
{Date.civil(2009,1,1) => 'Neujahrstag',
|
||||||
|
Date.civil(2009,4,13) => 'Ostermontag',
|
||||||
|
Date.civil(2009,5,1) => 'Staatsfeiertag',
|
||||||
|
Date.civil(2009,5,21) => 'Christi Himmelfahrt',
|
||||||
|
Date.civil(2009,6,1) => 'Pfingstmontag',
|
||||||
|
Date.civil(2009,10,26) => 'Nationalfeiertag',
|
||||||
|
Date.civil(2009,12,25) => '1. Weihnachtstag',
|
||||||
|
Date.civil(2009,12,26) => '2. Weihnachtstag'}.each do |date, name|
|
||||||
|
assert_equal name, (Holidays.on(date, :at, :informal)[0] || {})[:name]
|
||||||
|
end
|
||||||
|
|
||||||
|
assert !Date.civil(2010,5,8).holiday?(:at), '2010-05-08 is not a holiday in Austria'
|
246
holidays.gemspec
246
holidays.gemspec
|
@ -1,168 +1,132 @@
|
||||||
# Generated by jeweler
|
# Generated by jeweler
|
||||||
# DO NOT EDIT THIS FILE DIRECTLY
|
# DO NOT EDIT THIS FILE DIRECTLY
|
||||||
# Instead, edit Jeweler::Tasks in rakefile.rb, and run the gemspec command
|
# Instead, edit Jeweler::Tasks in rakefile.rb, and run 'rake gemspec'
|
||||||
# -*- encoding: utf-8 -*-
|
# -*- encoding: utf-8 -*-
|
||||||
|
|
||||||
Gem::Specification.new do |s|
|
Gem::Specification.new do |s|
|
||||||
s.name = %q{holidays}
|
s.name = %q{holidays}
|
||||||
s.version = "1.0.2"
|
s.version = "1.0.3"
|
||||||
|
|
||||||
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
||||||
s.authors = ["Alex Dunae", "Rowan Crawford"]
|
s.authors = ["Alex Dunae", "Rowan Crawford"]
|
||||||
s.date = %q{2011-05-13}
|
s.date = %q{2011-09-02}
|
||||||
s.description = %q{A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!}
|
s.description = %q{A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!}
|
||||||
s.email = %q{code@dunae.ca}
|
s.email = %q{code@dunae.ca}
|
||||||
s.extra_rdoc_files = [
|
s.extra_rdoc_files = [
|
||||||
"LICENSE",
|
"LICENSE",
|
||||||
"README.rdoc"
|
"README.rdoc"
|
||||||
]
|
]
|
||||||
s.files = [
|
s.files = [
|
||||||
".gitignore",
|
"CHANGELOG",
|
||||||
"CHANGELOG",
|
"LICENSE",
|
||||||
"LICENSE",
|
"README.rdoc",
|
||||||
"README.rdoc",
|
"REFERENCES",
|
||||||
"REFERENCES",
|
"data/SYNTAX.rdoc",
|
||||||
"data/SYNTAX.rdoc",
|
"data/au.yaml",
|
||||||
"data/au.yaml",
|
"data/br.yaml",
|
||||||
"data/br.yaml",
|
"data/build_defs.rb",
|
||||||
"data/build_defs.rb",
|
"data/ca.yaml",
|
||||||
"data/ca.yaml",
|
"data/cz.yaml",
|
||||||
"data/cz.yaml",
|
"data/de.yaml",
|
||||||
"data/de.yaml",
|
"data/dk.yaml",
|
||||||
"data/dk.yaml",
|
"data/el.yaml",
|
||||||
"data/el.yaml",
|
"data/es.yaml",
|
||||||
"data/es.yaml",
|
"data/fi.yaml",
|
||||||
"data/fi.yaml",
|
"data/fr.yaml",
|
||||||
"data/fr.yaml",
|
"data/gb.yaml",
|
||||||
"data/gb.yaml",
|
"data/ie.yaml",
|
||||||
"data/ie.yaml",
|
"data/index.yaml",
|
||||||
"data/index.yaml",
|
"data/is.yaml",
|
||||||
"data/is.yaml",
|
"data/it.yaml",
|
||||||
"data/it.yaml",
|
"data/jp.yaml",
|
||||||
"data/jp.yaml",
|
"data/mx.yaml",
|
||||||
"data/mx.yaml",
|
"data/nl.yaml",
|
||||||
"data/nl.yaml",
|
"data/no.yaml",
|
||||||
"data/no.yaml",
|
"data/north_america_informal.yaml",
|
||||||
"data/north_america_informal.yaml",
|
"data/nyse.yaml",
|
||||||
"data/nyse.yaml",
|
"data/nz.yaml",
|
||||||
"data/nz.yaml",
|
"data/pt.yaml",
|
||||||
"data/pt.yaml",
|
"data/se.yaml",
|
||||||
"data/se.yaml",
|
"data/united_nations.yaml",
|
||||||
"data/united_nations.yaml",
|
"data/ups.yaml",
|
||||||
"data/ups.yaml",
|
"data/us.yaml",
|
||||||
"data/us.yaml",
|
"data/za.yaml",
|
||||||
"data/za.yaml",
|
"holidays.gemspec",
|
||||||
"holidays.gemspec",
|
"lib/holidays.rb",
|
||||||
"lib/holidays.rb",
|
"lib/holidays/MANIFEST",
|
||||||
"lib/holidays/MANIFEST",
|
"lib/holidays/au.rb",
|
||||||
"lib/holidays/au.rb",
|
"lib/holidays/br.rb",
|
||||||
"lib/holidays/br.rb",
|
"lib/holidays/ca.rb",
|
||||||
"lib/holidays/ca.rb",
|
"lib/holidays/cz.rb",
|
||||||
"lib/holidays/cz.rb",
|
"lib/holidays/de.rb",
|
||||||
"lib/holidays/de.rb",
|
"lib/holidays/dk.rb",
|
||||||
"lib/holidays/dk.rb",
|
"lib/holidays/el.rb",
|
||||||
"lib/holidays/el.rb",
|
"lib/holidays/es.rb",
|
||||||
"lib/holidays/es.rb",
|
"lib/holidays/europe.rb",
|
||||||
"lib/holidays/europe.rb",
|
"lib/holidays/fi.rb",
|
||||||
"lib/holidays/fi.rb",
|
"lib/holidays/fr.rb",
|
||||||
"lib/holidays/fr.rb",
|
"lib/holidays/gb.rb",
|
||||||
"lib/holidays/gb.rb",
|
"lib/holidays/ie.rb",
|
||||||
"lib/holidays/ie.rb",
|
"lib/holidays/is.rb",
|
||||||
"lib/holidays/is.rb",
|
"lib/holidays/it.rb",
|
||||||
"lib/holidays/it.rb",
|
"lib/holidays/jp.rb",
|
||||||
"lib/holidays/jp.rb",
|
"lib/holidays/mx.rb",
|
||||||
"lib/holidays/mx.rb",
|
"lib/holidays/nl.rb",
|
||||||
"lib/holidays/nl.rb",
|
"lib/holidays/no.rb",
|
||||||
"lib/holidays/no.rb",
|
"lib/holidays/north_america.rb",
|
||||||
"lib/holidays/north_america.rb",
|
"lib/holidays/nyse.rb",
|
||||||
"lib/holidays/nyse.rb",
|
"lib/holidays/nz.rb",
|
||||||
"lib/holidays/nz.rb",
|
"lib/holidays/pt.rb",
|
||||||
"lib/holidays/pt.rb",
|
"lib/holidays/scandinavia.rb",
|
||||||
"lib/holidays/scandinavia.rb",
|
"lib/holidays/se.rb",
|
||||||
"lib/holidays/se.rb",
|
"lib/holidays/united_nations.rb",
|
||||||
"lib/holidays/united_nations.rb",
|
"lib/holidays/ups.rb",
|
||||||
"lib/holidays/ups.rb",
|
"lib/holidays/us.rb",
|
||||||
"lib/holidays/us.rb",
|
"lib/holidays/za.rb",
|
||||||
"lib/holidays/za.rb",
|
"rakefile.rb",
|
||||||
"rakefile.rb",
|
"test/defs/test_defs_au.rb",
|
||||||
"test/defs/test_defs_au.rb",
|
"test/defs/test_defs_br.rb",
|
||||||
"test/defs/test_defs_br.rb",
|
"test/defs/test_defs_ca.rb",
|
||||||
"test/defs/test_defs_ca.rb",
|
"test/defs/test_defs_cz.rb",
|
||||||
"test/defs/test_defs_cz.rb",
|
"test/defs/test_defs_de.rb",
|
||||||
"test/defs/test_defs_de.rb",
|
"test/defs/test_defs_dk.rb",
|
||||||
"test/defs/test_defs_dk.rb",
|
"test/defs/test_defs_el.rb",
|
||||||
"test/defs/test_defs_el.rb",
|
"test/defs/test_defs_es.rb",
|
||||||
"test/defs/test_defs_es.rb",
|
"test/defs/test_defs_europe.rb",
|
||||||
"test/defs/test_defs_europe.rb",
|
"test/defs/test_defs_fi.rb",
|
||||||
"test/defs/test_defs_fi.rb",
|
"test/defs/test_defs_fr.rb",
|
||||||
"test/defs/test_defs_fr.rb",
|
"test/defs/test_defs_gb.rb",
|
||||||
"test/defs/test_defs_gb.rb",
|
"test/defs/test_defs_ie.rb",
|
||||||
"test/defs/test_defs_ie.rb",
|
"test/defs/test_defs_is.rb",
|
||||||
"test/defs/test_defs_is.rb",
|
"test/defs/test_defs_it.rb",
|
||||||
"test/defs/test_defs_it.rb",
|
"test/defs/test_defs_jp.rb",
|
||||||
"test/defs/test_defs_jp.rb",
|
"test/defs/test_defs_mx.rb",
|
||||||
"test/defs/test_defs_mx.rb",
|
"test/defs/test_defs_nl.rb",
|
||||||
"test/defs/test_defs_nl.rb",
|
"test/defs/test_defs_no.rb",
|
||||||
"test/defs/test_defs_no.rb",
|
"test/defs/test_defs_north_america.rb",
|
||||||
"test/defs/test_defs_north_america.rb",
|
"test/defs/test_defs_nyse.rb",
|
||||||
"test/defs/test_defs_nyse.rb",
|
"test/defs/test_defs_nz.rb",
|
||||||
"test/defs/test_defs_nz.rb",
|
"test/defs/test_defs_pt.rb",
|
||||||
"test/defs/test_defs_pt.rb",
|
"test/defs/test_defs_scandinavia.rb",
|
||||||
"test/defs/test_defs_scandinavia.rb",
|
"test/defs/test_defs_se.rb",
|
||||||
"test/defs/test_defs_se.rb",
|
"test/defs/test_defs_ups.rb",
|
||||||
"test/defs/test_defs_ups.rb",
|
"test/defs/test_defs_us.rb",
|
||||||
"test/defs/test_defs_us.rb",
|
"test/defs/test_defs_za.rb",
|
||||||
"test/defs/test_defs_za.rb",
|
"test/test_date.rb",
|
||||||
"test/test_date.rb",
|
"test/test_helper.rb",
|
||||||
"test/test_helper.rb",
|
"test/test_holidays.rb",
|
||||||
"test/test_holidays.rb",
|
"test/test_multiple_regions.rb"
|
||||||
"test/test_multiple_regions.rb"
|
|
||||||
]
|
]
|
||||||
s.homepage = %q{https://github.com/alexdunae/holidays}
|
s.homepage = %q{https://github.com/alexdunae/holidays}
|
||||||
s.rdoc_options = ["--charset=UTF-8"]
|
|
||||||
s.require_paths = ["lib"]
|
s.require_paths = ["lib"]
|
||||||
s.rubygems_version = %q{1.3.7}
|
s.rubygems_version = %q{1.3.6}
|
||||||
s.summary = %q{A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!}
|
s.summary = %q{A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!}
|
||||||
s.test_files = [
|
|
||||||
"test/defs/test_defs_au.rb",
|
|
||||||
"test/defs/test_defs_br.rb",
|
|
||||||
"test/defs/test_defs_ca.rb",
|
|
||||||
"test/defs/test_defs_cz.rb",
|
|
||||||
"test/defs/test_defs_de.rb",
|
|
||||||
"test/defs/test_defs_dk.rb",
|
|
||||||
"test/defs/test_defs_el.rb",
|
|
||||||
"test/defs/test_defs_es.rb",
|
|
||||||
"test/defs/test_defs_europe.rb",
|
|
||||||
"test/defs/test_defs_fi.rb",
|
|
||||||
"test/defs/test_defs_fr.rb",
|
|
||||||
"test/defs/test_defs_gb.rb",
|
|
||||||
"test/defs/test_defs_ie.rb",
|
|
||||||
"test/defs/test_defs_is.rb",
|
|
||||||
"test/defs/test_defs_it.rb",
|
|
||||||
"test/defs/test_defs_jp.rb",
|
|
||||||
"test/defs/test_defs_mx.rb",
|
|
||||||
"test/defs/test_defs_nl.rb",
|
|
||||||
"test/defs/test_defs_no.rb",
|
|
||||||
"test/defs/test_defs_north_america.rb",
|
|
||||||
"test/defs/test_defs_nyse.rb",
|
|
||||||
"test/defs/test_defs_nz.rb",
|
|
||||||
"test/defs/test_defs_pt.rb",
|
|
||||||
"test/defs/test_defs_scandinavia.rb",
|
|
||||||
"test/defs/test_defs_se.rb",
|
|
||||||
"test/defs/test_defs_ups.rb",
|
|
||||||
"test/defs/test_defs_us.rb",
|
|
||||||
"test/defs/test_defs_za.rb",
|
|
||||||
"test/test_date.rb",
|
|
||||||
"test/test_helper.rb",
|
|
||||||
"test/test_holidays.rb",
|
|
||||||
"test/test_multiple_regions.rb"
|
|
||||||
]
|
|
||||||
|
|
||||||
if s.respond_to? :specification_version then
|
if s.respond_to? :specification_version then
|
||||||
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
||||||
s.specification_version = 3
|
s.specification_version = 3
|
||||||
|
|
||||||
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
||||||
else
|
else
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|
37
lib/holidays/at.rb
Normal file
37
lib/holidays/at.rb
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
# encoding: utf-8
|
||||||
|
module Holidays
|
||||||
|
# This file is generated by the Ruby Holiday gem.
|
||||||
|
#
|
||||||
|
# Definitions loaded: data/at.yaml
|
||||||
|
#
|
||||||
|
# To use the definitions in this file, load them right after you load the
|
||||||
|
# Holiday gem:
|
||||||
|
#
|
||||||
|
# require 'holidays'
|
||||||
|
# require 'holidays/at'
|
||||||
|
#
|
||||||
|
# More definitions are available at http://code.dunae.ca/holidays.
|
||||||
|
module AT # :nodoc:
|
||||||
|
DEFINED_REGIONS = [:at]
|
||||||
|
|
||||||
|
HOLIDAYS_BY_MONTH = {
|
||||||
|
5 => [{:mday => 1, :name => "Staatsfeiertag", :regions => [:at]}],
|
||||||
|
0 => [{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Ostermontag", :regions => [:at]},
|
||||||
|
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Christi Himmelfahrt", :regions => [:at]},
|
||||||
|
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pfingstmontag", :regions => [:at]},
|
||||||
|
{:function => lambda { |year| Holidays.easter(year)+60 }, :function_id => "easter(year)+60", :name => "Fronleichnam", :regions => [:at]}],
|
||||||
|
11 => [{:mday => 1, :name => "Allerheiligen", :regions => [:at]}],
|
||||||
|
1 => [{:mday => 1, :name => "Neujahrstag", :regions => [:at]},
|
||||||
|
{:mday => 6, :name => "Heilige Drei Könige", :regions => [:at]}],
|
||||||
|
12 => [{:mday => 8, :name => "Mariä Empfängnis", :regions => [:at]},
|
||||||
|
{:mday => 25, :name => "1. Weihnachtstag", :regions => [:at]},
|
||||||
|
{:mday => 26, :name => "2. Weihnachtstag", :regions => [:at]}],
|
||||||
|
8 => [{:mday => 15, :name => "Mariä Himmelfahrt", :regions => [:at]}],
|
||||||
|
10 => [{:mday => 26, :name => "Nationalfeiertag", :regions => [:at]}]
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
Holidays.merge_defs(Holidays::AT::DEFINED_REGIONS, Holidays::AT::HOLIDAYS_BY_MONTH)
|
24
test/defs/test_defs_at.rb
Normal file
24
test/defs/test_defs_at.rb
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# encoding: utf-8
|
||||||
|
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
||||||
|
|
||||||
|
# This file is generated by the Ruby Holiday gem.
|
||||||
|
#
|
||||||
|
# Definitions loaded: data/at.yaml
|
||||||
|
class AtDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||||
|
|
||||||
|
def test_at
|
||||||
|
{Date.civil(2009,1,1) => 'Neujahrstag',
|
||||||
|
Date.civil(2009,4,13) => 'Ostermontag',
|
||||||
|
Date.civil(2009,5,1) => 'Staatsfeiertag',
|
||||||
|
Date.civil(2009,5,21) => 'Christi Himmelfahrt',
|
||||||
|
Date.civil(2009,6,1) => 'Pfingstmontag',
|
||||||
|
Date.civil(2009,10,26) => 'Nationalfeiertag',
|
||||||
|
Date.civil(2009,12,25) => '1. Weihnachtstag',
|
||||||
|
Date.civil(2009,12,26) => '2. Weihnachtstag'}.each do |date, name|
|
||||||
|
assert_equal name, (Holidays.on(date, :at, :informal)[0] || {})[:name]
|
||||||
|
end
|
||||||
|
|
||||||
|
assert !Date.civil(2010,5,8).holiday?(:at), '2010-05-08 is not a holiday in Austria'
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Reference in a new issue