Compare commits
128 Commits
Author | SHA1 | Date |
---|---|---|
Denis Knauf | 87a6702a28 | |
Alex Dunae | 51d6c095ad | |
Alex Dunae | d1af175150 | |
Alex Dunae | 1e8b10e88a | |
Alex Dunae | 3f23f56c9a | |
Alex Dunae | 8f60480c8b | |
Alex Dunae | 16b76b19f2 | |
Alex Dunae | 9567872aeb | |
Alex Dunae | 88012e8f7e | |
Alex Dunae | d39f6edf67 | |
Alex Dunae | f08ffe5bcb | |
Alex Dunae | c3c34bde1b | |
Alex Dunae | 9dea239b9e | |
Alex Dunae | 1052448108 | |
Alex Dunae | 3e57241f89 | |
Alex Dunae | 945f9a45cd | |
Alex Dunae | ff8f8162b9 | |
Alex Dunae | e863146e6f | |
asaletnik | 0abe91ffc4 | |
asaletnik | 48639c7fc0 | |
Alex Dunae | 05b8241dea | |
Alex Dunae | 46c39f82b3 | |
Alex Dunae | cd82b4d043 | |
Alex Dunae | 2fd71e750a | |
Alex Dunae | ce5a7d09d2 | |
Alex Dunae | ea96ff92ee | |
Alex Dunae | 1d838f0311 | |
Alex Dunae | 53590321d5 | |
Dimitris Dimitriadis | 1ea53be709 | |
Alex Dunae | 16e93ab5d8 | |
Alex Dunae | 61d90c32d0 | |
Alex Dunae | 334d9034cd | |
Alex Dunae | aba033ab0e | |
Alex Dunae | 838f555fb9 | |
Jesse Ikonen | 61ce0bbbeb | |
Jesse Ikonen | ff9096b210 | |
Tatsuki Sugiura | c3bf468593 | |
Alex Dunae | c7e7f0fe36 | |
Alex Dunae | da7f4396d9 | |
Alex Dunae | b94712703d | |
Alex Dunae | 912292b087 | |
Alex Dunae | f7749920f8 | |
Alex Dunae | 962989c326 | |
Alex Dunae | b7a288fdcd | |
Rowan Crawford | 5b19ac8ee4 | |
Rowan Crawford | 7901d65a43 | |
Alex Dunae | 474e1b660c | |
Alex Dunae | 2b6d5c1b15 | |
Alex Dunae | f2f9e6ca1c | |
Rowan Crawford | c33fa25828 | |
Rowan Crawford | fa6ad64f81 | |
Rowan Crawford | 0aeaae378f | |
Rowan Crawford | 642c53319f | |
Rowan Crawford | 608f677039 | |
Rowan Crawford | de3f744e7d | |
Rowan Crawford | a8d5a60b0d | |
Rowan Crawford | 629240e340 | |
Rowan Crawford | 406b1dd28f | |
Alex Dunae | 40f393d529 | |
Rowan Crawford | 202fc7a1e6 | |
Rowan Crawford | 0cdc9c1387 | |
Rowan Crawford | f62d0780f5 | |
Rowan Crawford | debbf6d411 | |
Rowan Crawford | cc349f316b | |
Rowan Crawford | a77ab4fd17 | |
Rowan Crawford | 6f63d6cfcd | |
Rowan Crawford | 8fe1e0ed34 | |
Rowan Crawford | 0813ac7125 | |
Rowan Crawford | b8b74917c9 | |
Rowan Crawford | e9970c2fcb | |
Rowan Crawford | 81f24a7cf4 | |
Rowan Crawford | b4376c3712 | |
Rowan Crawford | 15bc19082b | |
Rowan Crawford | 29b3572a91 | |
Rowan Crawford | 1a7a358f5d | |
Rowan Crawford | 0b0d77fea2 | |
Rowan Crawford | f9994238d8 | |
Rowan Crawford | ae22b6185d | |
Rowan Crawford | 0f25db8280 | |
Rowan Crawford | 8377f836c8 | |
Rowan Crawford | 06fd515be3 | |
Rowan Crawford | c6a2001aee | |
Rowan Crawford | d9c7e829dd | |
Rowan Crawford | adc5cfcc59 | |
Rowan Crawford | 4ab8d781ec | |
Rowan Crawford | 43f1bfd748 | |
Rowan Crawford | 7294779692 | |
Rowan Crawford | 328584540d | |
Rowan Crawford | 0a3e9aa10a | |
Rowan Crawford | 0cd4bae37a | |
Rowan Crawford | bac7659a6d | |
Rowan Crawford | f7118f37ad | |
alexdunae | acea5b6cf1 | |
alexdunae | 9a00c6cea2 | |
alexdunae | 0d71aa38d5 | |
alexdunae | 5dec1f7081 | |
alexdunae | 0e10fbfb88 | |
alexdunae | 57dead53f3 | |
alexdunae | b81fc99197 | |
alexdunae | 7cbf7e5409 | |
alexdunae | 3728992d4b | |
alexdunae | 15777f288d | |
alexdunae | 333afb75b9 | |
Demeter István (qw3r) | 833774b3c3 | |
Bohuslav Blín | 024b4b2c0f | |
Bodaniel Jeanes | 3018cb4d53 | |
Bodaniel Jeanes | bdeee809aa | |
Dirk Grambow | 0641484999 | |
Dirk Grambow | 7ddbf8cf47 | |
Alex Dunae | 1b2717d530 | |
Dirk Grambow | 30d0224685 | |
Dirk Grambow | 04370c1fed | |
Dirk Grambow | 49c9445ab6 | |
Fabio Kreusch | 4184ddd9e2 | |
Alex Dunae | fa067ba34f | |
Alex Dunae | a7e0024438 | |
Alex Dunae | 6cf2ca9559 | |
Alex Dunae | df9b7fffdd | |
Alex Dunae | 89cccd81a4 | |
Alex Dunae | 0730f27b2c | |
Alex Dunae | a63b4cacec | |
Alex Dunae | 36cefe2d49 | |
Alex Dunae | f8093ee712 | |
Alex Dunae | f0c8a54e9b | |
Alex Dunae | faaf8e8593 | |
Alex Dunae | 429abc9a6c | |
Alex Dunae | 206f610cc9 | |
Alex Dunae | 940e5d6df1 |
|
@ -0,0 +1,6 @@
|
|||
.DS_Store
|
||||
*.gem
|
||||
nbproject
|
||||
doc/
|
||||
rdoc/
|
||||
Gemfile.lock
|
|
@ -0,0 +1,8 @@
|
|||
notifications:
|
||||
disabled: true
|
||||
rvm:
|
||||
- 1.8.7
|
||||
- 1.9.2
|
||||
- 1.9.3
|
||||
- jruby
|
||||
- ree
|
24
CHANGELOG
24
CHANGELOG
|
@ -1,5 +1,29 @@
|
|||
= Ruby Holidays Gem CHANGELOG
|
||||
|
||||
== 1.0.4
|
||||
* Add Liechtenstein holiday defs (mercy vielmal Bernhard Furtmueller)
|
||||
|
||||
== 1.0.3
|
||||
* Add Austrian holiday definitions (thanks to Vogel Siegfried)
|
||||
|
||||
== 1.0.2
|
||||
* Add `orthodox_easter` method and Greek holiday definitions (thanks https://github.com/ddimitriadis)
|
||||
|
||||
== 1.0.0
|
||||
* Support calculating mday from negative weeks other than -1 (thanks http://github.com/bjeanes)
|
||||
* Use class method to check leap years and fixed bug in Date.calculate_mday
|
||||
(thanks http://github.com/dgrambow)
|
||||
* Added Czech (thanks http://github.com/boblin), Brazilian (http://github.com/fabiokr), Norwegian (thanks to Peter Skeide) and Australia/Brisbane (http://github.com/bjeanes) definitions
|
||||
* Cleaned up rake and gemspec
|
||||
|
||||
== 0.9.3
|
||||
* Added New York Stock Exchange holidays (thank you Alan Larkin).
|
||||
* Added UPS holidays (thank you Tim Anglade).
|
||||
* Fixed rakefile to force lower case definition file names.
|
||||
|
||||
== 0.9.2
|
||||
* Included rakefile in Gem (thank you James Herdman).
|
||||
|
||||
== 0.9.1
|
||||
* au.yaml was being included incorrectly in US holiday definitions. Thanks to Glenn Vanderburg (http://vanderburg.org/) for the fix.
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
source "http://rubygems.org"
|
||||
|
||||
gemspec
|
||||
|
||||
group :test, :development do
|
||||
gem 'rake'
|
||||
gem 'rdoc', '>= 2.4.2'
|
||||
end
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
|||
==== Ruby Holidays Gem License
|
||||
|
||||
Copyright (c) 2007 Alex Dunae
|
||||
Copyright (c) 2007-11 Alex Dunae
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
@ -1,76 +1,73 @@
|
|||
= Ruby Holidays Gem
|
||||
|
||||
A set of functions to deal with holidays in Ruby.
|
||||
|
||||
|
||||
Extends Ruby's built-in Date class and supports custom holiday definition lists.
|
||||
|
||||
|
||||
=== Installation
|
||||
|
||||
To install the gem from RubyForge:
|
||||
|
||||
|
||||
To install the gem from RubyGems:
|
||||
|
||||
gem install holidays
|
||||
|
||||
Or, download the source <tt>.tgz</tt> file from http://rubyforge.org/holidays and
|
||||
extract it somewhere in your include path.
|
||||
|
||||
|
||||
=== Examples
|
||||
|
||||
|
||||
For more information, see the notes at the top of the Holidays module.
|
||||
|
||||
|
||||
==== Using the Holidays class
|
||||
Get all holidays on April 25, 2008 in Australia.
|
||||
date = Date.civil(2008,4,25)
|
||||
|
||||
|
||||
Holidays.on(date, :au)
|
||||
=> [{:name => 'ANZAC Day',...}]
|
||||
|
||||
|
||||
Get holidays that are observed on July 2, 2007 in British Columbia, Canada.
|
||||
date = Date.civil(2007,7,2)
|
||||
|
||||
|
||||
Holidays.on(date, :ca_bc, :observed)
|
||||
=> [{:name => 'Canada Day',...}]
|
||||
|
||||
|
||||
Get all holidays in July, 2008 in Canada and the US.
|
||||
from = Date.civil(2008,7,1)
|
||||
to = Date.civil(2008,7,31)
|
||||
|
||||
to = Date.civil(2008,7,31)
|
||||
|
||||
Holidays.between(from, to, :ca, :us)
|
||||
=> [{:name => 'Canada Day',...}
|
||||
{:name => 'Independence Day',...}]
|
||||
|
||||
|
||||
Get informal holidays in February.
|
||||
from = Date.civil(2008,2,1)
|
||||
to = Date.civil(2008,2,15)
|
||||
|
||||
to = Date.civil(2008,2,15)
|
||||
|
||||
Holidays.between(from, to)
|
||||
=> [{:name => 'Valentine\'s Day',...}]
|
||||
|
||||
|
||||
|
||||
|
||||
==== Extending Ruby's Date class
|
||||
Check which holidays occur in Iceland on January 1, 2008.
|
||||
d = Date.civil(2008,7,1)
|
||||
|
||||
|
||||
d.holidays(:is)
|
||||
=> [{:name => 'Nýársdagur'}...]
|
||||
|
||||
|
||||
Lookup Canada Day in different regions.
|
||||
d = Date.civil(2008,7,1)
|
||||
|
||||
d.holiday?(:ca) # Canada
|
||||
|
||||
d.holiday?(:ca) # Canada
|
||||
=> true
|
||||
|
||||
d.holiday?(:ca_bc) # British Columbia, Canada
|
||||
|
||||
d.holiday?(:ca_bc) # British Columbia, Canada
|
||||
=> true
|
||||
|
||||
d.holiday?(:fr) # France
|
||||
|
||||
d.holiday?(:fr) # France
|
||||
=> false
|
||||
|
||||
|
||||
=== Credits and code
|
||||
|
||||
* Project page: http://code.dunae.ca/holidays
|
||||
* Source: http://code.dunae.ca/svn/holidays
|
||||
* Docs: http://code.dunae.ca/holidays/doc
|
||||
|
||||
By Alex Dunae (dunae.ca, e-mail 'code' at the same domain), 2007.
|
||||
|
||||
Made on Vancouver Island.
|
||||
|
||||
* Source: https://github.com/alexdunae/holidays
|
||||
* Docs: http://rdoc.info/github/alexdunae/holidays/master/frames
|
||||
* Contributors: https://github.com/alexdunae/holidays/contributors
|
||||
|
||||
Started by Alex Dunae (dunae.ca, e-mail 'code' at the same domain), 2007-11.
|
||||
|
||||
Made on Vancouver Island.
|
|
@ -11,7 +11,7 @@ Holidays are grouped by month from 1 through 12. Each entry within a month can
|
|||
|
||||
===== Dates defined by a fixed date (e.g. January 1st)
|
||||
|
||||
[<tt>wday</tt>] Integer representing day of the month (1 through 31).
|
||||
[<tt>mday</tt>] Integer representing day of the month (1 through 31).
|
||||
|
||||
For example, the following holiday is on the first of January and available in the <tt>ca</tt>, <tt>us</tt> and <tt>au</tt> regions.
|
||||
|
||||
|
@ -101,7 +101,7 @@ All definition files should have tests included. In the YAML file, tests are ju
|
|||
Date.civil(2008,9,1) => 'Labour Day',
|
||||
Date.civil(2008,12,25) => 'Christmas Day',
|
||||
Date.civil(2008,12,26) => 'Boxing Day'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :ca, :informal)[0][:name]
|
||||
assert_equal name, (Holidays.on(date, :ca, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Victoria Day
|
|
@ -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ägnis
|
||||
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'
|
215
data/au.yaml
215
data/au.yaml
|
@ -1,106 +1,111 @@
|
|||
# Australian holiday definitions for the Ruby Holiday gem.
|
||||
# Updated: 2008-11-29.
|
||||
# Sources:
|
||||
# - http://en.wikipedia.org/wiki/Australian_public_holidays
|
||||
# - http://www.docep.wa.gov.au/lr/LabourRelations/Content/Wages%20and%20Conditions/Public%20Holidays/Public_Holidays.html
|
||||
# - http://www.wst.tas.gov.au/employment_info/public_holidays
|
||||
# TODO: missing some regional holidays
|
||||
---
|
||||
months:
|
||||
0:
|
||||
- name: Good Friday
|
||||
regions: [au]
|
||||
function: easter(year)-2
|
||||
- name: Easter Saturday
|
||||
regions: [au]
|
||||
function: easter(year)-1
|
||||
- name: Easter Monday
|
||||
regions: [au]
|
||||
function: easter(year)+1
|
||||
- name: Easter Monday
|
||||
regions: [au_tas]
|
||||
function: easter(year)+2
|
||||
1:
|
||||
- name: New Year's Day
|
||||
regions: [au]
|
||||
mday: 1
|
||||
- name: Australia Day
|
||||
regions: [au]
|
||||
mday: 26
|
||||
3:
|
||||
- name: Labour Day
|
||||
regions: [au_wa]
|
||||
week: 1
|
||||
wday: 1
|
||||
- name: Eight Hours Day
|
||||
regions: [au_tas]
|
||||
week: 2
|
||||
wday: 1
|
||||
- name: Labour Day
|
||||
regions: [au_vic]
|
||||
week: 2
|
||||
wday: 1
|
||||
4:
|
||||
- name: ANZAC Day
|
||||
regions: [au]
|
||||
mday: 25
|
||||
5:
|
||||
- name: Labour Day
|
||||
regions: [au_qld]
|
||||
week: 1
|
||||
wday: 1
|
||||
- name: May Day
|
||||
regions: [au_nt]
|
||||
week: 1
|
||||
wday: 1
|
||||
6:
|
||||
- name: Foundation Day
|
||||
regions: [au_wa]
|
||||
week: 1
|
||||
wday: 1
|
||||
- name: Queen's Birthday
|
||||
regions: [au_act, au_nsw, au_sa, au_tas, au_nt, au_qld, au_vic]
|
||||
week: 2
|
||||
wday: 1
|
||||
- name: Queensland Day
|
||||
regions: [au_qld]
|
||||
mday: 6
|
||||
type: informal
|
||||
10:
|
||||
- name: Labour Day
|
||||
regions: [au_act, au_nsw, au_sa]
|
||||
week: 1
|
||||
wday: 1
|
||||
12:
|
||||
- name: Christmas Day
|
||||
regions: [au]
|
||||
mday: 25
|
||||
- name: Boxing Day
|
||||
regions: [au]
|
||||
mday: 26
|
||||
tests: |
|
||||
{Date.civil(2007,1,1) => 'New Year\'s Day',
|
||||
Date.civil(2007,1,26) => 'Australia Day',
|
||||
Date.civil(2007,4,6) => 'Good Friday',
|
||||
Date.civil(2007,4,9) => 'Easter Monday',
|
||||
Date.civil(2007,4,25) => 'ANZAC Day',
|
||||
Date.civil(2007,12,25) => 'Christmas Day',
|
||||
Date.civil(2007,12,26) => 'Boxing Day'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :au, :informal)[0][:name]
|
||||
end
|
||||
|
||||
[:au_sa, :au_act, :au_nsw, :au_].each do |r|
|
||||
assert_equal 'Labour Day', Date.civil(2007,10,1).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:au_sa, :au_act, :au_nsw, :au_vic, :au_tas, :au_qld, :au_nt, :au_].each do |r|
|
||||
assert_equal 'Queen\'s Birthday', Date.civil(2007,6,11).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
assert_equal 'Labour Day', Date.civil(2007,3,5).holidays(:au_wa)[0][:name]
|
||||
assert_equal 'Labour Day', Date.civil(2007,3,12).holidays(:au_vic)[0][:name]
|
||||
assert_equal 'Labour Day', Date.civil(2007,5,7).holidays(:au_qld)[0][:name]
|
||||
|
||||
assert_equal 'May Day', Date.civil(2007,5,7).holidays(:au_nt)[0][:name]
|
||||
|
||||
# Australian holiday definitions for the Ruby Holiday gem.
|
||||
# Updated: 2008-11-29.
|
||||
# Sources:
|
||||
# - http://en.wikipedia.org/wiki/Australian_public_holidays
|
||||
# - http://www.docep.wa.gov.au/lr/LabourRelations/Content/Wages%20and%20Conditions/Public%20Holidays/Public_Holidays.html
|
||||
# - http://www.wst.tas.gov.au/employment_info/public_holidays
|
||||
# TODO: missing some regional holidays
|
||||
---
|
||||
months:
|
||||
0:
|
||||
- name: Good Friday
|
||||
regions: [au]
|
||||
function: easter(year)-2
|
||||
- name: Easter Saturday
|
||||
regions: [au]
|
||||
function: easter(year)-1
|
||||
- name: Easter Monday
|
||||
regions: [au]
|
||||
function: easter(year)+1
|
||||
- name: Easter Monday
|
||||
regions: [au_tas]
|
||||
function: easter(year)+2
|
||||
1:
|
||||
- name: New Year's Day
|
||||
regions: [au]
|
||||
mday: 1
|
||||
- name: Australia Day
|
||||
regions: [au]
|
||||
mday: 26
|
||||
3:
|
||||
- name: Labour Day
|
||||
regions: [au_wa]
|
||||
week: 1
|
||||
wday: 1
|
||||
- name: Eight Hours Day
|
||||
regions: [au_tas]
|
||||
week: 2
|
||||
wday: 1
|
||||
- name: Labour Day
|
||||
regions: [au_vic]
|
||||
week: 2
|
||||
wday: 1
|
||||
4:
|
||||
- name: ANZAC Day
|
||||
regions: [au]
|
||||
mday: 25
|
||||
5:
|
||||
- name: Labour Day
|
||||
regions: [au_qld]
|
||||
week: 1
|
||||
wday: 1
|
||||
- name: May Day
|
||||
regions: [au_nt]
|
||||
week: 1
|
||||
wday: 1
|
||||
6:
|
||||
- name: Foundation Day
|
||||
regions: [au_wa]
|
||||
week: 1
|
||||
wday: 1
|
||||
- name: Queen's Birthday
|
||||
regions: [au_act, au_nsw, au_sa, au_tas, au_nt, au_qld, au_vic]
|
||||
week: 2
|
||||
wday: 1
|
||||
- name: Queensland Day
|
||||
regions: [au_qld]
|
||||
mday: 6
|
||||
type: informal
|
||||
8:
|
||||
- name: Ekka
|
||||
regions: [au_qld_brisbane]
|
||||
week: -3
|
||||
wday: 3
|
||||
10:
|
||||
- name: Labour Day
|
||||
regions: [au_act, au_nsw, au_sa]
|
||||
week: 1
|
||||
wday: 1
|
||||
12:
|
||||
- name: Christmas Day
|
||||
regions: [au]
|
||||
mday: 25
|
||||
- name: Boxing Day
|
||||
regions: [au]
|
||||
mday: 26
|
||||
tests: |
|
||||
{Date.civil(2007,1,1) => 'New Year\'s Day',
|
||||
Date.civil(2007,1,26) => 'Australia Day',
|
||||
Date.civil(2007,4,6) => 'Good Friday',
|
||||
Date.civil(2007,4,9) => 'Easter Monday',
|
||||
Date.civil(2007,4,25) => 'ANZAC Day',
|
||||
Date.civil(2007,12,25) => 'Christmas Day',
|
||||
Date.civil(2007,12,26) => 'Boxing Day'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :au, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
[:au_sa, :au_act, :au_nsw, :au_].each do |r|
|
||||
assert_equal 'Labour Day', Date.civil(2007,10,1).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:au_sa, :au_act, :au_nsw, :au_vic, :au_tas, :au_qld, :au_nt, :au_].each do |r|
|
||||
assert_equal 'Queen\'s Birthday', Date.civil(2007,6,11).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
assert_equal 'Labour Day', Date.civil(2007,3,5).holidays(:au_wa)[0][:name]
|
||||
assert_equal 'Labour Day', Date.civil(2007,3,12).holidays(:au_vic)[0][:name]
|
||||
assert_equal 'Labour Day', Date.civil(2007,5,7).holidays(:au_qld)[0][:name]
|
||||
|
||||
assert_equal 'May Day', Date.civil(2007,5,7).holidays(:au_nt)[0][:name]
|
||||
|
||||
assert_equal 'Eight Hours Day', Date.civil(2007,3,12).holidays(:au_tas)[0][:name]
|
|
@ -0,0 +1,74 @@
|
|||
# Brazilian holiday definitions for the Ruby Holiday gem.
|
||||
# Provided by Rogério Carrasqueira
|
||||
#
|
||||
# Updated: 2008-11-28.
|
||||
# Sources:
|
||||
# - http://pt.wikipedia.org/wiki/Feriados_no_Brasil
|
||||
|
||||
---
|
||||
months:
|
||||
0:
|
||||
- name: Carnaval # same as Shrove Tuesday
|
||||
regions: [br]
|
||||
function: easter(year)-47
|
||||
type: informal
|
||||
- name: Sexta-feira Santa
|
||||
regions: [br]
|
||||
function: easter(year)-2
|
||||
- name: Páscoa
|
||||
regions: [br]
|
||||
function: easter(year)
|
||||
- name: Corpus Christ
|
||||
regions: [br]
|
||||
function: easter(year)+60
|
||||
1:
|
||||
- name: Dia da Confraternização Universal
|
||||
regions: [br]
|
||||
mday: 1
|
||||
4:
|
||||
- name: Dia de Tiradentes
|
||||
regions: [br]
|
||||
mday: 21
|
||||
5:
|
||||
- name: Dia do Trabalho
|
||||
regions: [br]
|
||||
mday: 1
|
||||
9:
|
||||
- name: Proclamação da Independência
|
||||
regions: [br]
|
||||
mday: 7
|
||||
10:
|
||||
- name: Dia de Nossa Senhora Aparecida
|
||||
regions: [br]
|
||||
mday: 12
|
||||
11:
|
||||
- name: Dia de Finados
|
||||
regions: [br]
|
||||
mday: 2
|
||||
- name: Proclamação da República
|
||||
regions: [br]
|
||||
mday: 15
|
||||
12:
|
||||
- name: Natal
|
||||
regions: [br]
|
||||
mday: 25
|
||||
tests: |
|
||||
{Date.civil(2008,1,1) => 'Dia da Confraternização Universal',
|
||||
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,21) => 'Sexta-feira Santa',
|
||||
Date.civil(2008,3,23) => 'Páscoa',
|
||||
Date.civil(2008,4,21) => 'Dia de Tiradentes',
|
||||
Date.civil(2008,5,1) => 'Dia do Trabalho',
|
||||
Date.civil(2005,5,26) => 'Corpus Christ',
|
||||
Date.civil(2007,6,7) => 'Corpus Christ',
|
||||
Date.civil(2008,5,22) => 'Corpus Christ',
|
||||
Date.civil(2008,9,7) => 'Proclamação da Independência',
|
||||
Date.civil(2008,10,12) => 'Dia de Nossa Senhora Aparecida',
|
||||
Date.civil(2008,11,2) => 'Dia de Finados',
|
||||
Date.civil(2008,11,15) => 'Proclamação da República',
|
||||
Date.civil(2008,12,25) => 'Natal'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :br, :informal)[0] || {})[:name]
|
||||
end
|
|
@ -52,7 +52,7 @@ def parse_holiday_defs(module_name, files)
|
|||
end
|
||||
|
||||
if def_file['tests']
|
||||
puts " - importing testings..."
|
||||
puts " - importing tests..."
|
||||
test_strs << def_file['tests']
|
||||
end
|
||||
end
|
||||
|
@ -102,38 +102,43 @@ def parse_holiday_defs(module_name, files)
|
|||
|
||||
# Build the module file
|
||||
module_src =<<-EOM
|
||||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: #{files.join(', ')}
|
||||
#
|
||||
# To use the definitions in this file, load them right after you load the
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/#{module_name.downcase}'
|
||||
#
|
||||
# More definitions are available at http://code.dunae.ca/holidays.
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module #{module_name} # :nodoc:
|
||||
DEFINED_REGIONS = [:#{regions.flatten.uniq.join(', :')}]
|
||||
def self.defined_regions
|
||||
[:#{regions.flatten.uniq.join(', :')}]
|
||||
end
|
||||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
#{month_strs.join(",\n")}
|
||||
}
|
||||
def self.holidays_by_month
|
||||
{
|
||||
#{month_strs.join(",\n")}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
#{method_str}
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::#{module_name}::DEFINED_REGIONS, Holidays::#{module_name}::HOLIDAYS_BY_MONTH)
|
||||
Holidays.merge_defs(Holidays::#{module_name}.defined_regions, Holidays::#{module_name}.holidays_by_month)
|
||||
EOM
|
||||
|
||||
|
||||
# Build the test file
|
||||
unless test_strs.empty?
|
||||
test_src =<<-EndOfTests
|
||||
require File.dirname(__FILE__) + '/../test_helper'
|
||||
require 'holidays/#{module_name.downcase}'
|
||||
# encoding: utf-8
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
|
|
280
data/ca.yaml
280
data/ca.yaml
|
@ -1,141 +1,141 @@
|
|||
# Canadian holiday definitions for the Ruby Holiday gem.
|
||||
# Updated 2008-11-21.
|
||||
---
|
||||
months:
|
||||
0:
|
||||
- name: Good Friday
|
||||
regions: [ca]
|
||||
function: easter(year)-2
|
||||
- name: Easter Monday
|
||||
regions: [ca]
|
||||
function: easter(year)+1
|
||||
type: informal
|
||||
1:
|
||||
- name: New Year's Day
|
||||
regions: [ca]
|
||||
mday: 1
|
||||
- name: New Year's
|
||||
regions: [ca_qc]
|
||||
mday: 2
|
||||
2:
|
||||
- name: Family Day
|
||||
regions: [ca_ab, ca_on, ca_sk]
|
||||
wday: 1
|
||||
week: 3
|
||||
- name: Louis Riel Day
|
||||
regions: [ca_mb]
|
||||
wday: 1
|
||||
week: 3
|
||||
3:
|
||||
- name: St. Patrick's Day
|
||||
regions: [ca_nf]
|
||||
mday: 17
|
||||
3:
|
||||
- name: St. George's Day
|
||||
regions: [ca_nf]
|
||||
mday: 23
|
||||
5:
|
||||
- name: Victoria Day
|
||||
regions: [ca]
|
||||
function: ca_victoria_day(year)
|
||||
- name: National Patriotes Day
|
||||
regions: [ca_qc]
|
||||
function: ca_victoria_day(year)
|
||||
6:
|
||||
- name: Discovery Day
|
||||
regions: [ca_nf]
|
||||
mday: 24
|
||||
- name: Fête Nationale
|
||||
regions: [ca_qc]
|
||||
mday: 24
|
||||
- name: National Aboriginal Day
|
||||
regions: [ca_nt]
|
||||
mday: 21
|
||||
7:
|
||||
- name: Canada Day
|
||||
regions: [ca]
|
||||
mday: 1
|
||||
observed: to_monday_if_sunday
|
||||
- name: Orangemen's Day
|
||||
regions: [ca_nf]
|
||||
mday: 12
|
||||
- name: Nunavut Day
|
||||
regions: [ca_nu]
|
||||
mday: 9
|
||||
8:
|
||||
- name: BC Day
|
||||
week: 1
|
||||
regions: [ca_bc]
|
||||
wday: 1
|
||||
- name: Saskatchewan Day
|
||||
week: 1
|
||||
regions: [ca_sk]
|
||||
wday: 1
|
||||
- name: Heritage Day
|
||||
week: 1
|
||||
regions: [ca_ab]
|
||||
wday: 1
|
||||
- name: Natal Day
|
||||
week: 1
|
||||
regions: [ca_ns]
|
||||
wday: 1
|
||||
- name: Civic Holiday
|
||||
week: 1
|
||||
regions: [ca_on]
|
||||
wday: 1
|
||||
- name: Discovery Day
|
||||
week: 3
|
||||
regions: [ca_yk]
|
||||
wday: 1
|
||||
9:
|
||||
- name: Labour Day
|
||||
week: 1
|
||||
regions: [ca]
|
||||
wday: 1
|
||||
10:
|
||||
- name: Thanksgiving
|
||||
week: 2
|
||||
regions: [ca]
|
||||
wday: 1
|
||||
11:
|
||||
- name: Rememberance Day
|
||||
regions: [ca]
|
||||
mday: 11
|
||||
12:
|
||||
- name: Christmas Day
|
||||
regions: [ca]
|
||||
mday: 25
|
||||
- name: Boxing Day
|
||||
regions: [ca]
|
||||
mday: 26
|
||||
methods:
|
||||
ca_victoria_day: |
|
||||
# Monday on or before May 24
|
||||
def self.ca_victoria_day(year)
|
||||
date = Date.civil(year,5,24)
|
||||
if date.wday > 1
|
||||
date -= (date.wday - 1)
|
||||
elsif date.wday == 0
|
||||
date -= 6
|
||||
end
|
||||
date
|
||||
end
|
||||
tests: |
|
||||
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
||||
Date.civil(2008,3,21) => 'Good Friday',
|
||||
Date.civil(2008,3,24) => 'Easter Monday',
|
||||
Date.civil(2008,5,19) => 'Victoria Day',
|
||||
Date.civil(2008,7,1) => 'Canada Day',
|
||||
Date.civil(2008,9,1) => 'Labour Day',
|
||||
Date.civil(2008,10,13) => 'Thanksgiving',
|
||||
Date.civil(2008,11,11) => 'Rememberance Day',
|
||||
Date.civil(2008,12,25) => 'Christmas Day',
|
||||
Date.civil(2008,12,26) => 'Boxing Day'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :ca, :informal)[0][:name]
|
||||
end
|
||||
|
||||
# Victoria Day
|
||||
[Date.civil(2004,5,24), Date.civil(2005,5,23), Date.civil(2006,5,22),
|
||||
Date.civil(2007,5,21), Date.civil(2008,5,19)].each do |date|
|
||||
assert_equal 'Victoria Day', Holidays.on(date, :ca)[0][:name]
|
||||
# Canadian holiday definitions for the Ruby Holiday gem.
|
||||
# Updated 2008-11-21.
|
||||
---
|
||||
months:
|
||||
0:
|
||||
- name: Good Friday
|
||||
regions: [ca]
|
||||
function: easter(year)-2
|
||||
- name: Easter Monday
|
||||
regions: [ca]
|
||||
function: easter(year)+1
|
||||
type: informal
|
||||
1:
|
||||
- name: New Year's Day
|
||||
regions: [ca]
|
||||
mday: 1
|
||||
- name: New Year's
|
||||
regions: [ca_qc]
|
||||
mday: 2
|
||||
2:
|
||||
- name: Family Day
|
||||
regions: [ca_ab, ca_on, ca_sk]
|
||||
wday: 1
|
||||
week: 3
|
||||
- name: Louis Riel Day
|
||||
regions: [ca_mb]
|
||||
wday: 1
|
||||
week: 3
|
||||
3:
|
||||
- name: St. Patrick's Day
|
||||
regions: [ca_nf]
|
||||
mday: 17
|
||||
3:
|
||||
- name: St. George's Day
|
||||
regions: [ca_nf]
|
||||
mday: 23
|
||||
5:
|
||||
- name: Victoria Day
|
||||
regions: [ca]
|
||||
function: ca_victoria_day(year)
|
||||
- name: National Patriotes Day
|
||||
regions: [ca_qc]
|
||||
function: ca_victoria_day(year)
|
||||
6:
|
||||
- name: Discovery Day
|
||||
regions: [ca_nf]
|
||||
mday: 24
|
||||
- name: Fête Nationale
|
||||
regions: [ca_qc]
|
||||
mday: 24
|
||||
- name: National Aboriginal Day
|
||||
regions: [ca_nt]
|
||||
mday: 21
|
||||
7:
|
||||
- name: Canada Day
|
||||
regions: [ca]
|
||||
mday: 1
|
||||
observed: to_monday_if_sunday
|
||||
- name: Orangemen's Day
|
||||
regions: [ca_nf]
|
||||
mday: 12
|
||||
- name: Nunavut Day
|
||||
regions: [ca_nu]
|
||||
mday: 9
|
||||
8:
|
||||
- name: BC Day
|
||||
week: 1
|
||||
regions: [ca_bc]
|
||||
wday: 1
|
||||
- name: Saskatchewan Day
|
||||
week: 1
|
||||
regions: [ca_sk]
|
||||
wday: 1
|
||||
- name: Heritage Day
|
||||
week: 1
|
||||
regions: [ca_ab]
|
||||
wday: 1
|
||||
- name: Natal Day
|
||||
week: 1
|
||||
regions: [ca_ns]
|
||||
wday: 1
|
||||
- name: Civic Holiday
|
||||
week: 1
|
||||
regions: [ca_on]
|
||||
wday: 1
|
||||
- name: Discovery Day
|
||||
week: 3
|
||||
regions: [ca_yk]
|
||||
wday: 1
|
||||
9:
|
||||
- name: Labour Day
|
||||
week: 1
|
||||
regions: [ca]
|
||||
wday: 1
|
||||
10:
|
||||
- name: Thanksgiving
|
||||
week: 2
|
||||
regions: [ca]
|
||||
wday: 1
|
||||
11:
|
||||
- name: Remembrance Day
|
||||
regions: [ca]
|
||||
mday: 11
|
||||
12:
|
||||
- name: Christmas Day
|
||||
regions: [ca]
|
||||
mday: 25
|
||||
- name: Boxing Day
|
||||
regions: [ca]
|
||||
mday: 26
|
||||
methods:
|
||||
ca_victoria_day: |
|
||||
# Monday on or before May 24
|
||||
def self.ca_victoria_day(year)
|
||||
date = Date.civil(year,5,24)
|
||||
if date.wday > 1
|
||||
date -= (date.wday - 1)
|
||||
elsif date.wday == 0
|
||||
date -= 6
|
||||
end
|
||||
date
|
||||
end
|
||||
tests: |
|
||||
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
||||
Date.civil(2008,3,21) => 'Good Friday',
|
||||
Date.civil(2008,3,24) => 'Easter Monday',
|
||||
Date.civil(2008,5,19) => 'Victoria Day',
|
||||
Date.civil(2008,7,1) => 'Canada Day',
|
||||
Date.civil(2008,9,1) => 'Labour Day',
|
||||
Date.civil(2008,10,13) => 'Thanksgiving',
|
||||
Date.civil(2008,11,11) => 'Remembrance Day',
|
||||
Date.civil(2008,12,25) => 'Christmas Day',
|
||||
Date.civil(2008,12,26) => 'Boxing Day'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :ca, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Victoria Day
|
||||
[Date.civil(2004,5,24), Date.civil(2005,5,23), Date.civil(2006,5,22),
|
||||
Date.civil(2007,5,21), Date.civil(2008,5,19)].each do |date|
|
||||
assert_equal 'Victoria Day', Holidays.on(date, :ca)[0][:name]
|
||||
end
|
|
@ -0,0 +1,68 @@
|
|||
# Czech holiday definitions for the Ruby Holiday gem.
|
||||
#
|
||||
# Updated: 2010-01-20.
|
||||
# Sources:
|
||||
# - http://cs.wikipedia.org/wiki/%C4%8Cesk%C3%BD_st%C3%A1tn%C3%AD_sv%C3%A1tek
|
||||
# - http://www.mpsv.cz/cs/74
|
||||
---
|
||||
months:
|
||||
0:
|
||||
- name: Velikonoční pondělí
|
||||
regions: [cz]
|
||||
function: easter(year)+1
|
||||
1:
|
||||
- name: Den obnovy samostatného českého státu
|
||||
regions: [cz]
|
||||
mday: 1
|
||||
5:
|
||||
- name: Svátek práce
|
||||
regions: [cz]
|
||||
mday: 1
|
||||
- name: Den vítězství
|
||||
regions: [cz]
|
||||
mday: 8
|
||||
7:
|
||||
- name: Den slovanských věrozvěstů Cyrila a Metoděje
|
||||
regions: [cz]
|
||||
mday: 5
|
||||
- name: Den upálení mistra Jana Husa
|
||||
regions: [cz]
|
||||
mday: 6
|
||||
9:
|
||||
- name: Den české státnosti
|
||||
regions: [cz]
|
||||
mday: 28
|
||||
10:
|
||||
- name: Den vzniku samostatného československého státu
|
||||
regions: [cz]
|
||||
mday: 28
|
||||
11:
|
||||
- name: Den boje za svobodu a demokracii
|
||||
regions: [cz]
|
||||
mday: 17
|
||||
12:
|
||||
- name: Štědrý den
|
||||
regions: [cz]
|
||||
mday: 24
|
||||
- name: 1. svátek vánoční
|
||||
regions: [cz]
|
||||
mday: 25
|
||||
- name: 2. svátek vánoční
|
||||
regions: [cz]
|
||||
mday: 26
|
||||
tests: |
|
||||
{Date.civil(2010,1,1) => 'Den obnovy samostatného českého státu',
|
||||
Date.civil(2010,4,5) => 'Velikonoční pondělí',
|
||||
Date.civil(2010,5,1) => 'Svátek práce',
|
||||
Date.civil(2010,5,8) => 'Den vítězství',
|
||||
Date.civil(2010,7,5) => 'Den slovanských věrozvěstů Cyrila a Metoděje',
|
||||
Date.civil(2010,7,6) => 'Den upálení mistra Jana Husa',
|
||||
Date.civil(2010,9,28) => 'Den české státnosti',
|
||||
Date.civil(2010,10,28) => 'Den vzniku samostatného československého státu',
|
||||
Date.civil(2010,11,17) => 'Den boje za svobodu a demokracii',
|
||||
Date.civil(2010,12,24) => 'Štědrý den',
|
||||
Date.civil(2010,12,25) => '1. svátek vánoční',
|
||||
Date.civil(2010,12,26) => '2. svátek vánoční'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :cz, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
26
data/de.yaml
26
data/de.yaml
|
@ -1,6 +1,6 @@
|
|||
# German holiday definitions for the Ruby Holiday gem.
|
||||
#
|
||||
# Updated: 2008-11-29.
|
||||
# Updated: 2009-11-05.
|
||||
# Sources:
|
||||
# - http://en.wikipedia.org/wiki/Holidays_in_Germany
|
||||
# - http://www.timeanddate.com/calendar/index.html?country=8
|
||||
|
@ -11,10 +11,6 @@ months:
|
|||
- 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
|
||||
|
@ -25,22 +21,19 @@ months:
|
|||
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]
|
||||
regions: [de_bw, de_by, de_he, de_nw, de_rp, de_sl]
|
||||
function: easter(year)+60
|
||||
1:
|
||||
- name: Neujahrstag
|
||||
regions: [de]
|
||||
mday: 1
|
||||
- name: Heilige Drei Könige
|
||||
regions: [de_bw, de_by]
|
||||
regions: [de_bw, de_by, de_st]
|
||||
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]
|
||||
|
@ -57,7 +50,7 @@ months:
|
|||
regions: [de_bw, de_by, de_nw, de_rp, de_sl]
|
||||
mday: 1
|
||||
- name: Buß- und Bettag
|
||||
regions: [de_by, de_sn]
|
||||
regions: [de_sn]
|
||||
function: de_buss_und_bettag(year)
|
||||
12:
|
||||
- name: 1. Weihnachtstag
|
||||
|
@ -81,7 +74,6 @@ methods:
|
|||
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',
|
||||
|
@ -89,10 +81,14 @@ tests: |
|
|||
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]
|
||||
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|
|
||||
[: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|
|
||||
assert_equal 'Fronleichnam', Date.civil(2009,6,11).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
|
@ -107,6 +103,8 @@ tests: |
|
|||
[: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'
|
||||
|
||||
# Repentance Day
|
||||
assert_equal 'Buß- und Bettag', Date.civil(2004,11,17).holidays(:de_sn)[0][:name]
|
||||
|
|
|
@ -113,5 +113,5 @@ tests: |
|
|||
Date.civil(2007,12,24) => 'Juleaftensdag',
|
||||
Date.civil(2007,12,25) => '1. juledag',
|
||||
Date.civil(2007,12,26) => '2. juledag'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :dk, :informal)[0][:name]
|
||||
assert_equal name, (Holidays.on(date, :dk, :informal)[0] || {})[:name]
|
||||
end
|
|
@ -0,0 +1,79 @@
|
|||
# Greek holiday definitions for the Ruby Holiday gem.
|
||||
#
|
||||
# Created: 2011-05-11.
|
||||
# Sources:
|
||||
# http://www.assa.org.au/edm.html
|
||||
# http://fotios.org/node/1104
|
||||
# http://www.faqs.org/faqs/calendars/faq/
|
||||
# http://5dspace-time.org/Calendar/Algorithm.html - for offsets
|
||||
# http://el.wikipedia.org/wiki/Επίσημες_αργίες_στην_Ελλάδα - for holidays
|
||||
# http://www.eortologio.gr/arthra/pasxa.php - for holidays
|
||||
---
|
||||
months:
|
||||
0:
|
||||
- name: Μεγάλη Παρασκευή
|
||||
regions: [el]
|
||||
function: orthodox_easter(year)-2
|
||||
- name: Μεγάλο Σάββατο
|
||||
regions: [el]
|
||||
function: orthodox_easter(year)-1
|
||||
- name: Κυριακή του Πάσχα
|
||||
regions: [el]
|
||||
function: orthodox_easter(year)
|
||||
- name: Δευτέρα του Πάσχα
|
||||
regions: [el]
|
||||
function: orthodox_easter(year)+1
|
||||
- name: Καθαρά Δευτέρα
|
||||
regions: [el]
|
||||
function: orthodox_easter(year)-48
|
||||
- name: Αγίου Πνεύματος
|
||||
regions: [el]
|
||||
function: orthodox_easter(year)+50
|
||||
1:
|
||||
- name: Πρωτοχρονιά
|
||||
regions: [el]
|
||||
mday: 1
|
||||
- name: Θεοφάνεια
|
||||
regions: [el]
|
||||
mday: 6
|
||||
3:
|
||||
- name: Επέτειος της Επανάστασης του 1821
|
||||
regions: [el]
|
||||
mday: 25
|
||||
5:
|
||||
- name: Πρωτομαγιά
|
||||
regions: [el]
|
||||
mday: 1
|
||||
8:
|
||||
- name: Κοίμηση της Θεοτόκου
|
||||
regions: [el]
|
||||
mday: 15
|
||||
10:
|
||||
- name: Επέτειος του Όχι
|
||||
regions: [el]
|
||||
mday: 28
|
||||
12:
|
||||
- name: Χριστούγεννα
|
||||
regions: [el]
|
||||
mday: 25
|
||||
- name: Δεύτερη ημέρα των Χριστουγέννων
|
||||
regions: [el]
|
||||
mday: 26
|
||||
tests: |
|
||||
{Date.civil(2011,1,1) => 'Πρωτοχρονιά',
|
||||
Date.civil(2011,1,6) => 'Θεοφάνεια',
|
||||
Date.civil(2011,4,22) => 'Μεγάλη Παρασκευή',
|
||||
Date.civil(1970,4,25) => 'Μεγάλο Σάββατο',
|
||||
Date.civil(1985,4,14) => 'Κυριακή του Πάσχα',
|
||||
Date.civil(2011,4,24) => 'Κυριακή του Πάσχα',
|
||||
Date.civil(2027,5,2) => 'Κυριακή του Πάσχα',
|
||||
Date.civil(2046,4,30) => 'Δευτέρα του Πάσχα',
|
||||
Date.civil(2011,5,1) => 'Πρωτομαγιά',
|
||||
Date.civil(2011,6,13) => 'Αγίου Πνεύματος',
|
||||
Date.civil(2012,6,4) => 'Αγίου Πνεύματος',
|
||||
Date.civil(2011,3,7) => 'Καθαρά Δευτέρα',
|
||||
Date.civil(2012,2,27) => 'Καθαρά Δευτέρα',
|
||||
Date.civil(2011,12,25) => 'Χριστούγεννα',
|
||||
Date.civil(2011,12,26) => 'Δεύτερη ημέρα των Χριστουγέννων'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :el, :informal)[0] || {})[:name]
|
||||
end
|
|
@ -123,7 +123,7 @@ tests: |
|
|||
Date.civil(2009,12,6) => 'Día de la Constitución',
|
||||
Date.civil(2009,12,8) => 'Inmaculada Concepción',
|
||||
Date.civil(2009,12,25) => 'Navidad del Señor'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :es, :informal)[0][:name]
|
||||
assert_equal name, (Holidays.on(date, :es, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
[:es_pv, :es_ct, :es_na, :es_v, :es_vc, :es_].each do |r|
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
# Finnish holiday definitions for the Ruby Holiday gem.
|
||||
#
|
||||
# Updated: 2010-12-28.
|
||||
# Sources:
|
||||
# - http://en.wikipedia.org/wiki/Public_holidays_in_Finland
|
||||
---
|
||||
months:
|
||||
0:
|
||||
- name: Pitkäperjantai
|
||||
regions: [fi]
|
||||
function: easter(year)-2
|
||||
- name: Pääsiäispäivä
|
||||
regions: [fi]
|
||||
function: easter(year)
|
||||
- name: 2. Pääsiäispäivä
|
||||
regions: [fi]
|
||||
function: easter(year)+1
|
||||
- name: Helatorstai # Ascension Day
|
||||
regions: [fi]
|
||||
function: easter(year)+39
|
||||
- name: Helluntaipäivä # Whitsunday
|
||||
regions: [fi]
|
||||
function: easter(year)+49
|
||||
- name: Pyhäinpäivä # All Saint's Day
|
||||
regions: [fi]
|
||||
function: fi_pyhainpaiva(year)
|
||||
|
||||
1:
|
||||
- name: Uudenvuodenpäivä
|
||||
regions: [fi]
|
||||
mday: 1
|
||||
- name: Loppiainen
|
||||
regions: [fi]
|
||||
mday: 6
|
||||
|
||||
5:
|
||||
- name: Vappu
|
||||
regions: [fi]
|
||||
mday: 1
|
||||
6:
|
||||
- name: Juhannuspäivä
|
||||
regions: [fi]
|
||||
function: fi_juhannuspaiva(year)
|
||||
|
||||
12:
|
||||
- name: Itsenäisyyspäivä
|
||||
regions: [fi]
|
||||
mday: 6
|
||||
- name: Jouluaatto
|
||||
regions: [fi]
|
||||
mday: 24
|
||||
- name: Joulupäivä
|
||||
regions: [fi]
|
||||
mday: 25
|
||||
- name: Tapaninpäivä
|
||||
regions: [fi]
|
||||
mday: 26
|
||||
methods:
|
||||
fi_juhannuspaiva: |
|
||||
# Finland: Mid-summer (Saturday between June 20–26)
|
||||
def self.fi_juhannuspaiva(year)
|
||||
date = Date.civil(year,6,20)
|
||||
date += (6 - date.wday)
|
||||
date
|
||||
end
|
||||
fi_pyhainpaiva: |
|
||||
# Finland: All Saint's Day (Saturday between Oct 31 and Nov 6)
|
||||
def self.fi_pyhainpaiva(year)
|
||||
date = Date.civil(year,10,31)
|
||||
date += (6 - date.wday)
|
||||
date
|
||||
end
|
||||
tests: |
|
||||
{Date.civil(2008,1,1) => 'Uudenvuodenpäivä',
|
||||
Date.civil(2008,1,6) => 'Loppiainen',
|
||||
Date.civil(2008,3,21) => 'Pitkäperjantai',
|
||||
Date.civil(2008,3,23) => 'Pääsiäispäivä',
|
||||
Date.civil(2008,3,24) => '2. Pääsiäispäivä',
|
||||
Date.civil(2008,5,1) => 'Vappu',
|
||||
Date.civil(2008,5,1) => 'Helatorstai',
|
||||
Date.civil(2008,5,11) => 'Helluntaipäivä',
|
||||
Date.civil(2005,6,25) => 'Juhannuspäivä',
|
||||
Date.civil(2006,6,24) => 'Juhannuspäivä',
|
||||
Date.civil(2007,6,23) => 'Juhannuspäivä',
|
||||
Date.civil(2008,6,21) => 'Juhannuspäivä',
|
||||
Date.civil(2005,11,5) => 'Pyhäinpäivä',
|
||||
Date.civil(2006,11,4) => 'Pyhäinpäivä',
|
||||
Date.civil(2007,11,3) => 'Pyhäinpäivä',
|
||||
Date.civil(2008,11,1) => 'Pyhäinpäivä',
|
||||
Date.civil(2008,12,6) => 'Itsenäisyyspäivä',
|
||||
Date.civil(2008,12,24) => 'Jouluaatto',
|
||||
Date.civil(2008,12,25) => 'Joulupäivä',
|
||||
Date.civil(2008,12,26) => 'Tapaninpäivä'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :fi, :informal)[0] || {})[:name]
|
||||
end
|
|
@ -66,5 +66,5 @@ tests: |
|
|||
Date.civil(2007,11,1) => 'Toussaint',
|
||||
Date.civil(2007,11,11) => 'Armistice 1918',
|
||||
Date.civil(2007,12,25) => 'Nöel'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :fr, :informal)[0][:name]
|
||||
assert_equal name, (Holidays.on(date, :fr, :informal)[0] || {})[:name]
|
||||
end
|
|
@ -87,7 +87,7 @@ tests: |
|
|||
Date.civil(2008,11,5) => 'Guy Fawkes Day',
|
||||
Date.civil(2008,12,25) => 'Christmas Day',
|
||||
Date.civil(2008,12,26) => 'Boxing Day'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :gb, :informal)[0][:name]
|
||||
assert_equal name, (Holidays.on(date, :gb, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
assert_equal 'St. Patrick\'s Day', Date.civil(2008,3,17).holidays(:gb_nir, :informal)[0][:name]
|
||||
|
|
|
@ -54,5 +54,5 @@ tests: |
|
|||
Date.civil(2008,8,4) => 'Bank Holiday',
|
||||
Date.civil(2008,12,25) => 'Christmas Day',
|
||||
Date.civil(2008,12,26) => 'St. Stephen\'s Day'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :ie, :informal)[0][:name]
|
||||
assert_equal name, (Holidays.on(date, :ie, :informal)[0] || {})[:name]
|
||||
end
|
|
@ -1,21 +1,35 @@
|
|||
# Definition build list
|
||||
---
|
||||
defs:
|
||||
AT: ['at.yaml']
|
||||
AU: ['au.yaml']
|
||||
BR: ['br.yaml']
|
||||
CA: ['ca.yaml', 'north_america_informal.yaml']
|
||||
CZ: ['cz.yaml']
|
||||
DK: ['dk.yaml']
|
||||
DE: ['de.yaml']
|
||||
EL: ['el.yaml']
|
||||
ES: ['es.yaml']
|
||||
FI: ['fi.yaml']
|
||||
FR: ['fr.yaml']
|
||||
GB: ['gb.yaml']
|
||||
IE: ['ie.yaml']
|
||||
IS: ['is.yaml']
|
||||
IT: ['it.yaml']
|
||||
LI: ['li.yaml']
|
||||
MX: ['mx.yaml', 'north_america_informal.yaml']
|
||||
NL: ['nl.yaml']
|
||||
PT: ['se.yaml']
|
||||
"NO": ['no.yaml']
|
||||
NYSE: ['nyse.yaml']
|
||||
NZ: ['nz.yaml']
|
||||
PL: ['pl.yaml']
|
||||
PT: ['pt.yaml']
|
||||
SE: ['se.yaml']
|
||||
US: ['us.yaml', 'north_america_informal.yaml']
|
||||
United_Nations: ['united_nations.yaml']
|
||||
UPS: ['ups.yaml']
|
||||
ZA: ['za.yaml']
|
||||
North_America: ['ca.yaml', 'mx.yaml', 'us.yaml', 'north_america_informal.yaml']
|
||||
Europe: ['dk.yaml', 'de.yaml', 'es.yaml', 'fr.yaml', 'gb.yaml', 'ie.yaml', 'is.yaml', 'it.yaml', 'nl.yaml', 'pt.yaml']
|
||||
Scandinavia: ['dk.yaml', 'is.yaml', 'no.yaml', 'se.yaml', 'fi.yaml']
|
||||
Europe: ['at.yaml', 'cz.yaml', 'dk.yaml', 'de.yaml', 'el.yaml', 'es.yaml', 'fr.yaml', 'gb.yaml', 'ie.yaml', 'is.yaml', 'it.yaml', 'li.yaml', 'nl.yaml', 'no.yaml', 'pl.yaml', 'pt.yaml']
|
||||
JP: ['jp.yaml']
|
||||
|
|
|
@ -132,5 +132,5 @@ tests: |
|
|||
Date.civil(2007,12,25) => 'Jól',
|
||||
Date.civil(2007,12,26) => 'Jól',
|
||||
Date.civil(2007,12,31) => 'Gamlárskvöld'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :is, :informal)[0][:name]
|
||||
assert_equal name, (Holidays.on(date, :is, :informal)[0] || {})[:name]
|
||||
end
|
|
@ -62,5 +62,5 @@ tests: |
|
|||
Date.civil(2007,12,8) => 'Immacolata Concezione',
|
||||
Date.civil(2007,12,25) => 'Natale',
|
||||
Date.civil(2007,12,26) => 'Santo Stefano'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :it, :informal)[0][:name]
|
||||
assert_equal name, (Holidays.on(date, :it, :informal)[0] || {})[:name]
|
||||
end
|
|
@ -0,0 +1,202 @@
|
|||
# Japanese holiday definitions for Ruby Holiday gem.
|
||||
# Reference: http://www.h3.dion.ne.jp/~sakatsu/holiday_topic.htm
|
||||
#
|
||||
# This definition can calculate current Japanese holidays,
|
||||
# don't compat with past changes of Japan Holiday Act.
|
||||
#
|
||||
# CHANGES:
|
||||
# 2010-12-25: Initial version by Tatsuki Sugiura <sugi@nemui.org>
|
||||
#
|
||||
---
|
||||
months:
|
||||
1:
|
||||
- name: 元日
|
||||
regions: [jp]
|
||||
mday: 1
|
||||
- name: 成人の日
|
||||
regions: [jp]
|
||||
wday: 1
|
||||
week: 2
|
||||
2:
|
||||
- name: 建国記念日
|
||||
regions: [jp]
|
||||
mday: 11
|
||||
- name: 振替休日
|
||||
regions: [jp]
|
||||
function: jp_substitute_holiday(year, 2, 11)
|
||||
3:
|
||||
- name: 春分の日
|
||||
regions: [jp]
|
||||
function: jp_vernal_equinox_day(year)
|
||||
- name: 振替休日
|
||||
regions: [jp]
|
||||
function: jp_substitute_holiday(Holidays.jp_vernal_equinox_day(year))
|
||||
4:
|
||||
- name: 昭和の日
|
||||
regions: [jp]
|
||||
mday: 29
|
||||
- name: 振替休日
|
||||
regions: [jp]
|
||||
function: jp_substitute_holiday(year, 4, 29)
|
||||
5:
|
||||
- name: 憲法記念日
|
||||
regions: [jp]
|
||||
mday: 3
|
||||
- name: みどりの日
|
||||
regions: [jp]
|
||||
mday: 4
|
||||
- name: こどもの日
|
||||
regions: [jp]
|
||||
mday: 5
|
||||
- name: 振替休日
|
||||
regions: [jp]
|
||||
function: jp_substitute_holiday(year, 5, 3)
|
||||
- name: 振替休日
|
||||
regions: [jp]
|
||||
function: jp_substitute_holiday(year, 5, 5)
|
||||
7:
|
||||
- name: 海の日
|
||||
regions: [jp]
|
||||
wday: 1
|
||||
week: 3
|
||||
- name: 振替休日
|
||||
regions: [jp]
|
||||
function: jp_substitute_holiday(year, 7, Date.calculate_mday(year, 7, 3, 1))
|
||||
9:
|
||||
- name: 敬老の日
|
||||
regions: [jp]
|
||||
wday: 1
|
||||
week: 3
|
||||
- name: 振替休日
|
||||
regions: [jp]
|
||||
function: jp_substitute_holiday(year, 9, Date.calculate_mday(year, 9, 3, 1))
|
||||
- name: 国民の休日
|
||||
regions: [jp]
|
||||
function: jp_citizons_holiday(year)
|
||||
- name: 秋分の日
|
||||
regions: [jp]
|
||||
function: jp_national_culture_day(year)
|
||||
- name: 振替休日
|
||||
regions: [jp]
|
||||
function: jp_substitute_holiday(Holidays.jp_national_culture_day(year))
|
||||
10:
|
||||
- name: 体育の日
|
||||
regions: [jp]
|
||||
wday: 1
|
||||
week: 2
|
||||
- name: 振替休日
|
||||
regions: [jp]
|
||||
function: jp_substitute_holiday(year, 10, Date.calculate_mday(year, 10, 2, 1))
|
||||
11:
|
||||
- name: 文化の日
|
||||
regions: [jp]
|
||||
mday: 3
|
||||
- name: 振替休日
|
||||
regions: [jp]
|
||||
function: jp_substitute_holiday(year, 11, 3)
|
||||
- name: 勤労感謝の日
|
||||
regions: [jp]
|
||||
mday: 23
|
||||
- name: 振替休日
|
||||
regions: [jp]
|
||||
function: jp_substitute_holiday(year, 11, 23)
|
||||
12:
|
||||
- name: 天皇誕生日
|
||||
regions: [jp]
|
||||
mday: 23
|
||||
- name: 振替休日
|
||||
regions: [jp]
|
||||
function: jp_substitute_holiday(year, 12, 23)
|
||||
methods:
|
||||
jp_vernal_equinox_day: |
|
||||
def self.jp_vernal_equinox_day(year)
|
||||
day =
|
||||
case year
|
||||
when 1851..1899
|
||||
19.8277
|
||||
when 1900..1979
|
||||
20.8357
|
||||
when 1980..2099
|
||||
20.8431
|
||||
when 2100..2150
|
||||
21.8510
|
||||
else
|
||||
raise IndexError.new("Out of range")
|
||||
end
|
||||
day += 0.242194 * (year - 1980) - ((year - 1980)/4).floor
|
||||
day = day.floor
|
||||
Date.civil(year, 3, day)
|
||||
end
|
||||
jp_national_culture_day: |
|
||||
def self.jp_national_culture_day(year)
|
||||
day =
|
||||
case year
|
||||
when 1851..1899
|
||||
22.2588
|
||||
when 1900..1979
|
||||
23.2588
|
||||
when 1980..2099
|
||||
23.2488
|
||||
when 2100..2150
|
||||
24.2488
|
||||
else
|
||||
raise IndexError.new("Out of range")
|
||||
end
|
||||
day += 0.242194 * (year - 1980) - ((year - 1980)/4).floor
|
||||
day = day.floor
|
||||
Date.civil(year, 9, day)
|
||||
end
|
||||
jp_citizons_holiday: |
|
||||
def self.jp_citizons_holiday(year)
|
||||
year < 2003 and return nil
|
||||
ncd = Holidays.jp_national_culture_day(year)
|
||||
if ncd.wday == 3
|
||||
ncd - 1
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
jp_substitute_holiday: |
|
||||
def self.jp_substitute_holiday(*date)
|
||||
date = date[0].kind_of?(Date) ? date.first : Date.civil(*date)
|
||||
date.wday == 0 ? date+1 : nil
|
||||
end
|
||||
tests: |
|
||||
{Date.civil(2008,1,1) => '元日',
|
||||
Date.civil(2010,1,11) => '成人の日',
|
||||
Date.civil(2008,2,11) => '建国記念日',
|
||||
Date.civil(2008,4,29) => '昭和の日',
|
||||
Date.civil(2008,5,3) => '憲法記念日',
|
||||
Date.civil(2008,5,5) => 'こどもの日',
|
||||
Date.civil(2010,7,19) => '海の日',
|
||||
Date.civil(2010,9,20) => '敬老の日',
|
||||
Date.civil(2010,10,11) => '体育の日',
|
||||
Date.civil(2008,11,3) => '文化の日',
|
||||
Date.civil(2008,11,23) => '勤労感謝の日',
|
||||
Date.civil(2008,12,23) => '天皇誕生日',
|
||||
Date.civil(2010,3,22) => '振替休日',
|
||||
Date.civil(2008,11,24) => '振替休日',
|
||||
}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :jp, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# vernal equinox day
|
||||
[Date.civil(2004,3,20), Date.civil(2005,3,20), Date.civil(2006,3,21),
|
||||
Date.civil(2007,3,21), Date.civil(2008,3,20), Date.civil(2009,3,20),
|
||||
Date.civil(2010,3,21)].each do |date|
|
||||
assert_equal '春分の日', Holidays.on(date, :jp)[0][:name]
|
||||
end
|
||||
|
||||
# national culture day
|
||||
[Date.civil(2004,9,23), Date.civil(2005,9,23), Date.civil(2006,9,23),
|
||||
Date.civil(2007,9,23), Date.civil(2008,9,23), Date.civil(2009,9,23),
|
||||
Date.civil(2010,9,23), Date.civil(2011,9,23), Date.civil(2012,9,22),
|
||||
Date.civil(2013,9,23)].each do |date|
|
||||
assert_equal '秋分の日', Holidays.on(date, :jp)[0][:name]
|
||||
end
|
||||
|
||||
# citizens holiday
|
||||
[Date.civil(2032,9,21), Date.civil(2049,9,21), Date.civil(2009,9,22),
|
||||
Date.civil(2015,9,22), Date.civil(2026,9,22)].each do |date|
|
||||
assert_equal '国民の休日', Holidays.on(date, :jp)[0][:name]
|
||||
end
|
|
@ -0,0 +1,102 @@
|
|||
# Liechtenstein holiday definitions for the Ruby Holiday gem.
|
||||
#
|
||||
# Updated: 2011-10-17.
|
||||
# Sources:
|
||||
# http://www.tourismus.li/de/navpage-RegionLI-InformationLI-44728.html
|
||||
---
|
||||
months:
|
||||
0:
|
||||
- name: Fasnachtsdienstag
|
||||
regions: [li]
|
||||
function: easter(year)-47
|
||||
- name: Karfreitag
|
||||
regions: [li]
|
||||
function: easter(year)-2
|
||||
- name: Ostern
|
||||
regions: [li]
|
||||
function: easter(year)
|
||||
type: informal
|
||||
- name: Ostermontag
|
||||
regions: [li]
|
||||
function: easter(year)+1
|
||||
- name: Auffahrt
|
||||
regions: [li]
|
||||
function: easter(year)+39
|
||||
- name: Pfingstmontag
|
||||
regions: [li]
|
||||
function: easter(year)+50
|
||||
- name: Fronleichnam
|
||||
regions: [li]
|
||||
function: easter(year)+60
|
||||
1:
|
||||
- name: Neujahrstag
|
||||
regions: [li]
|
||||
mday: 1
|
||||
- name: Heilige Drei Könige
|
||||
regions: [li, li]
|
||||
mday: 6
|
||||
2:
|
||||
- name: Maria Lichtmess
|
||||
regions: [li]
|
||||
mday: 2
|
||||
3:
|
||||
- name: St. Josef
|
||||
regions: [li]
|
||||
mday: 19
|
||||
5:
|
||||
- name: Tag der Arbeit
|
||||
regions: [li]
|
||||
mday: 1
|
||||
8:
|
||||
- name: Staatsfeiertag
|
||||
regions: [li]
|
||||
mday: 15
|
||||
9:
|
||||
- name: Maria Geburt
|
||||
regions: [li]
|
||||
mday: 8
|
||||
11:
|
||||
- name: Allerheiligen
|
||||
regions: [li]
|
||||
mday: 1
|
||||
12:
|
||||
- name: Maria Empfängnis
|
||||
regions: [li]
|
||||
mday: 8
|
||||
- name: Heilig Abend
|
||||
regions: [li]
|
||||
mday: 24
|
||||
- name: Weihnachten
|
||||
regions: [li]
|
||||
mday: 25
|
||||
- name: Stefanstag
|
||||
regions: [li]
|
||||
mday: 26
|
||||
- name: Silvester
|
||||
regions: [li]
|
||||
mday: 31
|
||||
tests: |
|
||||
{Date.civil(2009,1,1) => 'Neujahrstag',
|
||||
Date.civil(2011,3,8) => 'Fasnachtsdienstag',
|
||||
Date.civil(2009,4,10) => 'Karfreitag',
|
||||
Date.civil(2009,4,12) => 'Ostern',
|
||||
Date.civil(2009,4,13) => 'Ostermontag',
|
||||
Date.civil(2009,5,21) => 'Auffahrt',
|
||||
Date.civil(2009,6,1) => 'Pfingstmontag',
|
||||
Date.civil(2009,12,25) => 'Weihnachten',
|
||||
Date.civil(2009,12,26) => 'Stefanstag'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :li, :informal)[0][:name]
|
||||
end
|
||||
|
||||
[:li].each do |r|
|
||||
assert_equal 'Fronleichnam', Date.civil(2009,6,11).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:li].each do |r|
|
||||
assert_equal 'Staatsfeiertag', Date.civil(2009,8,15).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:li].each do |r|
|
||||
assert_equal 'Allerheiligen', Date.civil(2009,11,1).holidays(r)[0][:name]
|
||||
end
|
||||
|
|
@ -102,5 +102,5 @@ tests: |
|
|||
Date.civil(2007,11,2) => 'Los Fieles Difuntos',
|
||||
Date.civil(2007,11,19) => 'Día de la Revolución',
|
||||
Date.civil(2007,12,25) => 'Navidad'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :mx, :informal)[0][:name]
|
||||
assert_equal name, (Holidays.on(date, :mx, :informal)[0] || {})[:name]
|
||||
end
|
|
@ -63,5 +63,5 @@ tests: |
|
|||
Date.civil(2008,5,12) => 'Pinksteren', # Pentecost, Easter+50
|
||||
Date.civil(2008,12,25) => 'Kerstmis',
|
||||
Date.civil(2008,12,26) => 'Kerstmis'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :nl, :informal)[0][:name]
|
||||
assert_equal name, (Holidays.on(date, :nl, :informal)[0] || {})[:name]
|
||||
end
|
|
@ -0,0 +1,82 @@
|
|||
# Norwegian holiday definitions for the Ruby Holiday gem.
|
||||
#
|
||||
# Added: 20010-02-22.
|
||||
# Sources:
|
||||
# - http://no.wikipedia.org/wiki/Offentlig_fridag
|
||||
# - http://www.timeanddate.com/norsk/kalender.html
|
||||
---
|
||||
months:
|
||||
0:
|
||||
- name: Fastelavn
|
||||
regions: ["no"]
|
||||
function: easter(year)-49
|
||||
type: informal
|
||||
- name: Palmesøndag
|
||||
regions: ["no"]
|
||||
function: easter(year)-7
|
||||
- name: Skjærtorsdag
|
||||
regions: ["no"]
|
||||
function: easter(year)-3
|
||||
- name: Langfredag
|
||||
regions: ["no"]
|
||||
function: easter(year)-2
|
||||
- name: 1. påskedag
|
||||
regions: ["no"]
|
||||
function: easter(year)
|
||||
- name: 2. påskedag
|
||||
regions: ["no"]
|
||||
function: easter(year)+1
|
||||
- name: Kristi Himmelfartsdag
|
||||
regions: ["no"]
|
||||
function: easter(year)+39
|
||||
- name: 1. pinsedag
|
||||
regions: ["no"]
|
||||
function: easter(year)+49
|
||||
- name: 2. pinsedag
|
||||
regions: ["no"]
|
||||
function: easter(year)+50
|
||||
1:
|
||||
- name: Nyttårsdag
|
||||
regions: ["no"]
|
||||
mday: 1
|
||||
5:
|
||||
- name: 1. mai
|
||||
regions: ["no"]
|
||||
mday: 1
|
||||
- name: 17. mai
|
||||
regions: ["no"]
|
||||
mday: 17
|
||||
12:
|
||||
- name: Julaften
|
||||
regions: ["no"]
|
||||
mday: 24
|
||||
type: informal
|
||||
- name: 1. juledag
|
||||
regions: ["no"]
|
||||
mday: 25
|
||||
- name: 2. juledag
|
||||
regions: ["no"]
|
||||
mday: 26
|
||||
- name: Nyttårsaften
|
||||
regions: ["no"]
|
||||
mday: 31
|
||||
type: informal
|
||||
tests: |
|
||||
{Date.civil(2010,1,1) => 'Nyttårsdag',
|
||||
Date.civil(2010,5,1) => '1. mai',
|
||||
Date.civil(2010,5,17) => '17. mai',
|
||||
Date.civil(2010,12,24) => 'Julaften',
|
||||
Date.civil(2010,12,25) => '1. juledag',
|
||||
Date.civil(2010,12,26) => '2. juledag',
|
||||
Date.civil(2010,12,31) => 'Nyttårsaften',
|
||||
Date.civil(2010,2,14) => 'Fastelavn',
|
||||
Date.civil(2010,3,28) => 'Palmesøndag',
|
||||
Date.civil(2010,4,1) => 'Skjærtorsdag',
|
||||
Date.civil(2010,4,2) => 'Langfredag',
|
||||
Date.civil(2010,4,4) => '1. påskedag',
|
||||
Date.civil(2010,4,5) => '2. påskedag',
|
||||
Date.civil(2010,5,13) => 'Kristi Himmelfartsdag',
|
||||
Date.civil(2010,5,23) => '1. pinsedag',
|
||||
Date.civil(2010,5,24) => '2. pinsedag'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :no, :informal)[0] || {})[:name]
|
||||
end
|
|
@ -0,0 +1,63 @@
|
|||
# NYSE holiday definitions for the Ruby Holiday gem.
|
||||
#
|
||||
# By Alan Larkin
|
||||
# Source: http://www.nyse.com/about/newsevents/1176373643795.html#earlyclose2008
|
||||
#
|
||||
# Updated 2008-11-19.
|
||||
---
|
||||
months:
|
||||
0:
|
||||
- name: Good Friday
|
||||
regions: [nyse]
|
||||
function: easter(year)-2
|
||||
1:
|
||||
- name: New Year's Day
|
||||
regions: [nyse]
|
||||
mday: 1
|
||||
- name: Martin Luther King, Jr. Day
|
||||
week: 3
|
||||
regions: [nyse]
|
||||
wday: 1
|
||||
2:
|
||||
- name: Presidents' Day
|
||||
week: 3
|
||||
regions: [nyse]
|
||||
wday: 1
|
||||
5:
|
||||
- name: Memorial Day
|
||||
week: -1
|
||||
regions: [nyse]
|
||||
wday: 1
|
||||
7:
|
||||
- name: Independence Day
|
||||
regions: [nyse]
|
||||
mday: 4
|
||||
observed: to_weekday_if_weekend
|
||||
9:
|
||||
- name: Labor Day
|
||||
week: 1
|
||||
regions: [nyse]
|
||||
wday: 1
|
||||
11:
|
||||
- name: Thanksgiving
|
||||
week: 4
|
||||
regions: [nyse]
|
||||
wday: 4
|
||||
12:
|
||||
- name: Christmas Day
|
||||
regions: [nyse]
|
||||
mday: 25
|
||||
observed: to_weekday_if_weekend
|
||||
methods:
|
||||
tests: |
|
||||
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
||||
Date.civil(2008,1,21) => 'Martin Luther King, Jr. Day',
|
||||
Date.civil(2008,2,18) => 'Presidents\' Day',
|
||||
Date.civil(2008,3,21) => 'Good Friday',
|
||||
Date.civil(2008,5,26) => 'Memorial Day',
|
||||
Date.civil(2008,7,4) => 'Independence Day',
|
||||
Date.civil(2008,9,1) => 'Labor Day',
|
||||
Date.civil(2008,11,27) => 'Thanksgiving',
|
||||
Date.civil(2008,12,25) => 'Christmas Day'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :nyse)[0] || {})[:name]
|
||||
end
|
|
@ -0,0 +1,141 @@
|
|||
# New Zealand holiday definitions for the Ruby Holiday gem.
|
||||
# Updated: 2010-03-28.
|
||||
# Sources:
|
||||
# - http://en.wikipedia.org/wiki/Public_holidays_in_New_Zealand
|
||||
---
|
||||
months:
|
||||
0:
|
||||
- name: Good Friday
|
||||
regions: [nz]
|
||||
function: easter(year)-2
|
||||
- name: Easter Saturday
|
||||
regions: [nz]
|
||||
function: easter(year)-1
|
||||
- name: Easter Monday
|
||||
regions: [nz]
|
||||
function: easter(year)+1
|
||||
1:
|
||||
- name: New Year's Day
|
||||
regions: [nz]
|
||||
mday: 1
|
||||
observed: to_monday_if_weekend
|
||||
- name: Day after New Year's Day
|
||||
regions: [nz]
|
||||
mday: 2
|
||||
observed: to_weekday_if_boxing_weekend
|
||||
- name: Southland Anniversary Day
|
||||
regions: [nz_sl]
|
||||
mday: 17
|
||||
- name: Wellington Anniversary Day
|
||||
regions: [nz_we]
|
||||
mday: 22
|
||||
observed: closest_monday
|
||||
- name: Auckland Anniversary Day
|
||||
regions: [nz_ak]
|
||||
mday: 29
|
||||
observed: closest_monday
|
||||
- name: Northland Anniversary Day
|
||||
regions: [nz_nl]
|
||||
mday: 29
|
||||
observed: closest_monday
|
||||
2:
|
||||
- name: Nelson Anniversary Day
|
||||
regions: [nz_ak]
|
||||
mday: 1
|
||||
observed: closest_monday
|
||||
- name: Waitangi Day
|
||||
regions: [nz]
|
||||
mday: 6
|
||||
3:
|
||||
- name: Otago Anniversary Day
|
||||
regions: [nz_ot]
|
||||
mday: 23
|
||||
observed: closest_monday
|
||||
- name: Taranaki Anniversary Day
|
||||
regions: [nz_ak]
|
||||
week: 2
|
||||
wday: 1
|
||||
4:
|
||||
- name: ANZAC Day
|
||||
regions: [nz]
|
||||
mday: 25
|
||||
6:
|
||||
- name: Queen's Birthday
|
||||
regions: [nz]
|
||||
week: 1
|
||||
wday: 1
|
||||
9:
|
||||
- name: Dominion Day
|
||||
regions: [nz_sc]
|
||||
week: 4
|
||||
wday: 1
|
||||
10:
|
||||
- name: Hawke's bay Anniversary Day
|
||||
regions: [nz_hb]
|
||||
week: 1
|
||||
wday: 1
|
||||
observed: previous_friday
|
||||
- name: Labour Day
|
||||
regions: [nz]
|
||||
week: 4
|
||||
wday: 1
|
||||
- name: Marlborough Anniversary Day
|
||||
regions: [nz_mb]
|
||||
week: 4
|
||||
wday: 1
|
||||
observed: next_week
|
||||
11:
|
||||
- name: Canterbury Anniversary Day
|
||||
regions: [nz_ca]
|
||||
week: 2
|
||||
wday: 5
|
||||
- name: Chatham Island Anniversary Day
|
||||
regions: [nz_ch]
|
||||
mday: 30
|
||||
observed: closest_monday
|
||||
12:
|
||||
- name: Westland Anniversary Day
|
||||
regions: [nz_wl]
|
||||
mday: 1
|
||||
observed: closest_monday
|
||||
- name: Christmas Day
|
||||
regions: [nz]
|
||||
mday: 25
|
||||
observed: to_monday_if_weekend
|
||||
- name: Boxing Day
|
||||
regions: [nz]
|
||||
mday: 26
|
||||
observed: to_weekday_if_boxing_weekend
|
||||
tests: |
|
||||
{Date.civil(2007,1,1) => 'New Year\'s Day',
|
||||
Date.civil(2007,1,2) => 'Day after New Year\'s Day',
|
||||
Date.civil(2007,2,6) => 'Waitangi Day',
|
||||
Date.civil(2007,4,6) => 'Good Friday',
|
||||
Date.civil(2007,4,9) => 'Easter Monday',
|
||||
Date.civil(2007,4,25) => 'ANZAC Day',
|
||||
Date.civil(2007,12,25) => 'Christmas Day',
|
||||
Date.civil(2007,12,26) => 'Boxing Day'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :nz, :informal)[0] || {})[:name]
|
||||
end
|
||||
methods:
|
||||
closest_monday: |
|
||||
def self.closest_monday(date)
|
||||
if [1, 2, 3, 4].include?(date.wday)
|
||||
date -= (date.wday - 1)
|
||||
elsif 0 == date.wday
|
||||
date += 1
|
||||
else
|
||||
date += 8 - date.wday
|
||||
end
|
||||
date
|
||||
end
|
||||
|
||||
previous_friday: |
|
||||
def self.previous_friday(date)
|
||||
date - 3
|
||||
end
|
||||
|
||||
next_week: |
|
||||
def self.next_week(date)
|
||||
date + 7
|
||||
end
|
|
@ -0,0 +1,310 @@
|
|||
# Poland holiday definitions for the Ruby Holiday gem.
|
||||
#
|
||||
# Updated: 2011-09-12.
|
||||
# Source: http://pl.wikipedia.org/wiki/Dni_wolne_od_pracy_w_Polsce
|
||||
---
|
||||
months:
|
||||
0:
|
||||
- name: Tłusty Czwartek
|
||||
regions: [pl]
|
||||
function: easter(year)-52
|
||||
type: informal
|
||||
- name: Ostatki
|
||||
regions: [pl]
|
||||
function: easter(year)-47
|
||||
type: informal
|
||||
- name: Środa Popielcowa
|
||||
regions: [pl]
|
||||
function: easter(year)-46
|
||||
type: informal
|
||||
- name: Niedziela Palmowa
|
||||
regions: [pl]
|
||||
function: easter(year)-7
|
||||
type: informal
|
||||
- name: Wielki Czwartek
|
||||
regions: [pl]
|
||||
function: easter(year)-3
|
||||
type: informal
|
||||
- name: Wielki Piątek
|
||||
regions: [pl]
|
||||
function: easter(year)-2
|
||||
type: informal
|
||||
- name: Wielka Sobota
|
||||
regions: [pl]
|
||||
function: easter(year)-1
|
||||
type: informal
|
||||
- name: Niedziela Wielkanocna
|
||||
regions: [pl]
|
||||
function: easter(year)
|
||||
- name: Poniedziałek Wielkanocny (Lany Poniedziałek)
|
||||
regions: [pl]
|
||||
function: easter(year)+1
|
||||
- name: Zesłanie Ducha Świętego (Zielone Świątki)
|
||||
regions: [pl]
|
||||
function: easter(year)+49
|
||||
- name: Uroczystość Najświętszego Ciała i Krwi Pańskiej (Boże Ciało)
|
||||
regions: [pl]
|
||||
function: easter(year)+60
|
||||
1:
|
||||
- name: Nowy Rok
|
||||
regions: [pl]
|
||||
mday: 1
|
||||
- name: Objawienie Pańskie (święto Trzech Króli)
|
||||
regions: [pl]
|
||||
function: pl_trzech_kroli(year)
|
||||
- name: Objawienie Pańskie (święto Trzech Króli)
|
||||
regions: [pl]
|
||||
function: pl_trzech_kroli_informal(year)
|
||||
type: informal
|
||||
- name: Dzień Babci
|
||||
regions: [pl]
|
||||
mday: 21
|
||||
type: informal
|
||||
- name: Dzień Dziadka
|
||||
regions: [pl]
|
||||
mday: 22
|
||||
type: informal
|
||||
2:
|
||||
- name: Ofiarowanie Pańskie (Matki Boskiej Gromnicznej)
|
||||
regions: [pl]
|
||||
mday: 2
|
||||
type: informal
|
||||
- name: Dzień Zakochanych (Walentynki)
|
||||
regions: [pl]
|
||||
mday: 14
|
||||
type: informal
|
||||
3:
|
||||
- name: Dzień Kobiet
|
||||
regions: [pl]
|
||||
mday: 8
|
||||
type: informal
|
||||
- name: Dzień Mężczyzn
|
||||
regions: [pl]
|
||||
mday: 10
|
||||
type: informal
|
||||
4:
|
||||
- name: Prima Aprilis
|
||||
regions: [pl]
|
||||
mday: 1
|
||||
type: informal
|
||||
- name: Międzynarodowy Dzień Ziemi
|
||||
regions: [pl]
|
||||
mday: 22
|
||||
type: informal
|
||||
5:
|
||||
- name: Święto Państwowe (Święto Pracy)
|
||||
regions: [pl]
|
||||
mday: 1
|
||||
- name: Dzień Flagi Rzeczpospolitej Polskiej
|
||||
regions: [pl]
|
||||
mday: 2
|
||||
type: informal
|
||||
- name: Święto Narodowe Trzeciego Maja
|
||||
regions: [pl]
|
||||
mday: 3
|
||||
6:
|
||||
- name: Dzień Ojca
|
||||
regions: [pl]
|
||||
mday: 23
|
||||
type: informal
|
||||
8:
|
||||
- name: Wniebowzięcie Najświętszej Maryi Panny
|
||||
regions: [pl]
|
||||
mday: 15
|
||||
- name: Święto Wojska Polskiego
|
||||
regions: [pl]
|
||||
mday: 15
|
||||
9:
|
||||
- name: Dzień Chłopaka
|
||||
regions: [pl]
|
||||
mday: 30
|
||||
type: informal
|
||||
10:
|
||||
- name: Dzień Nauczyciela (Dzień Edukacji Narodowej)
|
||||
regions: [pl]
|
||||
mday: 14
|
||||
type: informal
|
||||
11:
|
||||
- name: Wszystkich Świętych
|
||||
regions: [pl]
|
||||
mday: 1
|
||||
- name: Dzień Zaduszny
|
||||
regions: [pl]
|
||||
mday: 2
|
||||
type: informal
|
||||
- name: Narodowe Święto Niepodległości
|
||||
regions: [pl]
|
||||
mday: 11
|
||||
- name: Andrzejki
|
||||
regions: [pl]
|
||||
mday: 29
|
||||
type: informal
|
||||
12:
|
||||
- name: Barbórka (Dzień Górnika, Naftowca i Gazownika)
|
||||
regions: [pl]
|
||||
mday: 4
|
||||
type: informal
|
||||
- name: Mikołajki
|
||||
regions: [pl]
|
||||
mday: 6
|
||||
type: informal
|
||||
- name: Wigilia Bożego Narodzenia
|
||||
regions: [pl]
|
||||
mday: 24
|
||||
type: informal
|
||||
- name: pierwszy dzień Bożego Narodzenia
|
||||
regions: [pl]
|
||||
mday: 25
|
||||
- name: drugi dzień Bożego Narodzenia
|
||||
regions: [pl]
|
||||
mday: 26
|
||||
- name: Sylwester
|
||||
regions: [pl]
|
||||
mday: 31
|
||||
type: informal
|
||||
methods:
|
||||
pl_trzech_kroli: |
|
||||
# Poland: January 6 is holiday since 2011
|
||||
def self.pl_trzech_kroli(year)
|
||||
year >= 2011 ? 6 : nil
|
||||
end
|
||||
pl_trzech_kroli_informal: |
|
||||
# Poland: January 6 wasn't holiday before 2011
|
||||
def self.pl_trzech_kroli_informal(year)
|
||||
year < 2011 ? 6 : nil
|
||||
end
|
||||
tests: |
|
||||
{Date.civil(2011,1,1) => 'Nowy Rok',
|
||||
Date.civil(2011,5,1) => 'Święto Państwowe (Święto Pracy)',
|
||||
Date.civil(2011,5,3) => 'Święto Narodowe Trzeciego Maja',
|
||||
Date.civil(2011,11,1) => 'Wszystkich Świętych',
|
||||
Date.civil(2011,11,11) => 'Narodowe Święto Niepodległości',
|
||||
Date.civil(2011,12,25) => 'pierwszy dzień Bożego Narodzenia',
|
||||
Date.civil(2011,12,26) => 'drugi dzień Bożego Narodzenia'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :pl)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# informal
|
||||
{Date.civil(2011,1,21) => 'Dzień Babci',
|
||||
Date.civil(2011,1,22) => 'Dzień Dziadka',
|
||||
Date.civil(2011,2,2) => 'Ofiarowanie Pańskie (Matki Boskiej Gromnicznej)',
|
||||
Date.civil(2011,2,14) => 'Dzień Zakochanych (Walentynki)',
|
||||
Date.civil(2010,3,8) => 'Dzień Kobiet',
|
||||
Date.civil(2011,3,10) => 'Dzień Mężczyzn',
|
||||
Date.civil(2011,4,1) => 'Prima Aprilis',
|
||||
Date.civil(2010,4,22) => 'Międzynarodowy Dzień Ziemi',
|
||||
Date.civil(2011,5,2) => 'Dzień Flagi Rzeczpospolitej Polskiej',
|
||||
Date.civil(2010,6,23) => 'Dzień Ojca',
|
||||
Date.civil(2011,9,30) => 'Dzień Chłopaka',
|
||||
Date.civil(2011,10,14) => 'Dzień Nauczyciela (Dzień Edukacji Narodowej)',
|
||||
Date.civil(2011,11,2) => 'Dzień Zaduszny',
|
||||
Date.civil(2011,11,29) => 'Andrzejki',
|
||||
Date.civil(2011,12,4) => 'Barbórka (Dzień Górnika, Naftowca i Gazownika)',
|
||||
Date.civil(2011,12,6) => 'Mikołajki',
|
||||
Date.civil(2011,12,24) => 'Wigilia Bożego Narodzenia',
|
||||
Date.civil(2011,12,31) => 'Sylwester'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :pl, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# informal
|
||||
{Date.civil(2011,1,21) => 'Dzień Babci',
|
||||
Date.civil(2011,1,22) => 'Dzień Dziadka',
|
||||
Date.civil(2011,2,2) => 'Ofiarowanie Pańskie (Matki Boskiej Gromnicznej)',
|
||||
Date.civil(2011,2,14) => 'Dzień Zakochanych (Walentynki)',
|
||||
Date.civil(2010,3,8) => 'Dzień Kobiet',
|
||||
Date.civil(2011,3,10) => 'Dzień Mężczyzn',
|
||||
Date.civil(2011,4,1) => 'Prima Aprilis',
|
||||
Date.civil(2010,4,22) => 'Międzynarodowy Dzień Ziemi',
|
||||
Date.civil(2011,5,2) => 'Dzień Flagi Rzeczpospolitej Polskiej',
|
||||
Date.civil(2010,6,23) => 'Dzień Ojca',
|
||||
Date.civil(2011,9,30) => 'Dzień Chłopaka',
|
||||
Date.civil(2011,10,14) => 'Dzień Nauczyciela (Dzień Edukacji Narodowej)',
|
||||
Date.civil(2011,11,2) => 'Dzień Zaduszny',
|
||||
Date.civil(2011,11,29) => 'Andrzejki',
|
||||
Date.civil(2011,12,4) => 'Barbórka (Dzień Górnika, Naftowca i Gazownika)',
|
||||
Date.civil(2011,12,6) => 'Mikołajki',
|
||||
Date.civil(2011,12,24) => 'Wigilia Bożego Narodzenia',
|
||||
Date.civil(2011,12,31) => 'Sylwester'}.each do |date, name|
|
||||
assert_equal nil, (Holidays.on(date, :pl)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Objawienie Pańskie (święto Trzech Króli) -- formal since 2011
|
||||
[Date.civil(2008,1,6), Date.civil(2009,1,6), Date.civil(2010,1,6)].each do |date|
|
||||
assert_equal nil, (Holidays.on(date, :pl)[0] || {})[:name]
|
||||
end
|
||||
[Date.civil(2008,1,6), Date.civil(2009,1,6), Date.civil(2010,1,6)].each do |date|
|
||||
assert_equal 'Objawienie Pańskie (święto Trzech Króli)', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
|
||||
end
|
||||
[Date.civil(2011,1,6), Date.civil(2012,1,6), Date.civil(2013,1,6)].each do |date|
|
||||
assert_equal 'Objawienie Pańskie (święto Trzech Króli)', (Holidays.on(date, :pl)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Tłusty Czwartek
|
||||
[Date.civil(2008,1,31), Date.civil(2009,2,19), Date.civil(2010,2,11),
|
||||
Date.civil(2011,3,3), Date.civil(2012,2,16)].each do |date|
|
||||
assert_equal 'Tłusty Czwartek', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Ostatki
|
||||
[Date.civil(2008,2,5), Date.civil(2009,2,24), Date.civil(2010,2,16),
|
||||
Date.civil(2011,3,8), Date.civil(2012,2,21)].each do |date|
|
||||
assert_equal 'Ostatki', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Środa Popielcowa
|
||||
[Date.civil(2008,2,6), Date.civil(2009,2,25), Date.civil(2010,2,17),
|
||||
Date.civil(2011,3,9), Date.civil(2012,2,22)].each do |date|
|
||||
assert_equal 'Środa Popielcowa', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Niedziela Palmowa
|
||||
[Date.civil(2008,3,16), Date.civil(2009,4,5), Date.civil(2010,3,28),
|
||||
Date.civil(2011,4,17), Date.civil(2012,4,1)].each do |date|
|
||||
assert_equal 'Niedziela Palmowa', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Wielki Czwartek
|
||||
[Date.civil(2008,3,20), Date.civil(2009,4,9), Date.civil(2010,4,1),
|
||||
Date.civil(2011,4,21), Date.civil(2012,4,5)].each do |date|
|
||||
assert_equal 'Wielki Czwartek', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Wielki Piątek
|
||||
[Date.civil(2008,3,21), Date.civil(2009,4,10), Date.civil(2010,4,2),
|
||||
Date.civil(2011,4,22), Date.civil(2012,4,6)].each do |date|
|
||||
assert_equal 'Wielki Piątek', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Wielka Sobota
|
||||
[Date.civil(2008,3,22), Date.civil(2009,4,11), Date.civil(2010,4,3),
|
||||
Date.civil(2011,4,23), Date.civil(2012,4,7)].each do |date|
|
||||
assert_equal 'Wielka Sobota', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Niedziela Wielkanocna
|
||||
[Date.civil(2008,3,23), Date.civil(2009,4,12), Date.civil(2010,4,4),
|
||||
Date.civil(2011,4,24), Date.civil(2012,4,8)].each do |date|
|
||||
assert_equal 'Niedziela Wielkanocna', (Holidays.on(date, :pl)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Poniedziałek Wielkanocny (Lany Poniedziałek)
|
||||
[Date.civil(2008,3,24), Date.civil(2009,4,13), Date.civil(2010,4,5),
|
||||
Date.civil(2011,4,25), Date.civil(2012,4,9)].each do |date|
|
||||
assert_equal 'Poniedziałek Wielkanocny (Lany Poniedziałek)', (Holidays.on(date, :pl)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Zesłanie Ducha Świętego (Zielone Świątki)
|
||||
[Date.civil(2008,5,11), Date.civil(2009,5,31), Date.civil(2010,5,23),
|
||||
Date.civil(2011,6,12), Date.civil(2012,5,27)].each do |date|
|
||||
assert_equal 'Zesłanie Ducha Świętego (Zielone Świątki)', (Holidays.on(date, :pl)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Uroczystość Najświętszego Ciała i Krwi Pańskiej (Boże Ciało)
|
||||
[Date.civil(2008,5,22), Date.civil(2009,6,11), Date.civil(2010,6,3),
|
||||
Date.civil(2011,6,23), Date.civil(2012,6,7)].each do |date|
|
||||
assert_equal 'Uroczystość Najświętszego Ciała i Krwi Pańskiej (Boże Ciało)', (Holidays.on(date, :pl)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Wniebowzięcie Najświętszej Maryi Panny & Święto Wojska Polskiego
|
||||
assert_equal 'Wniebowzięcie Najświętszej Maryi Panny', (Holidays.on(Date.civil(2011,8,15), :pl)[0] || {})[:name]
|
||||
assert_equal 'Święto Wojska Polskiego', (Holidays.on(Date.civil(2011,8,15), :pl)[1] || {})[:name]
|
|
@ -81,5 +81,5 @@ tests: |
|
|||
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, :informal)[0][:name]
|
||||
assert_equal name, (Holidays.on(date, :pt, :informal)[0] || {})[:name]
|
||||
end
|
|
@ -87,5 +87,5 @@ tests: |
|
|||
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]
|
||||
assert_equal name, (Holidays.on(date, :se, :informal)[0] || {})[:name]
|
||||
end
|
|
@ -1,188 +1,189 @@
|
|||
# United Nationas holiday definitions for the Ruby Holiday gem.
|
||||
# Updated 2008-11-21.
|
||||
---
|
||||
2:
|
||||
- name: International Mother Language Day
|
||||
regions: [un]
|
||||
mday: 2
|
||||
3:
|
||||
- name: United Nations Day for Women's Rights and International Peace
|
||||
regions: [un]
|
||||
mday: 8
|
||||
- name: International Day for the Elimination of Racial Discrimination
|
||||
regions: [un]
|
||||
mday: 21
|
||||
- name: Beginning of the Week of Solidarity with the Peoples Struggling against Racism and Racial Discrimination
|
||||
regions: [un]
|
||||
mday: 21
|
||||
- name: World Day for Water
|
||||
regions: [un]
|
||||
mday: 22
|
||||
- name: World Meteorological Day
|
||||
regions: [un]
|
||||
mday: 23
|
||||
4:
|
||||
- name: World Health Day
|
||||
regions: [un]
|
||||
mday: 7
|
||||
- name: World Book and Copyright Day
|
||||
regions: [un]
|
||||
mday: 23
|
||||
5:
|
||||
- name: World Press Freedom Day
|
||||
regions: [un]
|
||||
mday: 3
|
||||
- name: International Day of Families
|
||||
regions: [un]
|
||||
mday: 15
|
||||
- name: World Telecommunication Day
|
||||
regions: [un]
|
||||
mday: 17
|
||||
- name: World Day for Cultural Diversity for Dialogue and Development
|
||||
regions: [un]
|
||||
mday: 21
|
||||
- name: International Day for Biological Diversity
|
||||
regions: [un]
|
||||
mday: 22
|
||||
- name: Beginning of the Week of Solidarity with the Peoples of Non-Self-Governing Territories
|
||||
regions: [un]
|
||||
mday: 25
|
||||
- name: International Day of United Nations Peacekeepers
|
||||
regions: [un]
|
||||
mday: 29
|
||||
- name: World No-Tobacco Day
|
||||
regions: [un]
|
||||
mday: 31
|
||||
6:
|
||||
- name: International Day of Innocent Children Victims of Aggression
|
||||
regions: [un]
|
||||
mday: 4
|
||||
- name: World Environment Day
|
||||
regions: [un]
|
||||
mday: 5
|
||||
- name: World Day to Combat Desertification and Drought
|
||||
regions: [un]
|
||||
mday: 17
|
||||
- name: World Refugee Day
|
||||
regions: [un]
|
||||
mday: 20
|
||||
- name: United Nations Public Service Day
|
||||
regions: [un]
|
||||
mday: 23
|
||||
- name: International Day against Drug Abuse and Illicit Trafficking
|
||||
regions: [un]
|
||||
mday: 26
|
||||
- name: International Day in Support of Victims of Torture
|
||||
regions: [un]
|
||||
mday: 26
|
||||
7:
|
||||
- name: International Day of Cooperatives
|
||||
week: 1
|
||||
regions: [un]
|
||||
wday: 6
|
||||
- name: World Population Day
|
||||
regions: [un]
|
||||
mday: 11
|
||||
8:
|
||||
- name: International Day of the World's Indigenous People
|
||||
regions: [un]
|
||||
mday: 9
|
||||
- name: International Youth Day
|
||||
regions: [un]
|
||||
mday: 12
|
||||
- name: International Day for the Remembrance of the Slave Trade and Its Abolition
|
||||
regions: [un]
|
||||
mday: 23
|
||||
9:
|
||||
- name: International Literacy Day
|
||||
regions: [un]
|
||||
mday: 8
|
||||
- name: International Day for the Preservation of the Ozone Layer
|
||||
regions: [un]
|
||||
mday: 16
|
||||
- name: International Day of Peace
|
||||
regions: [un]
|
||||
mday: 21
|
||||
- name: International Day of Older Persons
|
||||
regions: [un]
|
||||
mday: 1
|
||||
10:
|
||||
- name: World Space Week
|
||||
regions: [un]
|
||||
mday: 4
|
||||
- name: World Teachers' Day
|
||||
regions: [un]
|
||||
mday: 5
|
||||
- name: World Habitat Day
|
||||
week: 1
|
||||
regions: [un]
|
||||
wday: 1
|
||||
- name: International Day for Natural Disaster Reduction
|
||||
week: 2
|
||||
regions: [un]
|
||||
wday: 3
|
||||
- name: World Post Day
|
||||
regions: [un]
|
||||
mday: 9
|
||||
- name: World Mental Health Day
|
||||
regions: [un]
|
||||
mday: 10
|
||||
- name: World Food Day
|
||||
regions: [un]
|
||||
mday: 16
|
||||
- name: International Day for the Eradication of Poverty
|
||||
regions: [un]
|
||||
mday: 17
|
||||
- name: United Nations Day
|
||||
regions: [un]
|
||||
mday: 24
|
||||
- name: World Development Information Day
|
||||
regions: [un]
|
||||
mday: 24
|
||||
- name: Disarmament Week
|
||||
regions: [un]
|
||||
mday: 24
|
||||
11:
|
||||
- name: International Day for Preventing the Exploitation of the Environment in War and Armed Conflict
|
||||
regions: [un]
|
||||
mday: 6
|
||||
- name: International Day for Tolerance
|
||||
regions: [un]
|
||||
mday: 16
|
||||
- name: Africa Industrialization Day
|
||||
regions: [un]
|
||||
mday: 20
|
||||
- name: Universal Children's Day
|
||||
regions: [un]
|
||||
mday: 20
|
||||
- name: World Television Day
|
||||
regions: [un]
|
||||
mday: 21
|
||||
- name: International Day for the Elimination of Violence against Women
|
||||
regions: [un]
|
||||
mday: 25
|
||||
- name: International Day of Solidarity with the Palestinian People
|
||||
regions: [un]
|
||||
mday: 29
|
||||
12:
|
||||
- name: World AIDS Day
|
||||
regions: [un]
|
||||
mday: 1
|
||||
- name: International Day for the Abolition of Slavery
|
||||
regions: [un]
|
||||
mday: 2
|
||||
- name: International Day of Disabled Persons
|
||||
regions: [un]
|
||||
mday: 3
|
||||
- name: International Volunteer Day for Economic and Social Development
|
||||
regions: [un]
|
||||
mday: 5
|
||||
- name: International Civil Aviation Day
|
||||
regions: [un]
|
||||
mday: 7
|
||||
- name: Human Rights Day
|
||||
regions: [un]
|
||||
mday: 10
|
||||
- name: International Migrants Day
|
||||
regions: [un]
|
||||
mday: 18
|
||||
# United Nationas holiday definitions for the Ruby Holiday gem.
|
||||
# Updated 2008-11-21.
|
||||
---
|
||||
months:
|
||||
2:
|
||||
- name: International Mother Language Day
|
||||
regions: [united_nations]
|
||||
mday: 2
|
||||
3:
|
||||
- name: United Nations Day for Women's Rights and International Peace
|
||||
regions: [united_nations]
|
||||
mday: 8
|
||||
- name: International Day for the Elimination of Racial Discrimination
|
||||
regions: [united_nations]
|
||||
mday: 21
|
||||
- name: Beginning of the Week of Solidarity with the Peoples Struggling against Racism and Racial Discrimination
|
||||
regions: [united_nations]
|
||||
mday: 21
|
||||
- name: World Day for Water
|
||||
regions: [united_nations]
|
||||
mday: 22
|
||||
- name: World Meteorological Day
|
||||
regions: [united_nations]
|
||||
mday: 23
|
||||
4:
|
||||
- name: World Health Day
|
||||
regions: [united_nations]
|
||||
mday: 7
|
||||
- name: World Book and Copyright Day
|
||||
regions: [united_nations]
|
||||
mday: 23
|
||||
5:
|
||||
- name: World Press Freedom Day
|
||||
regions: [united_nations]
|
||||
mday: 3
|
||||
- name: International Day of Families
|
||||
regions: [united_nations]
|
||||
mday: 15
|
||||
- name: World Telecommunication Day
|
||||
regions: [united_nations]
|
||||
mday: 17
|
||||
- name: World Day for Cultural Diversity for Dialogue and Development
|
||||
regions: [united_nations]
|
||||
mday: 21
|
||||
- name: International Day for Biological Diversity
|
||||
regions: [united_nations]
|
||||
mday: 22
|
||||
- name: Beginning of the Week of Solidarity with the Peoples of Non-Self-Governing Territories
|
||||
regions: [united_nations]
|
||||
mday: 25
|
||||
- name: International Day of United Nations Peacekeepers
|
||||
regions: [united_nations]
|
||||
mday: 29
|
||||
- name: World No-Tobacco Day
|
||||
regions: [united_nations]
|
||||
mday: 31
|
||||
6:
|
||||
- name: International Day of Innocent Children Victims of Aggression
|
||||
regions: [united_nations]
|
||||
mday: 4
|
||||
- name: World Environment Day
|
||||
regions: [united_nations]
|
||||
mday: 5
|
||||
- name: World Day to Combat Desertification and Drought
|
||||
regions: [united_nations]
|
||||
mday: 17
|
||||
- name: World Refugee Day
|
||||
regions: [united_nations]
|
||||
mday: 20
|
||||
- name: United Nations Public Service Day
|
||||
regions: [united_nations]
|
||||
mday: 23
|
||||
- name: International Day against Drug Abuse and Illicit Trafficking
|
||||
regions: [united_nations]
|
||||
mday: 26
|
||||
- name: International Day in Support of Victims of Torture
|
||||
regions: [united_nations]
|
||||
mday: 26
|
||||
7:
|
||||
- name: International Day of Cooperatives
|
||||
week: 1
|
||||
regions: [united_nations]
|
||||
wday: 6
|
||||
- name: World Population Day
|
||||
regions: [united_nations]
|
||||
mday: 11
|
||||
8:
|
||||
- name: International Day of the World's Indigenous People
|
||||
regions: [united_nations]
|
||||
mday: 9
|
||||
- name: International Youth Day
|
||||
regions: [united_nations]
|
||||
mday: 12
|
||||
- name: International Day for the Remembrance of the Slave Trade and Its Abolition
|
||||
regions: [united_nations]
|
||||
mday: 23
|
||||
9:
|
||||
- name: International Literacy Day
|
||||
regions: [united_nations]
|
||||
mday: 8
|
||||
- name: International Day for the Preservation of the Ozone Layer
|
||||
regions: [united_nations]
|
||||
mday: 16
|
||||
- name: International Day of Peace
|
||||
regions: [united_nations]
|
||||
mday: 21
|
||||
- name: International Day of Older Persons
|
||||
regions: [united_nations]
|
||||
mday: 1
|
||||
10:
|
||||
- name: World Space Week
|
||||
regions: [united_nations]
|
||||
mday: 4
|
||||
- name: World Teachers' Day
|
||||
regions: [united_nations]
|
||||
mday: 5
|
||||
- name: World Habitat Day
|
||||
week: 1
|
||||
regions: [united_nations]
|
||||
wday: 1
|
||||
- name: International Day for Natural Disaster Reduction
|
||||
week: 2
|
||||
regions: [united_nations]
|
||||
wday: 3
|
||||
- name: World Post Day
|
||||
regions: [united_nations]
|
||||
mday: 9
|
||||
- name: World Mental Health Day
|
||||
regions: [united_nations]
|
||||
mday: 10
|
||||
- name: World Food Day
|
||||
regions: [united_nations]
|
||||
mday: 16
|
||||
- name: International Day for the Eradication of Poverty
|
||||
regions: [united_nations]
|
||||
mday: 17
|
||||
- name: United Nations Day
|
||||
regions: [united_nations]
|
||||
mday: 24
|
||||
- name: World Development Information Day
|
||||
regions: [united_nations]
|
||||
mday: 24
|
||||
- name: Disarmament Week
|
||||
regions: [united_nations]
|
||||
mday: 24
|
||||
11:
|
||||
- name: International Day for Preventing the Exploitation of the Environment in War and Armed Conflict
|
||||
regions: [united_nations]
|
||||
mday: 6
|
||||
- name: International Day for Tolerance
|
||||
regions: [united_nations]
|
||||
mday: 16
|
||||
- name: Africa Industrialization Day
|
||||
regions: [united_nations]
|
||||
mday: 20
|
||||
- name: Universal Children's Day
|
||||
regions: [united_nations]
|
||||
mday: 20
|
||||
- name: World Television Day
|
||||
regions: [united_nations]
|
||||
mday: 21
|
||||
- name: International Day for the Elimination of Violence against Women
|
||||
regions: [united_nations]
|
||||
mday: 25
|
||||
- name: International Day of Solidarity with the Palestinian People
|
||||
regions: [united_nations]
|
||||
mday: 29
|
||||
12:
|
||||
- name: World AIDS Day
|
||||
regions: [united_nations]
|
||||
mday: 1
|
||||
- name: International Day for the Abolition of Slavery
|
||||
regions: [united_nations]
|
||||
mday: 2
|
||||
- name: International Day of Disabled Persons
|
||||
regions: [united_nations]
|
||||
mday: 3
|
||||
- name: International Volunteer Day for Economic and Social Development
|
||||
regions: [united_nations]
|
||||
mday: 5
|
||||
- name: International Civil Aviation Day
|
||||
regions: [united_nations]
|
||||
mday: 7
|
||||
- name: Human Rights Day
|
||||
regions: [united_nations]
|
||||
mday: 10
|
||||
- name: International Migrants Day
|
||||
regions: [united_nations]
|
||||
mday: 18
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
# UPS holiday definitions for the Ruby Holiday gem.
|
||||
#
|
||||
# By Tim Anglade
|
||||
#
|
||||
# Updated: 2008-09-23.
|
||||
# Source: http://www.ups.com/content/us/en/resources/ship/imp_exp/operation.html
|
||||
---
|
||||
months:
|
||||
1:
|
||||
- name: New Year's Day
|
||||
regions: [ups]
|
||||
mday: 1
|
||||
observed: to_weekday_if_weekend
|
||||
5:
|
||||
- name: Memorial Day
|
||||
week: -1
|
||||
regions: [ups]
|
||||
wday: 1
|
||||
7:
|
||||
- name: Independence Day
|
||||
regions: [ups]
|
||||
mday: 4
|
||||
observed: to_weekday_if_weekend
|
||||
9:
|
||||
- name: Labor Day
|
||||
week: 1
|
||||
regions: [ups]
|
||||
wday: 1
|
||||
11:
|
||||
- name: Thanksgiving
|
||||
week: 4
|
||||
regions: [ups]
|
||||
wday: 4
|
||||
- name: Day After Thanksgiving
|
||||
week: 4
|
||||
regions: [ups]
|
||||
wday: 5
|
||||
12:
|
||||
- name: Christmas Day
|
||||
regions: [ups]
|
||||
mday: 25
|
||||
observed: to_weekday_if_weekend
|
||||
- name: New Year's Eve
|
||||
regions: [ups]
|
||||
mday: 31
|
||||
tests: |
|
||||
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
||||
Date.civil(2008,5,26) => 'Memorial Day',
|
||||
Date.civil(2008,7,4) => 'Independence Day',
|
||||
Date.civil(2008,9,1) => 'Labor Day',
|
||||
Date.civil(2008,11,27) => 'Thanksgiving',
|
||||
Date.civil(2008,11,28) => 'Day After Thanksgiving',
|
||||
Date.civil(2008,12,25) => 'Christmas Day',
|
||||
Date.civil(2008,12,31) => 'New Year\'s Eve',}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :ups)[0] || {})[:name]
|
||||
end
|
160
data/us.yaml
160
data/us.yaml
|
@ -1,81 +1,81 @@
|
|||
# United States holiday definitions for the Ruby Holiday gem.
|
||||
#
|
||||
# Updated: 2008-11-24.
|
||||
# Source: http://en.wikipedia.org/wiki/Public_holidays_of_the_United_States
|
||||
---
|
||||
months:
|
||||
0:
|
||||
- name: Good Friday
|
||||
regions: [us]
|
||||
function: easter(year)-2
|
||||
type: informal
|
||||
1:
|
||||
- name: New Year's Day
|
||||
regions: [us]
|
||||
mday: 1
|
||||
observed: to_weekday_if_weekend
|
||||
- name: Martin Luther King, Jr. Day
|
||||
week: 3
|
||||
regions: [us]
|
||||
wday: 1
|
||||
- name: Inauguration Day
|
||||
function: us_inauguration_day(year)
|
||||
regions: [us_dc]
|
||||
2:
|
||||
- name: Presidents' Day
|
||||
week: 3
|
||||
regions: [us]
|
||||
wday: 1
|
||||
5:
|
||||
- name: Memorial Day
|
||||
week: -1
|
||||
regions: [us]
|
||||
wday: 1
|
||||
7:
|
||||
- name: Independence Day
|
||||
regions: [us]
|
||||
mday: 4
|
||||
observed: to_weekday_if_weekend
|
||||
9:
|
||||
- name: Labor Day
|
||||
week: 1
|
||||
regions: [us]
|
||||
wday: 1
|
||||
10:
|
||||
- name: Columbus Day
|
||||
week: 2
|
||||
regions: [us]
|
||||
wday: 1
|
||||
11:
|
||||
- name: Veterans Day
|
||||
regions: [us]
|
||||
mday: 11
|
||||
observed: to_weekday_if_weekend
|
||||
- name: Thanksgiving
|
||||
week: 4
|
||||
regions: [us]
|
||||
wday: 4
|
||||
12:
|
||||
- name: Christmas Day
|
||||
regions: [us]
|
||||
mday: 25
|
||||
observed: to_weekday_if_weekend
|
||||
methods:
|
||||
us_inauguration_day: |
|
||||
# January 20, every fourth year, following Presidential election
|
||||
def self.us_inauguration_day(year)
|
||||
year % 4 == 1 ? 20 : nil
|
||||
end
|
||||
tests: |
|
||||
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
||||
Date.civil(2008,1,21) => 'Martin Luther King, Jr. Day',
|
||||
Date.civil(2008,2,18) => 'Presidents\' Day',
|
||||
Date.civil(2008,5,26) => 'Memorial Day',
|
||||
Date.civil(2008,7,4) => 'Independence Day',
|
||||
Date.civil(2008,9,1) => 'Labor Day',
|
||||
Date.civil(2008,10,13) => 'Columbus Day',
|
||||
Date.civil(2008,11,11) => 'Veterans Day',
|
||||
Date.civil(2008,11,27) => 'Thanksgiving',
|
||||
Date.civil(2008,12,25) => 'Christmas Day'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :us)[0][:name]
|
||||
# United States holiday definitions for the Ruby Holiday gem.
|
||||
#
|
||||
# Updated: 2008-11-24.
|
||||
# Source: http://en.wikipedia.org/wiki/Public_holidays_of_the_United_States
|
||||
---
|
||||
months:
|
||||
0:
|
||||
- name: Good Friday
|
||||
regions: [us]
|
||||
function: easter(year)-2
|
||||
type: informal
|
||||
1:
|
||||
- name: New Year's Day
|
||||
regions: [us]
|
||||
mday: 1
|
||||
observed: to_weekday_if_weekend
|
||||
- name: Martin Luther King, Jr. Day
|
||||
week: 3
|
||||
regions: [us]
|
||||
wday: 1
|
||||
- name: Inauguration Day
|
||||
function: us_inauguration_day(year)
|
||||
regions: [us_dc]
|
||||
2:
|
||||
- name: Presidents' Day
|
||||
week: 3
|
||||
regions: [us]
|
||||
wday: 1
|
||||
5:
|
||||
- name: Memorial Day
|
||||
week: -1
|
||||
regions: [us]
|
||||
wday: 1
|
||||
7:
|
||||
- name: Independence Day
|
||||
regions: [us]
|
||||
mday: 4
|
||||
observed: to_weekday_if_weekend
|
||||
9:
|
||||
- name: Labor Day
|
||||
week: 1
|
||||
regions: [us]
|
||||
wday: 1
|
||||
10:
|
||||
- name: Columbus Day
|
||||
week: 2
|
||||
regions: [us]
|
||||
wday: 1
|
||||
11:
|
||||
- name: Veterans Day
|
||||
regions: [us]
|
||||
mday: 11
|
||||
observed: to_weekday_if_weekend
|
||||
- name: Thanksgiving
|
||||
week: 4
|
||||
regions: [us]
|
||||
wday: 4
|
||||
12:
|
||||
- name: Christmas Day
|
||||
regions: [us]
|
||||
mday: 25
|
||||
observed: to_weekday_if_weekend
|
||||
methods:
|
||||
us_inauguration_day: |
|
||||
# January 20, every fourth year, following Presidential election
|
||||
def self.us_inauguration_day(year)
|
||||
year % 4 == 1 ? 20 : nil
|
||||
end
|
||||
tests: |
|
||||
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
||||
Date.civil(2008,1,21) => 'Martin Luther King, Jr. Day',
|
||||
Date.civil(2008,2,18) => 'Presidents\' Day',
|
||||
Date.civil(2008,5,26) => 'Memorial Day',
|
||||
Date.civil(2008,7,4) => 'Independence Day',
|
||||
Date.civil(2008,9,1) => 'Labor Day',
|
||||
Date.civil(2008,10,13) => 'Columbus Day',
|
||||
Date.civil(2008,11,11) => 'Veterans Day',
|
||||
Date.civil(2008,11,27) => 'Thanksgiving',
|
||||
Date.civil(2008,12,25) => 'Christmas Day'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :us)[0] || {})[:name]
|
||||
end
|
|
@ -74,5 +74,5 @@ tests: |
|
|||
Date.civil(2007,12,16) => 'Day of Reconciliation',
|
||||
Date.civil(2007,12,25) => 'Christmas Day',
|
||||
Date.civil(2007,12,26) => 'Day of Goodwill'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :za, :informal)[0][:name]
|
||||
assert_equal name, (Holidays.on(date, :za, :informal)[0] || {})[:name]
|
||||
end
|
|
@ -0,0 +1,188 @@
|
|||
# Generated by jeweler
|
||||
# DO NOT EDIT THIS FILE DIRECTLY
|
||||
# Instead, edit Jeweler::Tasks in rakefile.rb, and run 'rake gemspec'
|
||||
# -*- encoding: utf-8 -*-
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
s.name = "holidays"
|
||||
s.version = "1.0.4"
|
||||
|
||||
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
||||
s.authors = ["Alex Dunae"]
|
||||
s.date = "2011-10-19"
|
||||
s.description = "A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!"
|
||||
s.email = "code@dunae.ca"
|
||||
s.extra_rdoc_files = [
|
||||
"LICENSE",
|
||||
"README.rdoc"
|
||||
]
|
||||
s.files = [
|
||||
".travis.yml",
|
||||
"CHANGELOG",
|
||||
"Gemfile",
|
||||
"LICENSE",
|
||||
"README.rdoc",
|
||||
"REFERENCES",
|
||||
"data/SYNTAX.rdoc",
|
||||
"data/at.yaml",
|
||||
"data/au.yaml",
|
||||
"data/br.yaml",
|
||||
"data/build_defs.rb",
|
||||
"data/ca.yaml",
|
||||
"data/cz.yaml",
|
||||
"data/de.yaml",
|
||||
"data/dk.yaml",
|
||||
"data/el.yaml",
|
||||
"data/es.yaml",
|
||||
"data/fi.yaml",
|
||||
"data/fr.yaml",
|
||||
"data/gb.yaml",
|
||||
"data/ie.yaml",
|
||||
"data/index.yaml",
|
||||
"data/is.yaml",
|
||||
"data/it.yaml",
|
||||
"data/jp.yaml",
|
||||
"data/li.yaml",
|
||||
"data/mx.yaml",
|
||||
"data/nl.yaml",
|
||||
"data/no.yaml",
|
||||
"data/north_america_informal.yaml",
|
||||
"data/nyse.yaml",
|
||||
"data/nz.yaml",
|
||||
"data/pl.yaml",
|
||||
"data/pt.yaml",
|
||||
"data/se.yaml",
|
||||
"data/united_nations.yaml",
|
||||
"data/ups.yaml",
|
||||
"data/us.yaml",
|
||||
"data/za.yaml",
|
||||
"holidays.gemspec",
|
||||
"lib/holidays.rb",
|
||||
"lib/holidays/MANIFEST",
|
||||
"lib/holidays/at.rb",
|
||||
"lib/holidays/au.rb",
|
||||
"lib/holidays/br.rb",
|
||||
"lib/holidays/ca.rb",
|
||||
"lib/holidays/cz.rb",
|
||||
"lib/holidays/de.rb",
|
||||
"lib/holidays/dk.rb",
|
||||
"lib/holidays/el.rb",
|
||||
"lib/holidays/es.rb",
|
||||
"lib/holidays/europe.rb",
|
||||
"lib/holidays/fi.rb",
|
||||
"lib/holidays/fr.rb",
|
||||
"lib/holidays/gb.rb",
|
||||
"lib/holidays/ie.rb",
|
||||
"lib/holidays/is.rb",
|
||||
"lib/holidays/it.rb",
|
||||
"lib/holidays/jp.rb",
|
||||
"lib/holidays/li.rb",
|
||||
"lib/holidays/mx.rb",
|
||||
"lib/holidays/nl.rb",
|
||||
"lib/holidays/no.rb",
|
||||
"lib/holidays/north_america.rb",
|
||||
"lib/holidays/nyse.rb",
|
||||
"lib/holidays/nz.rb",
|
||||
"lib/holidays/pl.rb",
|
||||
"lib/holidays/pt.rb",
|
||||
"lib/holidays/scandinavia.rb",
|
||||
"lib/holidays/se.rb",
|
||||
"lib/holidays/united_nations.rb",
|
||||
"lib/holidays/ups.rb",
|
||||
"lib/holidays/us.rb",
|
||||
"lib/holidays/za.rb",
|
||||
"rakefile.rb",
|
||||
"test/defs/test_defs_at.rb",
|
||||
"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_li.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_pl.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_all_regions.rb",
|
||||
"test/test_date.rb",
|
||||
"test/test_helper.rb",
|
||||
"test/test_holidays.rb",
|
||||
"test/test_multiple_regions.rb"
|
||||
]
|
||||
s.homepage = "https://github.com/alexdunae/holidays"
|
||||
s.require_paths = ["lib"]
|
||||
s.rubygems_version = "1.8.10"
|
||||
s.summary = "A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!"
|
||||
|
||||
if s.respond_to? :specification_version then
|
||||
s.specification_version = 3
|
||||
|
||||
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
||||
s.add_runtime_dependency(%q<holidays>, [">= 0"])
|
||||
s.add_development_dependency(%q<rdoc>, [">= 2.4.2"])
|
||||
s.add_development_dependency(%q<rake>, [">= 0"])
|
||||
s.add_development_dependency(%q<rdoc>, [">= 2.4.2"])
|
||||
s.add_development_dependency(%q<rdoc>, [">= 2.4.2"])
|
||||
s.add_development_dependency(%q<rake>, [">= 0"])
|
||||
s.add_development_dependency(%q<rdoc>, [">= 2.4.2"])
|
||||
s.add_development_dependency(%q<rdoc>, [">= 2.4.2"])
|
||||
s.add_development_dependency(%q<rake>, [">= 0"])
|
||||
s.add_development_dependency(%q<rdoc>, [">= 2.4.2"])
|
||||
s.add_development_dependency(%q<rdoc>, [">= 2.4.2"])
|
||||
s.add_development_dependency(%q<rake>, [">= 0"])
|
||||
s.add_development_dependency(%q<rdoc>, [">= 2.4.2"])
|
||||
s.add_development_dependency(%q<rdoc>, [">= 2.4.2"])
|
||||
else
|
||||
s.add_dependency(%q<holidays>, [">= 0"])
|
||||
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
|
||||
s.add_dependency(%q<rake>, [">= 0"])
|
||||
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
|
||||
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
|
||||
s.add_dependency(%q<rake>, [">= 0"])
|
||||
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
|
||||
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
|
||||
s.add_dependency(%q<rake>, [">= 0"])
|
||||
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
|
||||
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
|
||||
s.add_dependency(%q<rake>, [">= 0"])
|
||||
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
|
||||
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
|
||||
end
|
||||
else
|
||||
s.add_dependency(%q<holidays>, [">= 0"])
|
||||
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
|
||||
s.add_dependency(%q<rake>, [">= 0"])
|
||||
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
|
||||
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
|
||||
s.add_dependency(%q<rake>, [">= 0"])
|
||||
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
|
||||
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
|
||||
s.add_dependency(%q<rake>, [">= 0"])
|
||||
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
|
||||
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
|
||||
s.add_dependency(%q<rake>, [">= 0"])
|
||||
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
|
||||
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
|
||||
end
|
||||
end
|
||||
|
871
lib/holidays.rb
871
lib/holidays.rb
|
@ -1,404 +1,469 @@
|
|||
$:.unshift File.dirname(__FILE__)
|
||||
|
||||
require 'digest/md5'
|
||||
require 'date'
|
||||
|
||||
# == Region options
|
||||
# Holidays can be defined as belonging to one or more regions and sub regions.
|
||||
# The Holidays#on, Holidays#between, Date#holidays and Date#holiday? methods
|
||||
# each allow you to specify a specific region.
|
||||
#
|
||||
# There are several different ways that you can specify a region:
|
||||
#
|
||||
# [<tt>:region</tt>]
|
||||
# By region. For example, return holidays in the Canada with <tt>:ca</tt>.
|
||||
# [<tt>:region_</tt>]
|
||||
# By region and sub regions. For example, return holidays in Germany
|
||||
# and all its sub regions with <tt>:de_</tt>.
|
||||
# [<tt>:region_sub</tt>]
|
||||
# By sub region. Return national holidays in Spain plus holidays in Spain's
|
||||
# Valencia region with <tt>:es_v</tt>.
|
||||
# [<tt>:any</tt>]
|
||||
# Any region. Return holidays from any loaded region.
|
||||
#
|
||||
# == Other options
|
||||
# [<tt>:observed</tt>] Return holidays on the day they are observed (e.g. on a Monday if they fall on a Sunday).
|
||||
# [<tt>:informal</tt>] Include informal holidays (e.g. Valentine's Day)
|
||||
#
|
||||
# == Examples
|
||||
# Return all holidays in the <tt>:ca</tt> and <tt>:us</tt> regions on the day that they are
|
||||
# observed.
|
||||
#
|
||||
# Holidays.between(from, to, :ca, :us, :observed)
|
||||
#
|
||||
# Return all holidays in <tt>:ca</tt> and any <tt>:ca</tt> sub-region.
|
||||
#
|
||||
# Holidays.between(from, to, :ca_)
|
||||
#
|
||||
# Return all holidays in <tt>:ca_bc</tt> sub-region (which includes the <tt>:ca</tt>), including informal holidays.
|
||||
#
|
||||
# Holidays.between(from, to, :ca_bc, :informal)
|
||||
module Holidays
|
||||
# Exception thrown when an unknown region is requested.
|
||||
class UnkownRegionError < ArgumentError; end
|
||||
|
||||
VERSION = '0.9.0'
|
||||
|
||||
@@regions = []
|
||||
@@holidays_by_month = {}
|
||||
@@proc_cache = {}
|
||||
|
||||
WEEKS = {:first => 1, :second => 2, :third => 3, :fourth => 4, :fifth => 5, :last => -1}
|
||||
MONTH_LENGTHS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
|
||||
DAY_SYMBOLS = Date::DAYNAMES.collect { |n| n.downcase.intern }
|
||||
|
||||
# Get all holidays on a given date.
|
||||
#
|
||||
# [<tt>date</tt>] A Date object.
|
||||
# [<tt>:options</tt>] One or more region symbols, <tt>:informal</tt> and/or <tt>:observed</tt>.
|
||||
#
|
||||
# Returns an array of hashes or nil. See Holidays#between for the output
|
||||
# format.
|
||||
#
|
||||
# Also available via Date#holidays.
|
||||
def self.on(date, *options)
|
||||
self.between(date, date, options)
|
||||
end
|
||||
|
||||
# Get all holidays occuring between two dates, inclusively.
|
||||
#
|
||||
# Returns an array of hashes or nil.
|
||||
#
|
||||
# Each holiday is returned as a hash with the following fields:
|
||||
# [<tt>start_date</tt>] Ruby Date object.
|
||||
# [<tt>end_date</tt>] Ruby Date object.
|
||||
# [<tt>options</tt>] One or more region symbols, <tt>:informal</tt> and/or <tt>:observed</tt>.
|
||||
#
|
||||
# ==== Example
|
||||
# from = Date.civil(2008,7,1)
|
||||
# to = Date.civil(2008,7,31)
|
||||
#
|
||||
# Holidays.between(from, to, :ca, :us)
|
||||
# => [{:name => 'Canada Day', :regions => [:ca]...}
|
||||
# {:name => 'Independence Day'', :regions => [:us], ...}]
|
||||
def self.between(start_date, end_date, *options)
|
||||
regions, observed, informal = parse_options(options)
|
||||
holidays = []
|
||||
|
||||
dates = {}
|
||||
(start_date..end_date).each do |date|
|
||||
# Always include month '0' for variable-month holidays
|
||||
dates[date.year] = [0] unless dates[date.year]
|
||||
# TODO: test this, maybe should push then flatten
|
||||
dates[date.year] << date.month unless dates[date.year].include?(date.month)
|
||||
end
|
||||
|
||||
dates.each do |year, months|
|
||||
months.each do |month|
|
||||
next unless hbm = @@holidays_by_month[month]
|
||||
|
||||
hbm.each do |h|
|
||||
next unless in_region?(regions, h[:regions])
|
||||
|
||||
# Skip informal holidays unless they have been requested
|
||||
next if h[:type] == :informal and not informal
|
||||
|
||||
if h[:function]
|
||||
# Holiday definition requires a calculation
|
||||
result = call_proc(h[:function], year)
|
||||
|
||||
# Procs may return either Date or an integer representing mday
|
||||
if result.kind_of?(Date)
|
||||
month = result.month
|
||||
mday = result.mday
|
||||
else
|
||||
mday = result
|
||||
end
|
||||
else
|
||||
# Calculate the mday
|
||||
mday = h[:mday] || Date.calculate_mday(year, month, h[:week], h[:wday])
|
||||
end
|
||||
|
||||
# Silently skip bad mdays
|
||||
begin
|
||||
date = Date.civil(year, month, mday)
|
||||
rescue; next; end
|
||||
|
||||
# If the :observed option is set, calculate the date when the holiday
|
||||
# is observed.
|
||||
if observed and h[:observed]
|
||||
date = call_proc(h[:observed], date)
|
||||
end
|
||||
|
||||
if date.between?(start_date, end_date)
|
||||
holidays << {:date => date, :name => h[:name], :regions => h[:regions]}
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
holidays
|
||||
end
|
||||
|
||||
# Merge a new set of definitions into the Holidays module.
|
||||
#
|
||||
# This method is automatically called when including holiday definition
|
||||
# files.
|
||||
def self.merge_defs(regions, holidays) # :nodoc:
|
||||
@@regions = @@regions | regions
|
||||
@@regions.uniq!
|
||||
|
||||
holidays.each do |month, holiday_defs|
|
||||
@@holidays_by_month[month] = [] unless @@holidays_by_month[month]
|
||||
holiday_defs.each do |holiday_def|
|
||||
|
||||
exists = false
|
||||
@@holidays_by_month[month].each do |ex|
|
||||
# TODO: gross.
|
||||
if ex[:name] == holiday_def[:name] and ex[:wday] == holiday_def[:wday] and ex[:mday] == holiday_def[:mday] and ex[:week] == holiday_def[:week] and ex[:function_id] == holiday_def[:function_id] and ex[:type] == holiday_def[:type] and ex[:observed_id] == holiday_def[:observed_id]
|
||||
# append regions
|
||||
ex[:regions] << holiday_def[:regions]
|
||||
|
||||
# Should do this once we're done
|
||||
ex[:regions].flatten!
|
||||
ex[:regions].uniq!
|
||||
exists = true
|
||||
end
|
||||
end
|
||||
|
||||
@@holidays_by_month[month] << holiday_def unless exists
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Get the date of Easter Sunday in a given year. From Easter Sunday, it is
|
||||
# possible to calculate many traditional holidays in Western countries.
|
||||
# Returns a Date object.
|
||||
def self.easter(year)
|
||||
y = year
|
||||
a = y % 19
|
||||
b = y / 100
|
||||
c = y % 100
|
||||
d = b / 4
|
||||
e = b % 4
|
||||
f = (b + 8) / 25
|
||||
g = (b - f + 1) / 3
|
||||
h = (19 * a + b - d - g + 15) % 30
|
||||
i = c / 4
|
||||
k = c % 4
|
||||
l = (32 + 2 * e + 2 * i - h - k) % 7
|
||||
m = (a + 11 * h + 22 * l) / 451
|
||||
month = (h + l - 7 * m + 114) / 31
|
||||
day = ((h + l - 7 * m + 114) % 31) + 1
|
||||
Date.civil(year, month, day)
|
||||
end
|
||||
|
||||
# Move date to Monday if it occurs on a Sunday.
|
||||
# Used as a callback function.
|
||||
def self.to_monday_if_sunday(date)
|
||||
date += 1 if date.wday == 0
|
||||
date
|
||||
end
|
||||
|
||||
# Move date to Monday if it occurs on a Saturday on Sunday.
|
||||
# Used as a callback function.
|
||||
def self.to_monday_if_weekend(date)
|
||||
date += 1 if date.wday == 0
|
||||
date += 2 if date.wday == 6
|
||||
date
|
||||
end
|
||||
|
||||
# Move Boxing Day if it falls on a weekend, leaving room for Christmas.
|
||||
# Used as a callback function.
|
||||
def self.to_weekday_if_boxing_weekend(date)
|
||||
date += 2 if date.wday == 6 or date.wday == 0
|
||||
date
|
||||
end
|
||||
|
||||
# Move date to Monday if it occurs on a Sunday or to Friday if it occurs on a
|
||||
# Saturday.
|
||||
# Used as a callback function.
|
||||
def self.to_weekday_if_weekend(date)
|
||||
date += 1 if date.wday == 0
|
||||
date -= 1 if date.wday == 6
|
||||
date
|
||||
end
|
||||
|
||||
private
|
||||
# Returns [(arr)regions, (bool)observed, (bool)informal]
|
||||
def self.parse_options(*options) # :nodoc:
|
||||
options.flatten!
|
||||
observed = options.delete(:observed) ? true : false
|
||||
informal = options.delete(:informal) ? true : false
|
||||
regions = parse_regions(options)
|
||||
return regions, observed, informal
|
||||
end
|
||||
|
||||
# Check regions against list of supported regions and return an array of
|
||||
# symbols.
|
||||
#
|
||||
# If a wildcard region is found (e.g. <tt>:ca_</tt>) it is expanded into all
|
||||
# of its available sub regions.
|
||||
def self.parse_regions(regions) # :nodoc:
|
||||
regions = [regions] unless regions.kind_of?(Array)
|
||||
return [:any] if regions.empty?
|
||||
|
||||
regions = regions.collect { |r| r.to_sym }
|
||||
|
||||
# Found sub region wild-card
|
||||
regions.delete_if do |reg|
|
||||
if reg.to_s =~ /_$/
|
||||
regions << @@regions.select { |dr| dr.to_s =~ Regexp.new("^#{reg}") }
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
regions.flatten!
|
||||
|
||||
raise UnkownRegionError unless regions.all? { |r| r == :any or @@regions.include?(r) }
|
||||
|
||||
regions
|
||||
end
|
||||
|
||||
# Check sub regions.
|
||||
#
|
||||
# When request :any, all holidays should be returned.
|
||||
# When requesting :ca_bc, holidays in :ca or :ca_bc should be returned.
|
||||
# When requesting :ca, holidays in :ca but not its subregions should be returned.
|
||||
def self.in_region?(requested, available) # :nodoc:
|
||||
return true if requested.include?(:any)
|
||||
|
||||
# When an underscore is encountered, derive the parent regions
|
||||
# symbol and include both in the requested array.
|
||||
requested = requested.collect do |r|
|
||||
r.to_s =~ /_/ ? [r, r.to_s.gsub(/_[\w]*$/, '').to_sym] : r
|
||||
end
|
||||
|
||||
requested = requested.flatten.uniq
|
||||
|
||||
available.any? { |avail| requested.include?(avail) }
|
||||
end
|
||||
|
||||
# Call a proc function defined in a holiday definition file.
|
||||
#
|
||||
# Procs are cached.
|
||||
#
|
||||
# ==== Benchmarks
|
||||
#
|
||||
# Lookup Easter Sunday, with caching, by number of iterations:
|
||||
#
|
||||
# user system total real
|
||||
# 0001 0.000000 0.000000 0.000000 ( 0.000000)
|
||||
# 0010 0.000000 0.000000 0.000000 ( 0.000000)
|
||||
# 0100 0.078000 0.000000 0.078000 ( 0.078000)
|
||||
# 1000 0.641000 0.000000 0.641000 ( 0.641000)
|
||||
# 5000 3.172000 0.015000 3.187000 ( 3.219000)
|
||||
#
|
||||
# Lookup Easter Sunday, without caching, by number of iterations:
|
||||
#
|
||||
# user system total real
|
||||
# 0001 0.000000 0.000000 0.000000 ( 0.000000)
|
||||
# 0010 0.016000 0.000000 0.016000 ( 0.016000)
|
||||
# 0100 0.125000 0.000000 0.125000 ( 0.125000)
|
||||
# 1000 1.234000 0.000000 1.234000 ( 1.234000)
|
||||
# 5000 6.094000 0.031000 6.125000 ( 6.141000)
|
||||
def self.call_proc(function, year) # :nodoc:
|
||||
proc_key = Digest::MD5.hexdigest("#{function.to_s}_#{year.to_s}")
|
||||
@@proc_cache[proc_key] = function.call(year) unless @@proc_cache[proc_key]
|
||||
@@proc_cache[proc_key]
|
||||
end
|
||||
end
|
||||
|
||||
# === Extending Ruby's Date class with the Holidays gem
|
||||
# The Holidays gem automatically extends Ruby's Date class and gives you access
|
||||
# to three new methods: holiday?, #holidays and #calculate_mday.
|
||||
#
|
||||
# ==== Examples
|
||||
# Lookup Canada Day in the <tt>:ca</tt> region
|
||||
# Date.civil(2008,7,1).holiday?(:ca)
|
||||
# => true
|
||||
#
|
||||
# Lookup Canada Day in the <tt>:fr</tt> region
|
||||
# Date.civil(2008,7,1).holiday?(:fr)
|
||||
# => false
|
||||
#
|
||||
# Lookup holidays on North America in January 1.
|
||||
# Date.civil(2008,1,1).holidays(:ca, :mx, :us, :informal, :observed)
|
||||
# => [{:name => 'New Year\'s Day'...}]
|
||||
class Date
|
||||
include Holidays
|
||||
|
||||
# Get holidays on the current date.
|
||||
#
|
||||
# Returns an array of hashes or nil. See Holidays#between for options
|
||||
# and the output format.
|
||||
#
|
||||
# Date.civil('2008-01-01').holidays(:ca_)
|
||||
# => [{:name => 'New Year\'s Day',...}]
|
||||
#
|
||||
# Also available via Holidays#on.
|
||||
def holidays(*options)
|
||||
Holidays.on(self, options)
|
||||
end
|
||||
|
||||
# Check if the current date is a holiday.
|
||||
#
|
||||
# Returns true or false.
|
||||
#
|
||||
# Date.civil('2008-01-01').holiday?(:ca)
|
||||
# => true
|
||||
def holiday?(*options)
|
||||
holidays = self.holidays(options)
|
||||
holidays && !holidays.empty?
|
||||
end
|
||||
|
||||
# Calculate day of the month based on the week number and the day of the
|
||||
# week.
|
||||
#
|
||||
# ==== Parameters
|
||||
# [<tt>year</tt>] Integer.
|
||||
# [<tt>month</tt>] Integer from 1-12.
|
||||
# [<tt>week</tt>] One of <tt>:first</tt>, <tt>:second</tt>, <tt>:third</tt>,
|
||||
# <tt>:fourth</tt>, <tt>:fifth</tt> or <tt>:last</tt>.
|
||||
# [<tt>wday</tt>] Day of the week as an integer from 0 (Sunday) to 6
|
||||
# (Saturday) or as a symbol (e.g. <tt>:monday</tt>).
|
||||
#
|
||||
# Returns an integer.
|
||||
#
|
||||
# ===== Examples
|
||||
# First Monday of January, 2008:
|
||||
# Date.calculate_mday(2008, 1, :first, :monday)
|
||||
# => 7
|
||||
#
|
||||
# Third Thursday of December, 2008:
|
||||
# Date.calculate_mday(2008, 12, :third, :thursday)
|
||||
# => 18
|
||||
#
|
||||
# Last Monday of January, 2008:
|
||||
# Date.calculate_mday(2008, 1, :last, 1)
|
||||
# => 28
|
||||
#--
|
||||
# see http://www.irt.org/articles/js050/index.htm
|
||||
def self.calculate_mday(year, month, week, wday)
|
||||
raise ArgumentError, "Week parameter must be one of Holidays::WEEKS (provided #{week})." unless WEEKS.include?(week) or WEEKS.has_value?(week)
|
||||
|
||||
unless wday.kind_of?(Numeric) and wday.between?(0,6) or DAY_SYMBOLS.index(wday)
|
||||
raise ArgumentError, "Wday parameter must be an integer between 0 and 6 or one of Date::DAY_SYMBOLS."
|
||||
end
|
||||
|
||||
week = WEEKS[week] if week.kind_of?(Symbol)
|
||||
wday = DAY_SYMBOLS.index(wday) if wday.kind_of?(Symbol)
|
||||
|
||||
# :first, :second, :third, :fourth or :fifth
|
||||
if week > 0
|
||||
return ((week - 1) * 7) + 1 + ((7 + wday - Date.civil(year, month,(week-1)*7 + 1).wday) % 7)
|
||||
end
|
||||
|
||||
days = MONTH_LENGTHS[month-1]
|
||||
|
||||
days = 29 if month == 1 and Date.civil(year,1,1).leap?
|
||||
|
||||
return days - ((Date.civil(year, month, days).wday - wday + 7) % 7)
|
||||
end
|
||||
# encoding: utf-8
|
||||
$:.unshift File.dirname(__FILE__)
|
||||
|
||||
require 'digest/md5'
|
||||
require 'date'
|
||||
|
||||
# == Region options
|
||||
# Holidays can be defined as belonging to one or more regions and sub regions.
|
||||
# The Holidays#on, Holidays#between, Date#holidays and Date#holiday? methods
|
||||
# each allow you to specify a specific region.
|
||||
#
|
||||
# There are several different ways that you can specify a region:
|
||||
#
|
||||
# [<tt>:region</tt>]
|
||||
# By region. For example, return holidays in the Canada with <tt>:ca</tt>.
|
||||
# [<tt>:region_</tt>]
|
||||
# By region and sub regions. For example, return holidays in Germany
|
||||
# and all its sub regions with <tt>:de_</tt>.
|
||||
# [<tt>:region_sub</tt>]
|
||||
# By sub region. Return national holidays in Spain plus holidays in Spain's
|
||||
# Valencia region with <tt>:es_v</tt>.
|
||||
# [<tt>:any</tt>]
|
||||
# Any region. Return holidays from any loaded region.
|
||||
#
|
||||
#
|
||||
# You can load all the available holiday definition sets by running
|
||||
# Holidays.load_all
|
||||
# == Other options
|
||||
# [<tt>:observed</tt>] Return holidays on the day they are observed (e.g. on a Monday if they fall on a Sunday).
|
||||
# [<tt>:informal</tt>] Include informal holidays (e.g. Valentine's Day)
|
||||
#
|
||||
# == Examples
|
||||
# Return all holidays in the <tt>:ca</tt> and <tt>:us</tt> regions on the day that they are
|
||||
# observed.
|
||||
#
|
||||
# Holidays.between(from, to, :ca, :us, :observed)
|
||||
#
|
||||
# Return all holidays in <tt>:ca</tt> and any <tt>:ca</tt> sub-region.
|
||||
#
|
||||
# Holidays.between(from, to, :ca_)
|
||||
#
|
||||
# Return all holidays in <tt>:ca_bc</tt> sub-region (which includes the <tt>:ca</tt>), including informal holidays.
|
||||
#
|
||||
# Holidays.between(from, to, :ca_bc, :informal)
|
||||
module Holidays
|
||||
# Exception thrown when an unknown region is requested.
|
||||
class UnknownRegionError < ArgumentError; end
|
||||
|
||||
VERSION = '1.0.4'
|
||||
|
||||
@@regions = []
|
||||
@@holidays_by_month = {}
|
||||
@@proc_cache = {}
|
||||
|
||||
WEEKS = {:first => 1, :second => 2, :third => 3, :fourth => 4, :fifth => 5, :last => -1, :second_last => -2, :third_last => -3}
|
||||
MONTH_LENGTHS = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
|
||||
DAY_SYMBOLS = Date::DAYNAMES.collect { |n| n.downcase.intern }
|
||||
DEFINITION_PATH = File.expand_path(File.dirname(__FILE__) + '/holidays/')
|
||||
|
||||
# Get all holidays on a given date.
|
||||
#
|
||||
# [<tt>date</tt>] A Date object.
|
||||
# [<tt>:options</tt>] One or more region symbols, <tt>:informal</tt> and/or <tt>:observed</tt>.
|
||||
#
|
||||
# Returns an array of hashes or nil. See Holidays#between for the output
|
||||
# format.
|
||||
#
|
||||
# Also available via Date#holidays.
|
||||
def self.on(date, *options)
|
||||
self.between(date, date, options)
|
||||
end
|
||||
|
||||
# Get all holidays occuring between two dates, inclusively.
|
||||
#
|
||||
# Returns an array of hashes or nil.
|
||||
#
|
||||
# Each holiday is returned as a hash with the following fields:
|
||||
# [<tt>start_date</tt>] Ruby Date object.
|
||||
# [<tt>end_date</tt>] Ruby Date object.
|
||||
# [<tt>options</tt>] One or more region symbols, <tt>:informal</tt> and/or <tt>:observed</tt>.
|
||||
#
|
||||
# ==== Example
|
||||
# from = Date.civil(2008,7,1)
|
||||
# to = Date.civil(2008,7,31)
|
||||
#
|
||||
# Holidays.between(from, to, :ca, :us)
|
||||
# => [{:name => 'Canada Day', :regions => [:ca]...}
|
||||
# {:name => 'Independence Day'', :regions => [:us], ...}]
|
||||
def self.between(start_date, end_date, *options)
|
||||
# remove the timezone
|
||||
start_date = start_date.new_offset(0) if start_date.respond_to?(:new_offset)
|
||||
end_date = end_date.new_offset(0) if end_date.respond_to?(:new_offset)
|
||||
|
||||
# get simple dates
|
||||
if start_date.respond_to?(:to_date)
|
||||
start_date = start_date.to_date
|
||||
else
|
||||
start_date = Date.civil(start_date.year, start_date.mon, start_date.mday)
|
||||
end
|
||||
|
||||
if end_date.respond_to?(:to_date)
|
||||
end_date = end_date.to_date
|
||||
else
|
||||
end_date = Date.civil(end_date.year, end_date.mon, end_date.mday)
|
||||
end
|
||||
|
||||
regions, observed, informal = parse_options(options)
|
||||
holidays = []
|
||||
|
||||
dates = {}
|
||||
(start_date..end_date).each do |date|
|
||||
# Always include month '0' for variable-month holidays
|
||||
dates[date.year] = [0] unless dates[date.year]
|
||||
# TODO: test this, maybe should push then flatten
|
||||
dates[date.year] << date.month unless dates[date.year].include?(date.month)
|
||||
end
|
||||
|
||||
dates.each do |year, months|
|
||||
months.each do |month|
|
||||
next unless hbm = @@holidays_by_month[month]
|
||||
|
||||
hbm.each do |h|
|
||||
next unless in_region?(regions, h[:regions])
|
||||
|
||||
# Skip informal holidays unless they have been requested
|
||||
next if h[:type] == :informal and not informal
|
||||
|
||||
if h[:function]
|
||||
# Holiday definition requires a calculation
|
||||
result = call_proc(h[:function], year)
|
||||
|
||||
# Procs may return either Date or an integer representing mday
|
||||
if result.kind_of?(Date)
|
||||
month = result.month
|
||||
mday = result.mday
|
||||
else
|
||||
mday = result
|
||||
end
|
||||
else
|
||||
# Calculate the mday
|
||||
mday = h[:mday] || Date.calculate_mday(year, month, h[:week], h[:wday])
|
||||
end
|
||||
|
||||
# Silently skip bad mdays
|
||||
begin
|
||||
date = Date.civil(year, month, mday)
|
||||
rescue; next; end
|
||||
|
||||
# If the :observed option is set, calculate the date when the holiday
|
||||
# is observed.
|
||||
if observed and h[:observed]
|
||||
date = call_proc(h[:observed], date)
|
||||
end
|
||||
|
||||
if date.between?(start_date, end_date)
|
||||
holidays << {:date => date, :name => h[:name], :regions => h[:regions]}
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
holidays.sort{|a, b| a[:date] <=> b[:date] }
|
||||
end
|
||||
|
||||
# Merge a new set of definitions into the Holidays module.
|
||||
#
|
||||
# This method is automatically called when including holiday definition
|
||||
# files.
|
||||
def self.merge_defs(regions, holidays) # :nodoc:
|
||||
@@regions = @@regions | regions
|
||||
@@regions.uniq!
|
||||
|
||||
holidays.each do |month, holiday_defs|
|
||||
@@holidays_by_month[month] = [] unless @@holidays_by_month[month]
|
||||
holiday_defs.each do |holiday_def|
|
||||
|
||||
exists = false
|
||||
@@holidays_by_month[month].each do |ex|
|
||||
# TODO: gross.
|
||||
if ex[:name] == holiday_def[:name] and ex[:wday] == holiday_def[:wday] and ex[:mday] == holiday_def[:mday] and ex[:week] == holiday_def[:week] and ex[:function_id] == holiday_def[:function_id] and ex[:type] == holiday_def[:type] and ex[:observed_id] == holiday_def[:observed_id]
|
||||
# append regions
|
||||
ex[:regions] << holiday_def[:regions]
|
||||
|
||||
# Should do this once we're done
|
||||
ex[:regions].flatten!
|
||||
ex[:regions].uniq!
|
||||
exists = true
|
||||
end
|
||||
end
|
||||
|
||||
@@holidays_by_month[month] << holiday_def unless exists
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Get the date of Easter Sunday in a given year. From Easter Sunday, it is
|
||||
# possible to calculate many traditional holidays in Western countries.
|
||||
# Returns a Date object.
|
||||
def self.easter(year)
|
||||
y = year
|
||||
a = y % 19
|
||||
b = y / 100
|
||||
c = y % 100
|
||||
d = b / 4
|
||||
e = b % 4
|
||||
f = (b + 8) / 25
|
||||
g = (b - f + 1) / 3
|
||||
h = (19 * a + b - d - g + 15) % 30
|
||||
i = c / 4
|
||||
k = c % 4
|
||||
l = (32 + 2 * e + 2 * i - h - k) % 7
|
||||
m = (a + 11 * h + 22 * l) / 451
|
||||
month = (h + l - 7 * m + 114) / 31
|
||||
day = ((h + l - 7 * m + 114) % 31) + 1
|
||||
Date.civil(year, month, day)
|
||||
end
|
||||
|
||||
# A method to calculate the orthodox easter date, returns date in the Gregorian (western) calendar
|
||||
# Safe until appr. 4100 AD, when one leap day will be removed.
|
||||
# Returns a Date object.
|
||||
def self.orthodox_easter(year)
|
||||
y = year
|
||||
g = y % 19
|
||||
i = (19 * g + 15) % 30
|
||||
j = (year + year/4 + i) % 7
|
||||
j_month = 3 + (i - j + 40) / 44
|
||||
j_day = i - j + 28 - 31 * (j_month / 4)
|
||||
j_date = Date.civil(year, j_month, j_day)
|
||||
case
|
||||
# up until 1582, julian and gregorian easter dates were identical
|
||||
when year <= 1582
|
||||
offset = 0
|
||||
# between the years 1583 and 1699 10 days are added to the julian day count
|
||||
when (year >= 1583 and year <= 1699)
|
||||
offset = 10
|
||||
# after 1700, 1 day is added for each century, except if the century year is exactly divisible by 400 (in which case no days are added).
|
||||
# Safe until 4100 AD, when one leap day will be removed.
|
||||
when year >= 1700
|
||||
offset = (year - 1700).divmod(100)[0] + ((year - year.divmod(100)[1]).divmod(400)[1] == 0 ? 0 : 1) - (year - year.divmod(100)[1] - 1700).divmod(400)[0] + 10
|
||||
end
|
||||
# add offset to the julian day
|
||||
return Date.jd(j_date.jd + offset)
|
||||
end
|
||||
|
||||
# Move date to Monday if it occurs on a Sunday.
|
||||
# Used as a callback function.
|
||||
def self.to_monday_if_sunday(date)
|
||||
date += 1 if date.wday == 0
|
||||
date
|
||||
end
|
||||
|
||||
# Move date to Monday if it occurs on a Saturday on Sunday.
|
||||
# Used as a callback function.
|
||||
def self.to_monday_if_weekend(date)
|
||||
date += 1 if date.wday == 0
|
||||
date += 2 if date.wday == 6
|
||||
date
|
||||
end
|
||||
|
||||
# Move Boxing Day if it falls on a weekend, leaving room for Christmas.
|
||||
# Used as a callback function.
|
||||
def self.to_weekday_if_boxing_weekend(date)
|
||||
date += 2 if date.wday == 6 or date.wday == 0
|
||||
date
|
||||
end
|
||||
|
||||
# Move date to Monday if it occurs on a Sunday or to Friday if it occurs on a
|
||||
# Saturday.
|
||||
# Used as a callback function.
|
||||
def self.to_weekday_if_weekend(date)
|
||||
date += 1 if date.wday == 0
|
||||
date -= 1 if date.wday == 6
|
||||
date
|
||||
end
|
||||
|
||||
# Returns an array of symbols all the available holiday definitions.
|
||||
#
|
||||
# Optional `full_path` param is used internally for loading all the definitions.
|
||||
def self.available(full_path = false)
|
||||
paths = Dir.glob(DEFINITION_PATH + '/*.rb')
|
||||
full_path ? paths : paths.collect { |path| path.match(/([a-z_-]+)\.rb/i)[1].to_sym }
|
||||
end
|
||||
|
||||
# Load all available holiday definitions
|
||||
def self.load_all
|
||||
self.available(true).each { |path| require path }
|
||||
end
|
||||
|
||||
private
|
||||
# Returns [(arr)regions, (bool)observed, (bool)informal]
|
||||
def self.parse_options(*options) # :nodoc:
|
||||
options.flatten!
|
||||
observed = options.delete(:observed) ? true : false
|
||||
informal = options.delete(:informal) ? true : false
|
||||
regions = parse_regions(options)
|
||||
return regions, observed, informal
|
||||
end
|
||||
|
||||
# Check regions against list of supported regions and return an array of
|
||||
# symbols.
|
||||
#
|
||||
# If a wildcard region is found (e.g. <tt>:ca_</tt>) it is expanded into all
|
||||
# of its available sub regions.
|
||||
def self.parse_regions(regions) # :nodoc:
|
||||
regions = [regions] unless regions.kind_of?(Array)
|
||||
return [:any] if regions.empty?
|
||||
|
||||
regions = regions.collect { |r| r.to_sym }
|
||||
|
||||
# Found sub region wild-card
|
||||
regions.delete_if do |reg|
|
||||
if reg.to_s =~ /_$/
|
||||
prefix = reg.to_s.split('_').first
|
||||
raise UnknownRegionError unless @@regions.include?(prefix.to_sym) or begin require "holidays/#{prefix}"; rescue LoadError; false; end
|
||||
regions << @@regions.select { |dr| dr.to_s =~ Regexp.new("^#{reg}") }
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
regions.flatten!
|
||||
|
||||
require "holidays/north_america" if regions.include?(:us) # special case for north_america/US cross-linking
|
||||
|
||||
raise UnknownRegionError unless regions.all? { |r| r == :any or @@regions.include?(r) or begin require "holidays/#{r.to_s}"; rescue LoadError; false; end }
|
||||
regions
|
||||
end
|
||||
|
||||
# Check sub regions.
|
||||
#
|
||||
# When request :any, all holidays should be returned.
|
||||
# When requesting :ca_bc, holidays in :ca or :ca_bc should be returned.
|
||||
# When requesting :ca, holidays in :ca but not its subregions should be returned.
|
||||
def self.in_region?(requested, available) # :nodoc:
|
||||
return true if requested.include?(:any)
|
||||
|
||||
# When an underscore is encountered, derive the parent regions
|
||||
# symbol and include both in the requested array.
|
||||
requested = requested.collect do |r|
|
||||
r.to_s =~ /_/ ? [r, r.to_s.gsub(/_[\w]*$/, '').to_sym] : r
|
||||
end
|
||||
|
||||
requested = requested.flatten.uniq
|
||||
|
||||
available.any? { |avail| requested.include?(avail) }
|
||||
end
|
||||
|
||||
# Call a proc function defined in a holiday definition file.
|
||||
#
|
||||
# Procs are cached.
|
||||
#
|
||||
# ==== Benchmarks
|
||||
#
|
||||
# Lookup Easter Sunday, with caching, by number of iterations:
|
||||
#
|
||||
# user system total real
|
||||
# 0001 0.000000 0.000000 0.000000 ( 0.000000)
|
||||
# 0010 0.000000 0.000000 0.000000 ( 0.000000)
|
||||
# 0100 0.078000 0.000000 0.078000 ( 0.078000)
|
||||
# 1000 0.641000 0.000000 0.641000 ( 0.641000)
|
||||
# 5000 3.172000 0.015000 3.187000 ( 3.219000)
|
||||
#
|
||||
# Lookup Easter Sunday, without caching, by number of iterations:
|
||||
#
|
||||
# user system total real
|
||||
# 0001 0.000000 0.000000 0.000000 ( 0.000000)
|
||||
# 0010 0.016000 0.000000 0.016000 ( 0.016000)
|
||||
# 0100 0.125000 0.000000 0.125000 ( 0.125000)
|
||||
# 1000 1.234000 0.000000 1.234000 ( 1.234000)
|
||||
# 5000 6.094000 0.031000 6.125000 ( 6.141000)
|
||||
def self.call_proc(function, year) # :nodoc:
|
||||
proc_key = Digest::MD5.hexdigest("#{function.to_s}_#{year.to_s}")
|
||||
@@proc_cache[proc_key] = function.call(year) unless @@proc_cache[proc_key]
|
||||
@@proc_cache[proc_key]
|
||||
end
|
||||
end
|
||||
|
||||
# === Extending Ruby's Date class with the Holidays gem
|
||||
# The Holidays gem automatically extends Ruby's Date class and gives you access
|
||||
# to three new methods: holiday?, #holidays and #calculate_mday.
|
||||
#
|
||||
# ==== Examples
|
||||
# Lookup Canada Day in the <tt>:ca</tt> region
|
||||
# Date.civil(2008,7,1).holiday?(:ca)
|
||||
# => true
|
||||
#
|
||||
# Lookup Canada Day in the <tt>:fr</tt> region
|
||||
# Date.civil(2008,7,1).holiday?(:fr)
|
||||
# => false
|
||||
#
|
||||
# Lookup holidays on North America in January 1.
|
||||
# Date.civil(2008,1,1).holidays(:ca, :mx, :us, :informal, :observed)
|
||||
# => [{:name => 'New Year\'s Day'...}]
|
||||
class Date
|
||||
include Holidays
|
||||
|
||||
# Get holidays on the current date.
|
||||
#
|
||||
# Returns an array of hashes or nil. See Holidays#between for options
|
||||
# and the output format.
|
||||
#
|
||||
# Date.civil('2008-01-01').holidays(:ca_)
|
||||
# => [{:name => 'New Year\'s Day',...}]
|
||||
#
|
||||
# Also available via Holidays#on.
|
||||
def holidays(*options)
|
||||
Holidays.on(self, options)
|
||||
end
|
||||
|
||||
# Check if the current date is a holiday.
|
||||
#
|
||||
# Returns true or false.
|
||||
#
|
||||
# Date.civil('2008-01-01').holiday?(:ca)
|
||||
# => true
|
||||
def holiday?(*options)
|
||||
holidays = self.holidays(options)
|
||||
holidays && !holidays.empty?
|
||||
end
|
||||
|
||||
# Calculate day of the month based on the week number and the day of the
|
||||
# week.
|
||||
#
|
||||
# ==== Parameters
|
||||
# [<tt>year</tt>] Integer.
|
||||
# [<tt>month</tt>] Integer from 1-12.
|
||||
# [<tt>week</tt>] One of <tt>:first</tt>, <tt>:second</tt>, <tt>:third</tt>,
|
||||
# <tt>:fourth</tt>, <tt>:fifth</tt> or <tt>:last</tt>.
|
||||
# [<tt>wday</tt>] Day of the week as an integer from 0 (Sunday) to 6
|
||||
# (Saturday) or as a symbol (e.g. <tt>:monday</tt>).
|
||||
#
|
||||
# Returns an integer.
|
||||
#
|
||||
# ===== Examples
|
||||
# First Monday of January, 2008:
|
||||
# Date.calculate_mday(2008, 1, :first, :monday)
|
||||
# => 7
|
||||
#
|
||||
# Third Thursday of December, 2008:
|
||||
# Date.calculate_mday(2008, 12, :third, :thursday)
|
||||
# => 18
|
||||
#
|
||||
# Last Monday of January, 2008:
|
||||
# Date.calculate_mday(2008, 1, :last, 1)
|
||||
# => 28
|
||||
#--
|
||||
# see http://www.irt.org/articles/js050/index.htm
|
||||
def self.calculate_mday(year, month, week, wday)
|
||||
raise ArgumentError, "Week parameter must be one of Holidays::WEEKS (provided #{week})." unless WEEKS.include?(week) or WEEKS.has_value?(week)
|
||||
|
||||
unless wday.kind_of?(Numeric) and wday.between?(0,6) or DAY_SYMBOLS.index(wday)
|
||||
raise ArgumentError, "Wday parameter must be an integer between 0 and 6 or one of Date::DAY_SYMBOLS."
|
||||
end
|
||||
|
||||
week = WEEKS[week] if week.kind_of?(Symbol)
|
||||
wday = DAY_SYMBOLS.index(wday) if wday.kind_of?(Symbol)
|
||||
|
||||
# :first, :second, :third, :fourth or :fifth
|
||||
if week > 0
|
||||
return ((week - 1) * 7) + 1 + ((wday - Date.civil(year, month,(week-1)*7 + 1).wday) % 7)
|
||||
end
|
||||
|
||||
days = MONTH_LENGTHS[month-1]
|
||||
|
||||
days = 29 if month == 2 and Date.leap?(year)
|
||||
|
||||
return days - ((Date.civil(year, month, days).wday - wday + 7) % 7) - (7 * (week.abs - 1))
|
||||
end
|
||||
end
|
|
@ -1,23 +1,34 @@
|
|||
==== Regional definitions
|
||||
The following definition files are included in this installation:
|
||||
|
||||
* holidays/au
|
||||
* holidays/ca
|
||||
* holidays/de
|
||||
* holidays/dk
|
||||
* holidays/es
|
||||
* holidays/europe
|
||||
* holidays/fr
|
||||
* holidays/gb
|
||||
* holidays/ie
|
||||
* holidays/is
|
||||
* holidays/it
|
||||
* holidays/mx
|
||||
* holidays/nl
|
||||
* holidays/north_america
|
||||
* holidays/pt
|
||||
* holidays/scandinavia
|
||||
* holidays/se
|
||||
* holidays/united_nations
|
||||
* holidays/us
|
||||
* holidays/za
|
||||
==== Regional definitions
|
||||
The following definition files are included in this installation:
|
||||
|
||||
* holidays/mx
|
||||
* holidays/at
|
||||
* holidays/nz
|
||||
* holidays/nl
|
||||
* holidays/dk
|
||||
* holidays/cz
|
||||
* holidays/scandinavia
|
||||
* holidays/no
|
||||
* holidays/pt
|
||||
* holidays/nyse
|
||||
* holidays/it
|
||||
* holidays/united_nations
|
||||
* holidays/au
|
||||
* holidays/us
|
||||
* holidays/ie
|
||||
* holidays/za
|
||||
* holidays/is
|
||||
* holidays/north_america
|
||||
* holidays/es
|
||||
* holidays/fi
|
||||
* holidays/el
|
||||
* holidays/europe
|
||||
* holidays/de
|
||||
* holidays/gb
|
||||
* holidays/ups
|
||||
* holidays/jp
|
||||
* holidays/fr
|
||||
* holidays/se
|
||||
* holidays/ca
|
||||
* holidays/br
|
||||
* holidays/pl
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/at.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/at'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module AT # :nodoc:
|
||||
def self.defined_regions
|
||||
[:at]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
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]}],
|
||||
1 => [{:mday => 1, :name => "Neujahrstag", :regions => [:at]},
|
||||
{:mday => 6, :name => "Heilige Drei Könige", :regions => [:at]}],
|
||||
5 => [{:mday => 1, :name => "Staatsfeiertag", :regions => [:at]}],
|
||||
8 => [{:mday => 15, :name => "Mariä Himmelfahrt", :regions => [:at]}],
|
||||
10 => [{:mday => 26, :name => "Nationalfeiertag", :regions => [:at]}],
|
||||
11 => [{:mday => 1, :name => "Allerheiligen", :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]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::AT.defined_regions, Holidays::AT.holidays_by_month)
|
|
@ -1,41 +1,47 @@
|
|||
module Holidays
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/au.yaml
|
||||
#
|
||||
# To use the definitions in this file, load them right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/au'
|
||||
#
|
||||
# More definitions are available at http://code.dunae.ca/holidays.
|
||||
module AU # :nodoc:
|
||||
DEFINED_REGIONS = [:au_qld, :au_nt, :au, :au_tas, :au_wa, :au_act, :au_nsw, :au_sa, :au_vic]
|
||||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_qld]},
|
||||
{:wday => 1, :week => 1, :name => "May Day", :regions => [:au_nt]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:au]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-1 }, :function_id => "easter(year)-1", :name => "Easter Saturday", :regions => [:au]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Easter Monday", :regions => [:au]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+2 }, :function_id => "easter(year)+2", :name => "Easter Monday", :regions => [:au_tas]}],
|
||||
6 => [{:wday => 1, :week => 1, :name => "Foundation Day", :regions => [:au_wa]},
|
||||
{:wday => 1, :week => 2, :name => "Queen's Birthday", :regions => [:au_act, :au_nsw, :au_sa, :au_tas, :au_nt, :au_qld, :au_vic]},
|
||||
{:mday => 6, :type => :informal, :name => "Queensland Day", :regions => [:au_qld]}],
|
||||
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:au]},
|
||||
{:mday => 26, :name => "Australia Day", :regions => [:au]}],
|
||||
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:au]},
|
||||
{:mday => 26, :name => "Boxing Day", :regions => [:au]}],
|
||||
3 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_wa]},
|
||||
{:wday => 1, :week => 2, :name => "Eight Hours Day", :regions => [:au_tas]},
|
||||
{:wday => 1, :week => 2, :name => "Labour Day", :regions => [:au_vic]}],
|
||||
4 => [{:mday => 25, :name => "ANZAC Day", :regions => [:au]}],
|
||||
10 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_act, :au_nsw, :au_sa]}]
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::AU::DEFINED_REGIONS, Holidays::AU::HOLIDAYS_BY_MONTH)
|
||||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/au.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/au'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module AU # :nodoc:
|
||||
def self.defined_regions
|
||||
[:au, :au_tas, :au_wa, :au_vic, :au_qld, :au_nt, :au_act, :au_nsw, :au_sa, :au_qld_brisbane]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:au]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-1 }, :function_id => "easter(year)-1", :name => "Easter Saturday", :regions => [:au]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Easter Monday", :regions => [:au]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+2 }, :function_id => "easter(year)+2", :name => "Easter Monday", :regions => [:au_tas]}],
|
||||
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:au]},
|
||||
{:mday => 26, :name => "Australia Day", :regions => [:au]}],
|
||||
3 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_wa]},
|
||||
{:wday => 1, :week => 2, :name => "Eight Hours Day", :regions => [:au_tas]},
|
||||
{:wday => 1, :week => 2, :name => "Labour Day", :regions => [:au_vic]}],
|
||||
4 => [{:mday => 25, :name => "ANZAC Day", :regions => [:au]}],
|
||||
5 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_qld]},
|
||||
{:wday => 1, :week => 1, :name => "May Day", :regions => [:au_nt]}],
|
||||
6 => [{:wday => 1, :week => 1, :name => "Foundation Day", :regions => [:au_wa]},
|
||||
{:wday => 1, :week => 2, :name => "Queen's Birthday", :regions => [:au_act, :au_nsw, :au_sa, :au_tas, :au_nt, :au_qld, :au_vic]},
|
||||
{:mday => 6, :type => :informal, :name => "Queensland Day", :regions => [:au_qld]}],
|
||||
8 => [{:wday => 3, :week => -3, :name => "Ekka", :regions => [:au_qld_brisbane]}],
|
||||
10 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_act, :au_nsw, :au_sa]}],
|
||||
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:au]},
|
||||
{:mday => 26, :name => "Boxing Day", :regions => [:au]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::AU.defined_regions, Holidays::AU.holidays_by_month)
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/br.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/br'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module BR # :nodoc:
|
||||
def self.defined_regions
|
||||
[:br]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :type => :informal, :name => "Carnaval", :regions => [:br]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Sexta-feira Santa", :regions => [:br]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Páscoa", :regions => [:br]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+60 }, :function_id => "easter(year)+60", :name => "Corpus Christ", :regions => [:br]}],
|
||||
1 => [{:mday => 1, :name => "Dia da Confraternização Universal", :regions => [:br]}],
|
||||
4 => [{:mday => 21, :name => "Dia de Tiradentes", :regions => [:br]}],
|
||||
5 => [{:mday => 1, :name => "Dia do Trabalho", :regions => [:br]}],
|
||||
9 => [{:mday => 7, :name => "Proclamação da Independência", :regions => [:br]}],
|
||||
10 => [{:mday => 12, :name => "Dia de Nossa Senhora Aparecida", :regions => [:br]}],
|
||||
11 => [{:mday => 2, :name => "Dia de Finados", :regions => [:br]},
|
||||
{:mday => 15, :name => "Proclamação da República", :regions => [:br]}],
|
||||
12 => [{:mday => 25, :name => "Natal", :regions => [:br]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::BR.defined_regions, Holidays::BR.holidays_by_month)
|
|
@ -1,68 +1,73 @@
|
|||
module Holidays
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/ca.yaml, data/north_america_informal.yaml
|
||||
#
|
||||
# To use the definitions in this file, load them right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/ca'
|
||||
#
|
||||
# More definitions are available at http://code.dunae.ca/holidays.
|
||||
module CA # :nodoc:
|
||||
DEFINED_REGIONS = [:ca, :ca_qc, :ca_nf, :ca_nt, :ca_nu, :ca_ab, :ca_on, :ca_sk, :ca_mb, :ca_bc, :ca_ns, :ca_yk, :us]
|
||||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:function => lambda { |year| Holidays.ca_victoria_day(year) }, :function_id => "ca_victoria_day(year)", :name => "Victoria Day", :regions => [:ca]},
|
||||
{:function => lambda { |year| Holidays.ca_victoria_day(year) }, :function_id => "ca_victoria_day(year)", :name => "National Patriotes Day", :regions => [:ca_qc]},
|
||||
{:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:ca]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :type => :informal, :name => "Easter Monday", :regions => [:ca]}],
|
||||
11 => [{:mday => 11, :name => "Rememberance Day", :regions => [:ca]}],
|
||||
6 => [{:mday => 24, :name => "Discovery Day", :regions => [:ca_nf]},
|
||||
{:mday => 24, :name => "Fête Nationale", :regions => [:ca_qc]},
|
||||
{:mday => 21, :name => "National Aboriginal Day", :regions => [:ca_nt]}],
|
||||
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:ca]},
|
||||
{:mday => 2, :name => "New Year's", :regions => [:ca_qc]}],
|
||||
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:ca]},
|
||||
{:mday => 26, :name => "Boxing Day", :regions => [:ca]}],
|
||||
7 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Canada Day", :regions => [:ca]},
|
||||
{:mday => 12, :name => "Orangemen's Day", :regions => [:ca_nf]},
|
||||
{:mday => 9, :name => "Nunavut Day", :regions => [:ca_nu]}],
|
||||
2 => [{:wday => 1, :week => 3, :name => "Family Day", :regions => [:ca_ab, :ca_on, :ca_sk]},
|
||||
{:wday => 1, :week => 3, :name => "Louis Riel Day", :regions => [:ca_mb]},
|
||||
{:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
|
||||
{:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
|
||||
8 => [{:wday => 1, :week => 1, :name => "BC Day", :regions => [:ca_bc]},
|
||||
{:wday => 1, :week => 1, :name => "Saskatchewan Day", :regions => [:ca_sk]},
|
||||
{:wday => 1, :week => 1, :name => "Heritage Day", :regions => [:ca_ab]},
|
||||
{:wday => 1, :week => 1, :name => "Natal Day", :regions => [:ca_ns]},
|
||||
{:wday => 1, :week => 1, :name => "Civic Holiday", :regions => [:ca_on]},
|
||||
{:wday => 1, :week => 3, :name => "Discovery Day", :regions => [:ca_yk]}],
|
||||
3 => [{:mday => 23, :name => "St. George's Day", :regions => [:ca_nf]},
|
||||
{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
|
||||
9 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:ca]}],
|
||||
4 => [{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
|
||||
{:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}],
|
||||
10 => [{:wday => 1, :week => 2, :name => "Thanksgiving", :regions => [:ca]},
|
||||
{:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}]
|
||||
}
|
||||
end
|
||||
|
||||
# Monday on or before May 24
|
||||
def self.ca_victoria_day(year)
|
||||
date = Date.civil(year,5,24)
|
||||
if date.wday > 1
|
||||
date -= (date.wday - 1)
|
||||
elsif date.wday == 0
|
||||
date -= 6
|
||||
end
|
||||
date
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::CA::DEFINED_REGIONS, Holidays::CA::HOLIDAYS_BY_MONTH)
|
||||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/ca.yaml, data/north_america_informal.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/ca'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module CA # :nodoc:
|
||||
def self.defined_regions
|
||||
[:ca, :ca_qc, :ca_ab, :ca_on, :ca_sk, :ca_mb, :ca_nf, :ca_nt, :ca_nu, :ca_bc, :ca_ns, :ca_yk, :us]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:ca]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :type => :informal, :name => "Easter Monday", :regions => [:ca]}],
|
||||
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:ca]},
|
||||
{:mday => 2, :name => "New Year's", :regions => [:ca_qc]}],
|
||||
2 => [{:wday => 1, :week => 3, :name => "Family Day", :regions => [:ca_ab, :ca_on, :ca_sk]},
|
||||
{:wday => 1, :week => 3, :name => "Louis Riel Day", :regions => [:ca_mb]},
|
||||
{:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
|
||||
{:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
|
||||
3 => [{:mday => 23, :name => "St. George's Day", :regions => [:ca_nf]},
|
||||
{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
|
||||
5 => [{:function => lambda { |year| Holidays.ca_victoria_day(year) }, :function_id => "ca_victoria_day(year)", :name => "Victoria Day", :regions => [:ca]},
|
||||
{:function => lambda { |year| Holidays.ca_victoria_day(year) }, :function_id => "ca_victoria_day(year)", :name => "National Patriotes Day", :regions => [:ca_qc]},
|
||||
{:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
|
||||
6 => [{:mday => 24, :name => "Discovery Day", :regions => [:ca_nf]},
|
||||
{:mday => 24, :name => "Fête Nationale", :regions => [:ca_qc]},
|
||||
{:mday => 21, :name => "National Aboriginal Day", :regions => [:ca_nt]}],
|
||||
7 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Canada Day", :regions => [:ca]},
|
||||
{:mday => 12, :name => "Orangemen's Day", :regions => [:ca_nf]},
|
||||
{:mday => 9, :name => "Nunavut Day", :regions => [:ca_nu]}],
|
||||
8 => [{:wday => 1, :week => 1, :name => "BC Day", :regions => [:ca_bc]},
|
||||
{:wday => 1, :week => 1, :name => "Saskatchewan Day", :regions => [:ca_sk]},
|
||||
{:wday => 1, :week => 1, :name => "Heritage Day", :regions => [:ca_ab]},
|
||||
{:wday => 1, :week => 1, :name => "Natal Day", :regions => [:ca_ns]},
|
||||
{:wday => 1, :week => 1, :name => "Civic Holiday", :regions => [:ca_on]},
|
||||
{:wday => 1, :week => 3, :name => "Discovery Day", :regions => [:ca_yk]}],
|
||||
9 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:ca]}],
|
||||
10 => [{:wday => 1, :week => 2, :name => "Thanksgiving", :regions => [:ca]},
|
||||
{:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}],
|
||||
11 => [{:mday => 11, :name => "Remembrance Day", :regions => [:ca]}],
|
||||
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:ca]},
|
||||
{:mday => 26, :name => "Boxing Day", :regions => [:ca]}],
|
||||
4 => [{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
|
||||
{:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
# Monday on or before May 24
|
||||
def self.ca_victoria_day(year)
|
||||
date = Date.civil(year,5,24)
|
||||
if date.wday > 1
|
||||
date -= (date.wday - 1)
|
||||
elsif date.wday == 0
|
||||
date -= 6
|
||||
end
|
||||
date
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::CA.defined_regions, Holidays::CA.holidays_by_month)
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/cz.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/cz'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module CZ # :nodoc:
|
||||
def self.defined_regions
|
||||
[:cz]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Velikonoční pondělí", :regions => [:cz]}],
|
||||
1 => [{:mday => 1, :name => "Den obnovy samostatného českého státu", :regions => [:cz]}],
|
||||
5 => [{:mday => 1, :name => "Svátek práce", :regions => [:cz]},
|
||||
{:mday => 8, :name => "Den vítězství", :regions => [:cz]}],
|
||||
7 => [{:mday => 5, :name => "Den slovanských věrozvěstů Cyrila a Metoděje", :regions => [:cz]},
|
||||
{:mday => 6, :name => "Den upálení mistra Jana Husa", :regions => [:cz]}],
|
||||
9 => [{:mday => 28, :name => "Den české státnosti", :regions => [:cz]}],
|
||||
10 => [{:mday => 28, :name => "Den vzniku samostatného československého státu", :regions => [:cz]}],
|
||||
11 => [{:mday => 17, :name => "Den boje za svobodu a demokracii", :regions => [:cz]}],
|
||||
12 => [{:mday => 24, :name => "Štědrý den", :regions => [:cz]},
|
||||
{:mday => 25, :name => "1. svátek vánoční", :regions => [:cz]},
|
||||
{:mday => 26, :name => "2. svátek vánoční", :regions => [:cz]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::CZ.defined_regions, Holidays::CZ.holidays_by_month)
|
|
@ -1,52 +1,55 @@
|
|||
module Holidays
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/de.yaml
|
||||
#
|
||||
# To use the definitions in this file, load them right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/de'
|
||||
#
|
||||
# More definitions are available at http://code.dunae.ca/holidays.
|
||||
module DE # :nodoc:
|
||||
DEFINED_REGIONS = [:de, :de_bw, :de_by, :de_nw, :de_rp, :de_sl, :de_sn, :de_he, :de_th, :de_bb, :de_mv, :de_st]
|
||||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:mday => 1, :name => "Tag der Arbeit", :regions => [:de]},
|
||||
{:mday => 8, :name => "Victoire 1945", :regions => [:de]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Karfreitag", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :type => :informal, :name => "Ostern", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Ostermontag", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Christi Himmelfahrt", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pfingstmontag", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+60 }, :function_id => "easter(year)+60", :name => "Fronleichnam", :regions => [:de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_sn, :de_th]}],
|
||||
11 => [{:mday => 1, :name => "Allerheiligen", :regions => [:de_bw, :de_by, :de_nw, :de_rp, :de_sl]},
|
||||
{:function => lambda { |year| Holidays.de_buss_und_bettag(year) }, :function_id => "de_buss_und_bettag(year)", :name => "Buß- und Bettag", :regions => [:de_by, :de_sn]}],
|
||||
1 => [{:mday => 1, :name => "Neujahrstag", :regions => [:de]},
|
||||
{:mday => 6, :name => "Heilige Drei Könige", :regions => [:de_bw, :de_by]}],
|
||||
12 => [{:mday => 25, :name => "1. Weihnachtstag", :regions => [:de]},
|
||||
{:mday => 26, :name => "2. Weihnachtstag", :regions => [:de]}],
|
||||
8 => [{:mday => 15, :name => "Mariä Himmelfahrt", :regions => [:de_by, :de_sl]}],
|
||||
10 => [{:mday => 3, :name => "Tag der Deutschen Einheit", :regions => [:de]},
|
||||
{:mday => 31, :name => "Reformationstag", :regions => [:de_bb, :de_mv, :de_sn, :de_st, :de_th]}]
|
||||
}
|
||||
end
|
||||
|
||||
# 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
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::DE::DEFINED_REGIONS, Holidays::DE::HOLIDAYS_BY_MONTH)
|
||||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/de.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/de'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module DE # :nodoc:
|
||||
def self.defined_regions
|
||||
[:de, :de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_st, :de_bb, :de_mv, :de_sn, :de_th]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Karfreitag", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Ostermontag", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Christi Himmelfahrt", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pfingstmontag", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+60 }, :function_id => "easter(year)+60", :name => "Fronleichnam", :regions => [:de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl]}],
|
||||
1 => [{:mday => 1, :name => "Neujahrstag", :regions => [:de]},
|
||||
{:mday => 6, :name => "Heilige Drei Könige", :regions => [:de_bw, :de_by, :de_st]}],
|
||||
5 => [{:mday => 1, :name => "Tag der Arbeit", :regions => [:de]}],
|
||||
8 => [{:mday => 15, :name => "Mariä Himmelfahrt", :regions => [:de_by, :de_sl]}],
|
||||
10 => [{:mday => 3, :name => "Tag der Deutschen Einheit", :regions => [:de]},
|
||||
{:mday => 31, :name => "Reformationstag", :regions => [:de_bb, :de_mv, :de_sn, :de_st, :de_th]}],
|
||||
11 => [{:mday => 1, :name => "Allerheiligen", :regions => [:de_bw, :de_by, :de_nw, :de_rp, :de_sl]},
|
||||
{:function => lambda { |year| Holidays.de_buss_und_bettag(year) }, :function_id => "de_buss_und_bettag(year)", :name => "Buß- und Bettag", :regions => [:de_sn]}],
|
||||
12 => [{:mday => 25, :name => "1. Weihnachtstag", :regions => [:de]},
|
||||
{:mday => 26, :name => "2. Weihnachtstag", :regions => [:de]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
# 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
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::DE.defined_regions, Holidays::DE.holidays_by_month)
|
||||
|
|
|
@ -1,47 +1,52 @@
|
|||
module Holidays
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/dk.yaml
|
||||
#
|
||||
# To use the definitions in this file, load them right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/dk'
|
||||
#
|
||||
# More definitions are available at http://code.dunae.ca/holidays.
|
||||
module DK # :nodoc:
|
||||
DEFINED_REGIONS = [:dk]
|
||||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:mday => 1, :name => "Arbejdernes kampdag", :regions => [:dk]},
|
||||
{:mday => 5, :type => :informal, :name => "Danmarks befrielse", :regions => [:dk]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-49 }, :function_id => "easter(year)-49", :type => :informal, :name => "Fastelavn", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Palmesøndag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skærtorsdag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Langfredag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Påskedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "2. påskedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+26 }, :function_id => "easter(year)+26", :name => "Store Bededag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi Himmelfartsdag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pinsedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "2. Pinsedag", :regions => [:dk]}],
|
||||
11 => [{:mday => 10, :type => :informal, :name => "Mortensaften", :regions => [:dk]}],
|
||||
6 => [{:mday => 5, :name => "Grundlovsdag", :regions => [:dk]},
|
||||
{:mday => 15, :type => :informal, :name => "Valdemarsdag og Genforeningsdag", :regions => [:dk]},
|
||||
{:mday => 23, :type => :informal, :name => "Sankt Hans aften", :regions => [:dk]}],
|
||||
1 => [{:mday => 1, :name => "Nytårsdag", :regions => [:dk]}],
|
||||
12 => [{:mday => 13, :type => :informal, :name => "Sankt Lucia", :regions => [:dk]},
|
||||
{:mday => 24, :name => "Juleaftensdag", :regions => [:dk]},
|
||||
{:mday => 25, :name => "1. juledag", :regions => [:dk]},
|
||||
{:mday => 26, :name => "2. juledag", :regions => [:dk]}],
|
||||
4 => [{:mday => 1, :type => :informal, :name => "1. april", :regions => [:dk]},
|
||||
{:mday => 9, :type => :informal, :name => "Danmarks besættelse", :regions => [:dk]},
|
||||
{:mday => 16, :type => :informal, :name => "Dronningens fødselsdag", :regions => [:dk]}]
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::DK::DEFINED_REGIONS, Holidays::DK::HOLIDAYS_BY_MONTH)
|
||||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/dk.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/dk'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module DK # :nodoc:
|
||||
def self.defined_regions
|
||||
[:dk]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-49 }, :function_id => "easter(year)-49", :type => :informal, :name => "Fastelavn", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Palmesøndag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skærtorsdag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Langfredag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Påskedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "2. påskedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+26 }, :function_id => "easter(year)+26", :name => "Store Bededag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi Himmelfartsdag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pinsedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "2. Pinsedag", :regions => [:dk]}],
|
||||
1 => [{:mday => 1, :name => "Nytårsdag", :regions => [:dk]}],
|
||||
4 => [{:mday => 1, :type => :informal, :name => "1. april", :regions => [:dk]},
|
||||
{:mday => 9, :type => :informal, :name => "Danmarks besættelse", :regions => [:dk]},
|
||||
{:mday => 16, :type => :informal, :name => "Dronningens fødselsdag", :regions => [:dk]}],
|
||||
5 => [{:mday => 1, :name => "Arbejdernes kampdag", :regions => [:dk]},
|
||||
{:mday => 5, :type => :informal, :name => "Danmarks befrielse", :regions => [:dk]}],
|
||||
6 => [{:mday => 5, :name => "Grundlovsdag", :regions => [:dk]},
|
||||
{:mday => 15, :type => :informal, :name => "Valdemarsdag og Genforeningsdag", :regions => [:dk]},
|
||||
{:mday => 23, :type => :informal, :name => "Sankt Hans aften", :regions => [:dk]}],
|
||||
11 => [{:mday => 10, :type => :informal, :name => "Mortensaften", :regions => [:dk]}],
|
||||
12 => [{:mday => 13, :type => :informal, :name => "Sankt Lucia", :regions => [:dk]},
|
||||
{:mday => 24, :name => "Juleaftensdag", :regions => [:dk]},
|
||||
{:mday => 25, :name => "1. juledag", :regions => [:dk]},
|
||||
{:mday => 26, :name => "2. juledag", :regions => [:dk]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::DK.defined_regions, Holidays::DK.holidays_by_month)
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/el.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/el'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module EL # :nodoc:
|
||||
def self.defined_regions
|
||||
[:el]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
0 => [{:function => lambda { |year| Holidays.orthodox_easter(year)-2 }, :function_id => "orthodox_easter(year)-2", :name => "Μεγάλη Παρασκευή", :regions => [:el]},
|
||||
{:function => lambda { |year| Holidays.orthodox_easter(year)-1 }, :function_id => "orthodox_easter(year)-1", :name => "Μεγάλο Σάββατο", :regions => [:el]},
|
||||
{:function => lambda { |year| Holidays.orthodox_easter(year) }, :function_id => "orthodox_easter(year)", :name => "Κυριακή του Πάσχα", :regions => [:el]},
|
||||
{:function => lambda { |year| Holidays.orthodox_easter(year)+1 }, :function_id => "orthodox_easter(year)+1", :name => "Δευτέρα του Πάσχα", :regions => [:el]},
|
||||
{:function => lambda { |year| Holidays.orthodox_easter(year)-48 }, :function_id => "orthodox_easter(year)-48", :name => "Καθαρά Δευτέρα", :regions => [:el]},
|
||||
{:function => lambda { |year| Holidays.orthodox_easter(year)+50 }, :function_id => "orthodox_easter(year)+50", :name => "Αγίου Πνεύματος", :regions => [:el]}],
|
||||
1 => [{:mday => 1, :name => "Πρωτοχρονιά", :regions => [:el]},
|
||||
{:mday => 6, :name => "Θεοφάνεια", :regions => [:el]}],
|
||||
3 => [{:mday => 25, :name => "Επέτειος της Επανάστασης του 1821", :regions => [:el]}],
|
||||
5 => [{:mday => 1, :name => "Πρωτομαγιά", :regions => [:el]}],
|
||||
8 => [{:mday => 15, :name => "Κοίμηση της Θεοτόκου", :regions => [:el]}],
|
||||
10 => [{:mday => 28, :name => "Επέτειος του Όχι", :regions => [:el]}],
|
||||
12 => [{:mday => 25, :name => "Χριστούγεννα", :regions => [:el]},
|
||||
{:mday => 26, :name => "Δεύτερη ημέρα των Χριστουγέννων", :regions => [:el]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::EL.defined_regions, Holidays::EL.holidays_by_month)
|
|
@ -1,52 +1,57 @@
|
|||
module Holidays
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/es.yaml
|
||||
#
|
||||
# To use the definitions in this file, load them right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/es'
|
||||
#
|
||||
# More definitions are available at http://code.dunae.ca/holidays.
|
||||
module ES # :nodoc:
|
||||
DEFINED_REGIONS = [:es, :es_m, :es_cn, :es_cm, :es_pv, :es_ct, :es_na, :es_v, :es_vc, :es_mu, :es_lo, :es_ib, :es_ga, :es_an, :es_ce, :es_o, :es_ex, :es_ar, :es_cl]
|
||||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:mday => 1, :name => "Día del Trabajador", :regions => [:es]},
|
||||
{:mday => 2, :name => "Fiesta de la Comunidad", :regions => [:es_m]},
|
||||
{:mday => 30, :name => "Día de las Canarias", :regions => [:es_cn]},
|
||||
{:mday => 31, :name => "Día de la Región Castilla-La Mancha", :regions => [:es_cm]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Jueves Santo", :regions => [:es_pv, :es_ct, :es_na, :es_v, :es_vc]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Viernes Santo", :regions => [:es]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Lunes de Pascua", :regions => [:es_pv, :es_ct, :es_na, :es_v, :es_vc]}],
|
||||
11 => [{:mday => 1, :name => "Todos los Santos", :regions => [:es]}],
|
||||
6 => [{:mday => 9, :name => "Día de la Región de Murcia", :regions => [:es_mu]},
|
||||
{:mday => 9, :name => "Día de La Rioja", :regions => [:es_lo]}],
|
||||
1 => [{:mday => 1, :name => "Año Nuevo", :regions => [:es]},
|
||||
{:mday => 6, :name => "Día de Reyes", :regions => [:es]}],
|
||||
12 => [{:mday => 6, :name => "Día de la Constitución", :regions => [:es]},
|
||||
{:mday => 8, :name => "Inmaculada Concepción", :regions => [:es]},
|
||||
{:mday => 25, :name => "Navidad del Señor", :regions => [:es]},
|
||||
{:mday => 26, :name => "San Esteban", :regions => [:es_ib, :es_ct]}],
|
||||
7 => [{:mday => 23, :name => "Santiago Apostol", :regions => [:es_ga]}],
|
||||
2 => [{:mday => 28, :name => "Día de Andalucía", :regions => [:es_an]}],
|
||||
8 => [{:mday => 15, :name => "Asunción", :regions => [:es]}],
|
||||
3 => [{:mday => 1, :name => "Día de las Islas Baleares", :regions => [:es_ib]},
|
||||
{:mday => 19, :name => "San José", :regions => [:es_v, :es_vc, :es_cm, :es_mu, :es_m]}],
|
||||
9 => [{:mday => 2, :name => "Día de Ceuta", :regions => [:es_ce]},
|
||||
{:mday => 8, :name => "Día de Asturias", :regions => [:es_o]},
|
||||
{:mday => 8, :name => "Día de Extremadura", :regions => [:es_ex]},
|
||||
{:mday => 11, :name => "Fiesta Nacional de Cataluña", :regions => [:es_ct]}],
|
||||
4 => [{:mday => 23, :name => "San Jorge", :regions => [:es_ar, :es_cl]},
|
||||
{:mday => 23, :name => "Día de Aragón", :regions => [:es_ar]}],
|
||||
10 => [{:mday => 9, :name => "Día de Valencia", :regions => [:es_vc, :es_v]},
|
||||
{:mday => 12, :name => "Día de la Hispanidad", :regions => [:es]}]
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::ES::DEFINED_REGIONS, Holidays::ES::HOLIDAYS_BY_MONTH)
|
||||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/es.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/es'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module ES # :nodoc:
|
||||
def self.defined_regions
|
||||
[:es_pv, :es_ct, :es_na, :es_v, :es_vc, :es, :es_an, :es_ib, :es_cm, :es_mu, :es_m, :es_ar, :es_cl, :es_cn, :es_lo, :es_ga, :es_ce, :es_o, :es_ex]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Jueves Santo", :regions => [:es_pv, :es_ct, :es_na, :es_v, :es_vc]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Viernes Santo", :regions => [:es]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Lunes de Pascua", :regions => [:es_pv, :es_ct, :es_na, :es_v, :es_vc]}],
|
||||
1 => [{:mday => 1, :name => "Año Nuevo", :regions => [:es]},
|
||||
{:mday => 6, :name => "Día de Reyes", :regions => [:es]}],
|
||||
2 => [{:mday => 28, :name => "Día de Andalucía", :regions => [:es_an]}],
|
||||
3 => [{:mday => 1, :name => "Día de las Islas Baleares", :regions => [:es_ib]},
|
||||
{:mday => 19, :name => "San José", :regions => [:es_v, :es_vc, :es_cm, :es_mu, :es_m]}],
|
||||
4 => [{:mday => 23, :name => "San Jorge", :regions => [:es_ar, :es_cl]},
|
||||
{:mday => 23, :name => "Día de Aragón", :regions => [:es_ar]}],
|
||||
5 => [{:mday => 1, :name => "Día del Trabajador", :regions => [:es]},
|
||||
{:mday => 2, :name => "Fiesta de la Comunidad", :regions => [:es_m]},
|
||||
{:mday => 30, :name => "Día de las Canarias", :regions => [:es_cn]},
|
||||
{:mday => 31, :name => "Día de la Región Castilla-La Mancha", :regions => [:es_cm]}],
|
||||
6 => [{:mday => 9, :name => "Día de la Región de Murcia", :regions => [:es_mu]},
|
||||
{:mday => 9, :name => "Día de La Rioja", :regions => [:es_lo]}],
|
||||
7 => [{:mday => 23, :name => "Santiago Apostol", :regions => [:es_ga]}],
|
||||
8 => [{:mday => 15, :name => "Asunción", :regions => [:es]}],
|
||||
9 => [{:mday => 2, :name => "Día de Ceuta", :regions => [:es_ce]},
|
||||
{:mday => 8, :name => "Día de Asturias", :regions => [:es_o]},
|
||||
{:mday => 8, :name => "Día de Extremadura", :regions => [:es_ex]},
|
||||
{:mday => 11, :name => "Fiesta Nacional de Cataluña", :regions => [:es_ct]}],
|
||||
10 => [{:mday => 9, :name => "Día de Valencia", :regions => [:es_vc, :es_v]},
|
||||
{:mday => 12, :name => "Día de la Hispanidad", :regions => [:es]}],
|
||||
11 => [{:mday => 1, :name => "Todos los Santos", :regions => [:es]}],
|
||||
12 => [{:mday => 6, :name => "Día de la Constitución", :regions => [:es]},
|
||||
{:mday => 8, :name => "Inmaculada Concepción", :regions => [:es]},
|
||||
{:mday => 25, :name => "Navidad del Señor", :regions => [:es]},
|
||||
{:mday => 26, :name => "San Esteban", :regions => [:es_ib, :es_ct]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::ES.defined_regions, Holidays::ES.holidays_by_month)
|
||||
|
|
|
@ -1,215 +1,323 @@
|
|||
module Holidays
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/dk.yaml, data/de.yaml, data/es.yaml, data/fr.yaml, data/gb.yaml, data/ie.yaml, data/is.yaml, data/it.yaml, data/nl.yaml, data/pt.yaml
|
||||
#
|
||||
# To use the definitions in this file, load them right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/europe'
|
||||
#
|
||||
# More definitions are available at http://code.dunae.ca/holidays.
|
||||
module Europe # :nodoc:
|
||||
DEFINED_REGIONS = [:dk, :de, :fr, :de_bw, :de_by, :de_nw, :de_rp, :de_sl, :de_sn, :de_he, :de_th, :de_bb, :de_mv, :de_st, :es, :es_m, :es_cn, :es_cm, :es_pv, :es_ct, :es_na, :es_v, :es_vc, :es_mu, :es_lo, :es_ib, :es_ga, :es_an, :es_ce, :es_o, :es_ex, :es_ar, :es_cl, :gb, :ie, :je, :gb_jsy, :gg, :gb_gsy, :gb_eng, :gb_wls, :gb_eaw, :gb_nir, :gb_sct, :im, :gb_iom, :gb_con, :is, :it, :nl, :pt]
|
||||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:mday => 1, :name => "Arbejdernes kampdag", :regions => [:dk]},
|
||||
{:mday => 5, :type => :informal, :name => "Danmarks befrielse", :regions => [:dk]},
|
||||
{:mday => 1, :name => "Tag der Arbeit", :regions => [:de]},
|
||||
{:mday => 8, :name => "Victoire 1945", :regions => [:de, :fr]},
|
||||
{:mday => 1, :name => "Día del Trabajador", :regions => [:es]},
|
||||
{:mday => 2, :name => "Fiesta de la Comunidad", :regions => [:es_m]},
|
||||
{:mday => 30, :name => "Día de las Canarias", :regions => [:es_cn]},
|
||||
{:mday => 31, :name => "Día de la Región Castilla-La Mancha", :regions => [:es_cm]},
|
||||
{:mday => 1, :name => "Fête du travail", :regions => [:fr]},
|
||||
{:wday => 1, :week => 1, :name => "May Day", :regions => [:gb, :ie]},
|
||||
{:mday => 9, :name => "Liberation Day", :regions => [:je, :gb_jsy, :gg, :gb_gsy]},
|
||||
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb]},
|
||||
{:mday => 1, :name => "Verkalýðsdagurinn", :regions => [:is]},
|
||||
{:mday => 13, :name => "Mæðradagurinn", :regions => [:is]},
|
||||
{:mday => 1, :name => "Festa dei Lavoratori", :regions => [:it]},
|
||||
{:mday => 4, :name => "Dodenherdenking", :regions => [:nl]},
|
||||
{:mday => 5, :name => "Bevrijdingsdag", :regions => [:nl]},
|
||||
{:mday => 1, :name => "Dia do Trabalhador", :regions => [:pt]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-49 }, :function_id => "easter(year)-49", :type => :informal, :name => "Fastelavn", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Palmesøndag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skærtorsdag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Langfredag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Påskedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "2. påskedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+26 }, :function_id => "easter(year)+26", :name => "Store Bededag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi Himmelfartsdag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pinsedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "2. Pinsedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Karfreitag", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :type => :informal, :name => "Ostern", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Ostermontag", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Christi Himmelfahrt", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pfingstmontag", :regions => [:de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+60 }, :function_id => "easter(year)+60", :name => "Fronleichnam", :regions => [:de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_sn, :de_th]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Jueves Santo", :regions => [:es_pv, :es_ct, :es_na, :es_v, :es_vc]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Viernes Santo", :regions => [:es]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Lunes de Pascua", :regions => [:es_pv, :es_ct, :es_na, :es_v, :es_vc]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pâques", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Lundi de Pâques", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Ascension", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pentecôte", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Lundi de Pentecôte", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:gb]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Easter Sunday", :regions => [:gb]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Easter Monday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir, :ie]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-48 }, :function_id => "easter(year)-48", :name => "Bolludagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :name => "Sprengidagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-46 }, :function_id => "easter(year)-46", :name => "Öskudagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Pálmasunnudagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skírdagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Föstudaginn langi", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Páskadagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Annar í páskum", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Uppstigningardagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Hvítasunnudagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Annar í hvítasunnu", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pasqua", :regions => [:it]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Lunedì dell'Angelo", :regions => [:it]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Goede Vrijdag", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pasen", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Pasen", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Hemelvaartsdag", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pinksteren", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pinksteren", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :type => :informal, :name => "Carnaval", :regions => [:pt]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Sexta-feira Santa", :regions => [:pt]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Páscoa", :regions => [:pt]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+60 }, :function_id => "easter(year)+60", :name => "Corpo de Deus", :regions => [:pt]}],
|
||||
11 => [{:mday => 10, :type => :informal, :name => "Mortensaften", :regions => [:dk]},
|
||||
{:mday => 1, :name => "Allerheiligen", :regions => [:de_bw, :de_by, :de_nw, :de_rp, :de_sl]},
|
||||
{:function => lambda { |year| Holidays.de_buss_und_bettag(year) }, :function_id => "de_buss_und_bettag(year)", :name => "Buß- und Bettag", :regions => [:de_by, :de_sn]},
|
||||
{:mday => 1, :name => "Todos los Santos", :regions => [:es]},
|
||||
{:mday => 1, :name => "Toussaint", :regions => [:fr]},
|
||||
{:mday => 11, :name => "Armistice 1918", :regions => [:fr]},
|
||||
{:mday => 5, :type => :informal, :name => "Guy Fawkes Day", :regions => [:gb]},
|
||||
{:mday => 16, :name => "Dagur íslenskrar tungu", :regions => [:is]},
|
||||
{:mday => 1, :name => "Ognissanti", :regions => [:it]},
|
||||
{:mday => 1, :name => "Todos os Santos", :regions => [:pt]}],
|
||||
6 => [{:mday => 5, :name => "Grundlovsdag", :regions => [:dk]},
|
||||
{:mday => 15, :type => :informal, :name => "Valdemarsdag og Genforeningsdag", :regions => [:dk]},
|
||||
{:mday => 23, :type => :informal, :name => "Sankt Hans aften", :regions => [:dk]},
|
||||
{:mday => 9, :name => "Día de la Región de Murcia", :regions => [:es_mu]},
|
||||
{:mday => 9, :name => "Día de La Rioja", :regions => [:es_lo]},
|
||||
{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:ie]},
|
||||
{:mday => 3, :type => :informal, :name => "Sjómannadagurinn", :regions => [:is]},
|
||||
{:mday => 17, :name => "Lýðveldisdagurinn", :regions => [:is]},
|
||||
{:mday => 2, :name => "Festa della Repubblica", :regions => [:it]},
|
||||
{:mday => 10, :name => "Dia de Portugal", :regions => [:pt]}],
|
||||
1 => [{:mday => 1, :name => "Nytårsdag", :regions => [:dk]},
|
||||
{:mday => 1, :name => "Neujahrstag", :regions => [:de]},
|
||||
{:mday => 6, :name => "Heilige Drei Könige", :regions => [:de_bw, :de_by]},
|
||||
{:mday => 1, :name => "Año Nuevo", :regions => [:es]},
|
||||
{:mday => 6, :name => "Día de Reyes", :regions => [:es]},
|
||||
{:mday => 1, :name => "Jour de l'an", :regions => [:fr]},
|
||||
{:mday => 1, :name => "New Year's Day", :regions => [:gb, :ie]},
|
||||
{:mday => 2, :name => "New Year's", :regions => [:gb_sct]},
|
||||
{:mday => 1, :name => "Nýársdagur", :regions => [:is]},
|
||||
{:mday => 6, :name => "Þrettándinn", :regions => [:is]},
|
||||
{:mday => 19, :type => :informal, :name => "Bóndadagur", :regions => [:is]},
|
||||
{:mday => 1, :name => "Capodanno", :regions => [:it]},
|
||||
{:mday => 6, :name => "Epifania", :regions => [:it]},
|
||||
{:mday => 1, :name => "Nieuwjaar", :regions => [:nl]},
|
||||
{:mday => 1, :name => "Ano Novo", :regions => [:pt]}],
|
||||
12 => [{:mday => 13, :type => :informal, :name => "Sankt Lucia", :regions => [:dk]},
|
||||
{:mday => 24, :name => "Juleaftensdag", :regions => [:dk]},
|
||||
{:mday => 25, :name => "1. juledag", :regions => [:dk]},
|
||||
{:mday => 26, :name => "2. juledag", :regions => [:dk]},
|
||||
{:mday => 25, :name => "1. Weihnachtstag", :regions => [:de]},
|
||||
{:mday => 26, :name => "2. Weihnachtstag", :regions => [:de]},
|
||||
{:mday => 6, :name => "Día de la Constitución", :regions => [:es]},
|
||||
{:mday => 8, :name => "Inmaculada Concepción", :regions => [:es]},
|
||||
{:mday => 25, :name => "Navidad del Señor", :regions => [:es]},
|
||||
{:mday => 26, :name => "San Esteban", :regions => [:es_ib, :es_ct]},
|
||||
{:mday => 25, :name => "Nöel", :regions => [:fr]},
|
||||
{:mday => 25, :observed => lambda { |date| Holidays.to_monday_if_weekend(date) }, :observed_id => "to_monday_if_weekend", :name => "Christmas Day", :regions => [:gb]},
|
||||
{:mday => 26, :observed => lambda { |date| Holidays.to_weekday_if_boxing_weekend(date) }, :observed_id => "to_weekday_if_boxing_weekend", :name => "Boxing Day", :regions => [:gb]},
|
||||
{:mday => 25, :name => "Christmas Day", :regions => [:ie]},
|
||||
{:mday => 26, :name => "St. Stephen's Day", :regions => [:ie]},
|
||||
{:mday => 24, :name => "Jól", :regions => [:is]},
|
||||
{:mday => 25, :name => "Jól", :regions => [:is]},
|
||||
{:mday => 26, :name => "Jól", :regions => [:is]},
|
||||
{:mday => 31, :name => "Gamlárskvöld", :regions => [:is]},
|
||||
{:mday => 8, :name => "Immacolata Concezione", :regions => [:it]},
|
||||
{:mday => 25, :name => "Natale", :regions => [:it]},
|
||||
{:mday => 26, :name => "Santo Stefano", :regions => [:it]},
|
||||
{:mday => 5, :type => :informal, :name => "Sinterklaas", :regions => [:nl]},
|
||||
{:mday => 25, :name => "Kerstmis", :regions => [:nl]},
|
||||
{:mday => 26, :name => "Kerstmis", :regions => [:nl]},
|
||||
{:mday => 1, :name => "Restauração da Independência", :regions => [:pt]},
|
||||
{:mday => 8, :name => "Imaculada Conceição", :regions => [:pt]},
|
||||
{:mday => 25, :name => "Natal", :regions => [:pt]}],
|
||||
7 => [{:mday => 23, :name => "Santiago Apostol", :regions => [:es_ga]},
|
||||
{:mday => 14, :name => "Fête nationale", :regions => [:fr]},
|
||||
{:mday => 5, :name => "Tynwald Day", :regions => [:im, :gb_iom]},
|
||||
{:mday => 12, :name => "Battle of the Boyne", :regions => [:gb_nir]}],
|
||||
2 => [{:mday => 28, :name => "Día de Andalucía", :regions => [:es_an]},
|
||||
{:mday => 18, :type => :informal, :name => "Konudagur", :regions => [:is]}],
|
||||
8 => [{:mday => 15, :name => "Mariä Himmelfahrt", :regions => [:de_by, :de_sl]},
|
||||
{:mday => 15, :name => "Asunción", :regions => [:es]},
|
||||
{:mday => 15, :name => "Assomption", :regions => [:fr]},
|
||||
{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:gb_sct, :ie]},
|
||||
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir]},
|
||||
{:wday => 1, :week => 1, :name => "Frídagur verslunarmanna", :regions => [:is]},
|
||||
{:mday => 15, :name => "Assunzione", :regions => [:it]},
|
||||
{:mday => 15, :name => "Assunção de Nossa Senhora", :regions => [:pt]}],
|
||||
3 => [{:mday => 1, :name => "Día de las Islas Baleares", :regions => [:es_ib]},
|
||||
{:mday => 19, :name => "San José", :regions => [:es_v, :es_vc, :es_cm, :es_mu, :es_m]},
|
||||
{:mday => 5, :name => "St. Piran's Day", :regions => [:gb_con]},
|
||||
{:mday => 17, :name => "St. Patrick's Day", :regions => [:gb_nir, :ie]}],
|
||||
9 => [{:mday => 2, :name => "Día de Ceuta", :regions => [:es_ce]},
|
||||
{:mday => 8, :name => "Día de Asturias", :regions => [:es_o]},
|
||||
{:mday => 8, :name => "Día de Extremadura", :regions => [:es_ex]},
|
||||
{:mday => 11, :name => "Fiesta Nacional de Cataluña", :regions => [:es_ct]}],
|
||||
4 => [{:mday => 1, :type => :informal, :name => "1. april", :regions => [:dk]},
|
||||
{:mday => 9, :type => :informal, :name => "Danmarks besættelse", :regions => [:dk]},
|
||||
{:mday => 16, :type => :informal, :name => "Dronningens fødselsdag", :regions => [:dk]},
|
||||
{:mday => 23, :name => "San Jorge", :regions => [:es_ar, :es_cl]},
|
||||
{:mday => 23, :name => "Día de Aragón", :regions => [:es_ar]},
|
||||
{:function => lambda { |year| Holidays.is_sumardagurinn_fyrsti(year) }, :function_id => "is_sumardagurinn_fyrsti(year)", :name => "Sumardagurinn fyrsti", :regions => [:is]},
|
||||
{:mday => 25, :name => "Festa della Liberazione", :regions => [:it]},
|
||||
{:mday => 30, :name => "Koninginnedag", :regions => [:nl]},
|
||||
{:mday => 25, :name => "Dia da Liberdade", :regions => [:pt]}],
|
||||
10 => [{:mday => 3, :name => "Tag der Deutschen Einheit", :regions => [:de]},
|
||||
{:mday => 31, :name => "Reformationstag", :regions => [:de_bb, :de_mv, :de_sn, :de_st, :de_th]},
|
||||
{:mday => 9, :name => "Día de Valencia", :regions => [:es_vc, :es_v]},
|
||||
{:mday => 12, :name => "Día de la Hispanidad", :regions => [:es]},
|
||||
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:ie]},
|
||||
{:mday => 5, :name => "Implantação da República", :regions => [:pt]}]
|
||||
}
|
||||
end
|
||||
|
||||
# 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
|
||||
|
||||
|
||||
# Iceland: first day of summer (Thursday after 18 April)
|
||||
def self.is_sumardagurinn_fyrsti(year)
|
||||
date = Date.civil(year,4,18)
|
||||
if date.wday < 4
|
||||
date += (4 - date.wday)
|
||||
else date
|
||||
date += (11 - date.wday)
|
||||
end
|
||||
date
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::Europe::DEFINED_REGIONS, Holidays::Europe::HOLIDAYS_BY_MONTH)
|
||||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/at.yaml, data/cz.yaml, data/dk.yaml, data/de.yaml, data/el.yaml, data/es.yaml, data/fr.yaml, data/gb.yaml, data/ie.yaml, data/is.yaml, data/it.yaml, data/li.yaml, data/nl.yaml, data/no.yaml, data/pl.yaml, data/pt.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/europe'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module Europe # :nodoc:
|
||||
def self.defined_regions
|
||||
[:at, :de, :li, :de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :cz, :dk, :no, :de_st, :de_bb, :de_mv, :de_sn, :de_th, :el, :es_pv, :es_ct, :es_na, :es_v, :es_vc, :es, :es_an, :es_ib, :es_cm, :es_mu, :es_m, :es_ar, :es_cl, :es_cn, :es_lo, :es_ga, :es_ce, :es_o, :es_ex, :fr, :gb, :gb_eng, :gb_wls, :gb_eaw, :gb_nir, :ie, :gb_sct, :gb_con, :je, :gb_jsy, :gg, :gb_gsy, :im, :gb_iom, :is, :it, :nl, :pl, :pt]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Ostermontag", :regions => [:at, :de, :li]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Christi Himmelfahrt", :regions => [:at, :de]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pfingstmontag", :regions => [:at, :de, :li]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+60 }, :function_id => "easter(year)+60", :name => "Fronleichnam", :regions => [:at, :de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :li]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Velikonoční pondělí", :regions => [:cz]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-49 }, :function_id => "easter(year)-49", :type => :informal, :name => "Fastelavn", :regions => [:dk, :no]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Palmesøndag", :regions => [:dk, :no]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skærtorsdag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Langfredag", :regions => [:dk, :no]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Påskedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "2. påskedag", :regions => [:dk, :no]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+26 }, :function_id => "easter(year)+26", :name => "Store Bededag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi Himmelfartsdag", :regions => [:dk, :no]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pinsedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "2. Pinsedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Karfreitag", :regions => [:de, :li]},
|
||||
{:function => lambda { |year| Holidays.orthodox_easter(year)-2 }, :function_id => "orthodox_easter(year)-2", :name => "Μεγάλη Παρασκευή", :regions => [:el]},
|
||||
{:function => lambda { |year| Holidays.orthodox_easter(year)-1 }, :function_id => "orthodox_easter(year)-1", :name => "Μεγάλο Σάββατο", :regions => [:el]},
|
||||
{:function => lambda { |year| Holidays.orthodox_easter(year) }, :function_id => "orthodox_easter(year)", :name => "Κυριακή του Πάσχα", :regions => [:el]},
|
||||
{:function => lambda { |year| Holidays.orthodox_easter(year)+1 }, :function_id => "orthodox_easter(year)+1", :name => "Δευτέρα του Πάσχα", :regions => [:el]},
|
||||
{:function => lambda { |year| Holidays.orthodox_easter(year)-48 }, :function_id => "orthodox_easter(year)-48", :name => "Καθαρά Δευτέρα", :regions => [:el]},
|
||||
{:function => lambda { |year| Holidays.orthodox_easter(year)+50 }, :function_id => "orthodox_easter(year)+50", :name => "Αγίου Πνεύματος", :regions => [:el]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Jueves Santo", :regions => [:es_pv, :es_ct, :es_na, :es_v, :es_vc]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Viernes Santo", :regions => [:es]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Lunes de Pascua", :regions => [:es_pv, :es_ct, :es_na, :es_v, :es_vc]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pâques", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Lundi de Pâques", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Ascension", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pentecôte", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Lundi de Pentecôte", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:gb]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Easter Sunday", :regions => [:gb]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Easter Monday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir, :ie]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-48 }, :function_id => "easter(year)-48", :name => "Bolludagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :name => "Sprengidagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-46 }, :function_id => "easter(year)-46", :name => "Öskudagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Pálmasunnudagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skírdagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Föstudaginn langi", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Páskadagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Annar í páskum", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Uppstigningardagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Hvítasunnudagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Annar í hvítasunnu", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pasqua", :regions => [:it]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Lunedì dell'Angelo", :regions => [:it]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :name => "Fasnachtsdienstag", :regions => [:li]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :type => :informal, :name => "Ostern", :regions => [:li]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Auffahrt", :regions => [:li]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Goede Vrijdag", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pasen", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Pasen", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Hemelvaartsdag", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pinksteren", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pinksteren", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skjærtorsdag", :regions => [:no]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "1. påskedag", :regions => [:no]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "1. pinsedag", :regions => [:no]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "2. pinsedag", :regions => [:no]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-52 }, :function_id => "easter(year)-52", :type => :informal, :name => "Tłusty Czwartek", :regions => [:pl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :type => :informal, :name => "Ostatki", :regions => [:pl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-46 }, :function_id => "easter(year)-46", :type => :informal, :name => "Środa Popielcowa", :regions => [:pl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :type => :informal, :name => "Niedziela Palmowa", :regions => [:pl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :type => :informal, :name => "Wielki Czwartek", :regions => [:pl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :type => :informal, :name => "Wielki Piątek", :regions => [:pl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-1 }, :function_id => "easter(year)-1", :type => :informal, :name => "Wielka Sobota", :regions => [:pl]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Niedziela Wielkanocna", :regions => [:pl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Poniedziałek Wielkanocny (Lany Poniedziałek)", :regions => [:pl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Zesłanie Ducha Świętego (Zielone Świątki)", :regions => [:pl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+60 }, :function_id => "easter(year)+60", :name => "Uroczystość Najświętszego Ciała i Krwi Pańskiej (Boże Ciało)", :regions => [:pl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :type => :informal, :name => "Carnaval", :regions => [:pt]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Sexta-feira Santa", :regions => [:pt]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Páscoa", :regions => [:pt]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+60 }, :function_id => "easter(year)+60", :name => "Corpo de Deus", :regions => [:pt]}],
|
||||
1 => [{:mday => 1, :name => "Neujahrstag", :regions => [:at, :de, :li]},
|
||||
{:mday => 6, :name => "Heilige Drei Könige", :regions => [:at]},
|
||||
{:mday => 1, :name => "Den obnovy samostatného českého státu", :regions => [:cz]},
|
||||
{:mday => 1, :name => "Nytårsdag", :regions => [:dk]},
|
||||
{:mday => 6, :name => "Heilige Drei Könige", :regions => [:de_bw, :de_by, :de_st, :li, :li]},
|
||||
{:mday => 1, :name => "Πρωτοχρονιά", :regions => [:el]},
|
||||
{:mday => 6, :name => "Θεοφάνεια", :regions => [:el]},
|
||||
{:mday => 1, :name => "Año Nuevo", :regions => [:es]},
|
||||
{:mday => 6, :name => "Día de Reyes", :regions => [:es]},
|
||||
{:mday => 1, :name => "Jour de l'an", :regions => [:fr]},
|
||||
{:mday => 1, :name => "New Year's Day", :regions => [:gb, :ie]},
|
||||
{:mday => 2, :name => "New Year's", :regions => [:gb_sct]},
|
||||
{:mday => 1, :name => "Nýársdagur", :regions => [:is]},
|
||||
{:mday => 6, :name => "Þrettándinn", :regions => [:is]},
|
||||
{:mday => 19, :type => :informal, :name => "Bóndadagur", :regions => [:is]},
|
||||
{:mday => 1, :name => "Capodanno", :regions => [:it]},
|
||||
{:mday => 6, :name => "Epifania", :regions => [:it]},
|
||||
{:mday => 1, :name => "Nieuwjaar", :regions => [:nl]},
|
||||
{:mday => 1, :name => "Nyttårsdag", :regions => [:no]},
|
||||
{:mday => 1, :name => "Nowy Rok", :regions => [:pl]},
|
||||
{:function => lambda { |year| Holidays.pl_trzech_kroli(year) }, :function_id => "pl_trzech_kroli(year)", :name => "Objawienie Pańskie (święto Trzech Króli)", :regions => [:pl]},
|
||||
{:function => lambda { |year| Holidays.pl_trzech_kroli_informal(year) }, :function_id => "pl_trzech_kroli_informal(year)", :type => :informal, :name => "Objawienie Pańskie (święto Trzech Króli)", :regions => [:pl]},
|
||||
{:mday => 21, :type => :informal, :name => "Dzień Babci", :regions => [:pl]},
|
||||
{:mday => 22, :type => :informal, :name => "Dzień Dziadka", :regions => [:pl]},
|
||||
{:mday => 1, :name => "Ano Novo", :regions => [:pt]}],
|
||||
5 => [{:mday => 1, :name => "Staatsfeiertag", :regions => [:at]},
|
||||
{:mday => 1, :name => "Svátek práce", :regions => [:cz]},
|
||||
{:mday => 8, :name => "Den vítězství", :regions => [:cz]},
|
||||
{:mday => 1, :name => "Arbejdernes kampdag", :regions => [:dk]},
|
||||
{:mday => 5, :type => :informal, :name => "Danmarks befrielse", :regions => [:dk]},
|
||||
{:mday => 1, :name => "Tag der Arbeit", :regions => [:de, :li]},
|
||||
{:mday => 1, :name => "Πρωτομαγιά", :regions => [:el]},
|
||||
{:mday => 1, :name => "Día del Trabajador", :regions => [:es]},
|
||||
{:mday => 2, :name => "Fiesta de la Comunidad", :regions => [:es_m]},
|
||||
{:mday => 30, :name => "Día de las Canarias", :regions => [:es_cn]},
|
||||
{:mday => 31, :name => "Día de la Región Castilla-La Mancha", :regions => [:es_cm]},
|
||||
{:mday => 1, :name => "Fête du travail", :regions => [:fr]},
|
||||
{:mday => 8, :name => "Victoire 1945", :regions => [:fr]},
|
||||
{:wday => 1, :week => 1, :name => "May Day", :regions => [:gb, :ie]},
|
||||
{:mday => 9, :name => "Liberation Day", :regions => [:je, :gb_jsy, :gg, :gb_gsy]},
|
||||
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb]},
|
||||
{:mday => 1, :name => "Verkalýðsdagurinn", :regions => [:is]},
|
||||
{:mday => 13, :name => "Mæðradagurinn", :regions => [:is]},
|
||||
{:mday => 1, :name => "Festa dei Lavoratori", :regions => [:it]},
|
||||
{:mday => 4, :name => "Dodenherdenking", :regions => [:nl]},
|
||||
{:mday => 5, :name => "Bevrijdingsdag", :regions => [:nl]},
|
||||
{:mday => 1, :name => "1. mai", :regions => [:no]},
|
||||
{:mday => 17, :name => "17. mai", :regions => [:no]},
|
||||
{:mday => 1, :name => "Święto Państwowe (Święto Pracy)", :regions => [:pl]},
|
||||
{:mday => 2, :type => :informal, :name => "Dzień Flagi Rzeczpospolitej Polskiej", :regions => [:pl]},
|
||||
{:mday => 3, :name => "Święto Narodowe Trzeciego Maja", :regions => [:pl]},
|
||||
{:mday => 1, :name => "Dia do Trabalhador", :regions => [:pt]}],
|
||||
8 => [{:mday => 15, :name => "Mariä Himmelfahrt", :regions => [:at]},
|
||||
{:mday => 15, :name => "Mariä Himmelfahrt", :regions => [:de_by, :de_sl]},
|
||||
{:mday => 15, :name => "Κοίμηση της Θεοτόκου", :regions => [:el]},
|
||||
{:mday => 15, :name => "Asunción", :regions => [:es]},
|
||||
{:mday => 15, :name => "Assomption", :regions => [:fr]},
|
||||
{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:gb_sct, :ie]},
|
||||
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir]},
|
||||
{:wday => 1, :week => 1, :name => "Frídagur verslunarmanna", :regions => [:is]},
|
||||
{:mday => 15, :name => "Assunzione", :regions => [:it]},
|
||||
{:mday => 15, :name => "Staatsfeiertag", :regions => [:li]},
|
||||
{:mday => 15, :name => "Wniebowzięcie Najświętszej Maryi Panny", :regions => [:pl]},
|
||||
{:mday => 15, :name => "Święto Wojska Polskiego", :regions => [:pl]},
|
||||
{:mday => 15, :name => "Assunção de Nossa Senhora", :regions => [:pt]}],
|
||||
10 => [{:mday => 26, :name => "Nationalfeiertag", :regions => [:at]},
|
||||
{:mday => 28, :name => "Den vzniku samostatného československého státu", :regions => [:cz]},
|
||||
{:mday => 3, :name => "Tag der Deutschen Einheit", :regions => [:de]},
|
||||
{:mday => 31, :name => "Reformationstag", :regions => [:de_bb, :de_mv, :de_sn, :de_st, :de_th]},
|
||||
{:mday => 28, :name => "Επέτειος του Όχι", :regions => [:el]},
|
||||
{:mday => 9, :name => "Día de Valencia", :regions => [:es_vc, :es_v]},
|
||||
{:mday => 12, :name => "Día de la Hispanidad", :regions => [:es]},
|
||||
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:ie]},
|
||||
{:mday => 14, :type => :informal, :name => "Dzień Nauczyciela (Dzień Edukacji Narodowej)", :regions => [:pl]},
|
||||
{:mday => 5, :name => "Implantação da República", :regions => [:pt]}],
|
||||
11 => [{:mday => 1, :name => "Allerheiligen", :regions => [:at, :de_bw, :de_by, :de_nw, :de_rp, :de_sl, :li]},
|
||||
{:mday => 17, :name => "Den boje za svobodu a demokracii", :regions => [:cz]},
|
||||
{:mday => 10, :type => :informal, :name => "Mortensaften", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.de_buss_und_bettag(year) }, :function_id => "de_buss_und_bettag(year)", :name => "Buß- und Bettag", :regions => [:de_sn]},
|
||||
{:mday => 1, :name => "Todos los Santos", :regions => [:es]},
|
||||
{:mday => 1, :name => "Toussaint", :regions => [:fr]},
|
||||
{:mday => 11, :name => "Armistice 1918", :regions => [:fr]},
|
||||
{:mday => 5, :type => :informal, :name => "Guy Fawkes Day", :regions => [:gb]},
|
||||
{:mday => 16, :name => "Dagur íslenskrar tungu", :regions => [:is]},
|
||||
{:mday => 1, :name => "Ognissanti", :regions => [:it]},
|
||||
{:mday => 1, :name => "Wszystkich Świętych", :regions => [:pl]},
|
||||
{:mday => 2, :type => :informal, :name => "Dzień Zaduszny", :regions => [:pl]},
|
||||
{:mday => 11, :name => "Narodowe Święto Niepodległości", :regions => [:pl]},
|
||||
{:mday => 29, :type => :informal, :name => "Andrzejki", :regions => [:pl]},
|
||||
{:mday => 1, :name => "Todos os Santos", :regions => [:pt]}],
|
||||
12 => [{:mday => 8, :name => "Mariä Empfängnis", :regions => [:at]},
|
||||
{:mday => 25, :name => "1. Weihnachtstag", :regions => [:at, :de]},
|
||||
{:mday => 26, :name => "2. Weihnachtstag", :regions => [:at, :de]},
|
||||
{:mday => 24, :name => "Štědrý den", :regions => [:cz]},
|
||||
{:mday => 25, :name => "1. svátek vánoční", :regions => [:cz]},
|
||||
{:mday => 26, :name => "2. svátek vánoční", :regions => [:cz]},
|
||||
{:mday => 13, :type => :informal, :name => "Sankt Lucia", :regions => [:dk]},
|
||||
{:mday => 24, :name => "Juleaftensdag", :regions => [:dk]},
|
||||
{:mday => 25, :name => "1. juledag", :regions => [:dk, :no]},
|
||||
{:mday => 26, :name => "2. juledag", :regions => [:dk, :no]},
|
||||
{:mday => 25, :name => "Χριστούγεννα", :regions => [:el]},
|
||||
{:mday => 26, :name => "Δεύτερη ημέρα των Χριστουγέννων", :regions => [:el]},
|
||||
{:mday => 6, :name => "Día de la Constitución", :regions => [:es]},
|
||||
{:mday => 8, :name => "Inmaculada Concepción", :regions => [:es]},
|
||||
{:mday => 25, :name => "Navidad del Señor", :regions => [:es]},
|
||||
{:mday => 26, :name => "San Esteban", :regions => [:es_ib, :es_ct]},
|
||||
{:mday => 25, :name => "Nöel", :regions => [:fr]},
|
||||
{:mday => 25, :observed => lambda { |date| Holidays.to_monday_if_weekend(date) }, :observed_id => "to_monday_if_weekend", :name => "Christmas Day", :regions => [:gb]},
|
||||
{:mday => 26, :observed => lambda { |date| Holidays.to_weekday_if_boxing_weekend(date) }, :observed_id => "to_weekday_if_boxing_weekend", :name => "Boxing Day", :regions => [:gb]},
|
||||
{:mday => 25, :name => "Christmas Day", :regions => [:ie]},
|
||||
{:mday => 26, :name => "St. Stephen's Day", :regions => [:ie]},
|
||||
{:mday => 24, :name => "Jól", :regions => [:is]},
|
||||
{:mday => 25, :name => "Jól", :regions => [:is]},
|
||||
{:mday => 26, :name => "Jól", :regions => [:is]},
|
||||
{:mday => 31, :name => "Gamlárskvöld", :regions => [:is]},
|
||||
{:mday => 8, :name => "Immacolata Concezione", :regions => [:it]},
|
||||
{:mday => 25, :name => "Natale", :regions => [:it]},
|
||||
{:mday => 26, :name => "Santo Stefano", :regions => [:it]},
|
||||
{:mday => 8, :name => "Maria Empfängnis", :regions => [:li]},
|
||||
{:mday => 24, :name => "Heilig Abend", :regions => [:li]},
|
||||
{:mday => 25, :name => "Weihnachten", :regions => [:li]},
|
||||
{:mday => 26, :name => "Stefanstag", :regions => [:li]},
|
||||
{:mday => 31, :name => "Silvester", :regions => [:li]},
|
||||
{:mday => 5, :type => :informal, :name => "Sinterklaas", :regions => [:nl]},
|
||||
{:mday => 25, :name => "Kerstmis", :regions => [:nl]},
|
||||
{:mday => 26, :name => "Kerstmis", :regions => [:nl]},
|
||||
{:mday => 24, :type => :informal, :name => "Julaften", :regions => [:no]},
|
||||
{:mday => 31, :type => :informal, :name => "Nyttårsaften", :regions => [:no]},
|
||||
{:mday => 4, :type => :informal, :name => "Barbórka (Dzień Górnika, Naftowca i Gazownika)", :regions => [:pl]},
|
||||
{:mday => 6, :type => :informal, :name => "Mikołajki", :regions => [:pl]},
|
||||
{:mday => 24, :type => :informal, :name => "Wigilia Bożego Narodzenia", :regions => [:pl]},
|
||||
{:mday => 25, :name => "pierwszy dzień Bożego Narodzenia", :regions => [:pl]},
|
||||
{:mday => 26, :name => "drugi dzień Bożego Narodzenia", :regions => [:pl]},
|
||||
{:mday => 31, :type => :informal, :name => "Sylwester", :regions => [:pl]},
|
||||
{:mday => 1, :name => "Restauração da Independência", :regions => [:pt]},
|
||||
{:mday => 8, :name => "Imaculada Conceição", :regions => [:pt]},
|
||||
{:mday => 25, :name => "Natal", :regions => [:pt]}],
|
||||
7 => [{:mday => 5, :name => "Den slovanských věrozvěstů Cyrila a Metoděje", :regions => [:cz]},
|
||||
{:mday => 6, :name => "Den upálení mistra Jana Husa", :regions => [:cz]},
|
||||
{:mday => 23, :name => "Santiago Apostol", :regions => [:es_ga]},
|
||||
{:mday => 14, :name => "Fête nationale", :regions => [:fr]},
|
||||
{:mday => 5, :name => "Tynwald Day", :regions => [:im, :gb_iom]},
|
||||
{:mday => 12, :name => "Battle of the Boyne", :regions => [:gb_nir]}],
|
||||
9 => [{:mday => 28, :name => "Den české státnosti", :regions => [:cz]},
|
||||
{:mday => 2, :name => "Día de Ceuta", :regions => [:es_ce]},
|
||||
{:mday => 8, :name => "Día de Asturias", :regions => [:es_o]},
|
||||
{:mday => 8, :name => "Día de Extremadura", :regions => [:es_ex]},
|
||||
{:mday => 11, :name => "Fiesta Nacional de Cataluña", :regions => [:es_ct]},
|
||||
{:mday => 8, :name => "Maria Geburt", :regions => [:li]},
|
||||
{:mday => 30, :type => :informal, :name => "Dzień Chłopaka", :regions => [:pl]}],
|
||||
4 => [{:mday => 1, :type => :informal, :name => "1. april", :regions => [:dk]},
|
||||
{:mday => 9, :type => :informal, :name => "Danmarks besættelse", :regions => [:dk]},
|
||||
{:mday => 16, :type => :informal, :name => "Dronningens fødselsdag", :regions => [:dk]},
|
||||
{:mday => 23, :name => "San Jorge", :regions => [:es_ar, :es_cl]},
|
||||
{:mday => 23, :name => "Día de Aragón", :regions => [:es_ar]},
|
||||
{:function => lambda { |year| Holidays.is_sumardagurinn_fyrsti(year) }, :function_id => "is_sumardagurinn_fyrsti(year)", :name => "Sumardagurinn fyrsti", :regions => [:is]},
|
||||
{:mday => 25, :name => "Festa della Liberazione", :regions => [:it]},
|
||||
{:mday => 30, :name => "Koninginnedag", :regions => [:nl]},
|
||||
{:mday => 1, :type => :informal, :name => "Prima Aprilis", :regions => [:pl]},
|
||||
{:mday => 22, :type => :informal, :name => "Międzynarodowy Dzień Ziemi", :regions => [:pl]},
|
||||
{:mday => 25, :name => "Dia da Liberdade", :regions => [:pt]}],
|
||||
6 => [{:mday => 5, :name => "Grundlovsdag", :regions => [:dk]},
|
||||
{:mday => 15, :type => :informal, :name => "Valdemarsdag og Genforeningsdag", :regions => [:dk]},
|
||||
{:mday => 23, :type => :informal, :name => "Sankt Hans aften", :regions => [:dk]},
|
||||
{:mday => 9, :name => "Día de la Región de Murcia", :regions => [:es_mu]},
|
||||
{:mday => 9, :name => "Día de La Rioja", :regions => [:es_lo]},
|
||||
{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:ie]},
|
||||
{:mday => 3, :type => :informal, :name => "Sjómannadagurinn", :regions => [:is]},
|
||||
{:mday => 17, :name => "Lýðveldisdagurinn", :regions => [:is]},
|
||||
{:mday => 2, :name => "Festa della Repubblica", :regions => [:it]},
|
||||
{:mday => 23, :type => :informal, :name => "Dzień Ojca", :regions => [:pl]},
|
||||
{:mday => 10, :name => "Dia de Portugal", :regions => [:pt]}],
|
||||
3 => [{:mday => 25, :name => "Επέτειος της Επανάστασης του 1821", :regions => [:el]},
|
||||
{:mday => 1, :name => "Día de las Islas Baleares", :regions => [:es_ib]},
|
||||
{:mday => 19, :name => "San José", :regions => [:es_v, :es_vc, :es_cm, :es_mu, :es_m]},
|
||||
{:mday => 5, :name => "St. Piran's Day", :regions => [:gb_con]},
|
||||
{:mday => 17, :name => "St. Patrick's Day", :regions => [:gb_nir, :ie]},
|
||||
{:mday => 19, :name => "St. Josef", :regions => [:li]},
|
||||
{:mday => 8, :type => :informal, :name => "Dzień Kobiet", :regions => [:pl]},
|
||||
{:mday => 10, :type => :informal, :name => "Dzień Mężczyzn", :regions => [:pl]}],
|
||||
2 => [{:mday => 28, :name => "Día de Andalucía", :regions => [:es_an]},
|
||||
{:mday => 18, :type => :informal, :name => "Konudagur", :regions => [:is]},
|
||||
{:mday => 2, :name => "Maria Lichtmess", :regions => [:li]},
|
||||
{:mday => 2, :type => :informal, :name => "Ofiarowanie Pańskie (Matki Boskiej Gromnicznej)", :regions => [:pl]},
|
||||
{:mday => 14, :type => :informal, :name => "Dzień Zakochanych (Walentynki)", :regions => [:pl]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
# 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
|
||||
|
||||
|
||||
# Iceland: first day of summer (Thursday after 18 April)
|
||||
def self.is_sumardagurinn_fyrsti(year)
|
||||
date = Date.civil(year,4,18)
|
||||
if date.wday < 4
|
||||
date += (4 - date.wday)
|
||||
else date
|
||||
date += (11 - date.wday)
|
||||
end
|
||||
date
|
||||
end
|
||||
|
||||
|
||||
# Poland: January 6 is holiday since 2011
|
||||
def self.pl_trzech_kroli(year)
|
||||
year >= 2011 ? 6 : nil
|
||||
end
|
||||
|
||||
|
||||
# Poland: January 6 wasn't holiday before 2011
|
||||
def self.pl_trzech_kroli_informal(year)
|
||||
year < 2011 ? 6 : nil
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::Europe.defined_regions, Holidays::Europe.holidays_by_month)
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/fi.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/fi'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module FI # :nodoc:
|
||||
def self.defined_regions
|
||||
[:fi]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Pitkäperjantai", :regions => [:fi]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pääsiäispäivä", :regions => [:fi]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "2. Pääsiäispäivä", :regions => [:fi]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Helatorstai", :regions => [:fi]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Helluntaipäivä", :regions => [:fi]},
|
||||
{:function => lambda { |year| Holidays.fi_pyhainpaiva(year) }, :function_id => "fi_pyhainpaiva(year)", :name => "Pyhäinpäivä", :regions => [:fi]}],
|
||||
1 => [{:mday => 1, :name => "Uudenvuodenpäivä", :regions => [:fi]},
|
||||
{:mday => 6, :name => "Loppiainen", :regions => [:fi]}],
|
||||
5 => [{:mday => 1, :name => "Vappu", :regions => [:fi]}],
|
||||
6 => [{:function => lambda { |year| Holidays.fi_juhannuspaiva(year) }, :function_id => "fi_juhannuspaiva(year)", :name => "Juhannuspäivä", :regions => [:fi]}],
|
||||
12 => [{:mday => 6, :name => "Itsenäisyyspäivä", :regions => [:fi]},
|
||||
{:mday => 24, :name => "Jouluaatto", :regions => [:fi]},
|
||||
{:mday => 25, :name => "Joulupäivä", :regions => [:fi]},
|
||||
{:mday => 26, :name => "Tapaninpäivä", :regions => [:fi]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
# Finland: Mid-summer (Saturday between June 20–26)
|
||||
def self.fi_juhannuspaiva(year)
|
||||
date = Date.civil(year,6,20)
|
||||
date += (6 - date.wday)
|
||||
date
|
||||
end
|
||||
|
||||
|
||||
# Finland: All Saint's Day (Saturday between Oct 31 and Nov 6)
|
||||
def self.fi_pyhainpaiva(year)
|
||||
date = Date.civil(year,10,31)
|
||||
date += (6 - date.wday)
|
||||
date
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::FI.defined_regions, Holidays::FI.holidays_by_month)
|
|
@ -1,36 +1,41 @@
|
|||
module Holidays
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/fr.yaml
|
||||
#
|
||||
# To use the definitions in this file, load them right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/fr'
|
||||
#
|
||||
# More definitions are available at http://code.dunae.ca/holidays.
|
||||
module FR # :nodoc:
|
||||
DEFINED_REGIONS = [:fr]
|
||||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:mday => 1, :name => "Fête du travail", :regions => [:fr]},
|
||||
{:mday => 8, :name => "Victoire 1945", :regions => [:fr]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pâques", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Lundi de Pâques", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Ascension", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pentecôte", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Lundi de Pentecôte", :regions => [:fr]}],
|
||||
11 => [{:mday => 1, :name => "Toussaint", :regions => [:fr]},
|
||||
{:mday => 11, :name => "Armistice 1918", :regions => [:fr]}],
|
||||
1 => [{:mday => 1, :name => "Jour de l'an", :regions => [:fr]}],
|
||||
12 => [{:mday => 25, :name => "Nöel", :regions => [:fr]}],
|
||||
7 => [{:mday => 14, :name => "Fête nationale", :regions => [:fr]}],
|
||||
8 => [{:mday => 15, :name => "Assomption", :regions => [:fr]}]
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::FR::DEFINED_REGIONS, Holidays::FR::HOLIDAYS_BY_MONTH)
|
||||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/fr.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/fr'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module FR # :nodoc:
|
||||
def self.defined_regions
|
||||
[:fr]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pâques", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Lundi de Pâques", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Ascension", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pentecôte", :regions => [:fr]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Lundi de Pentecôte", :regions => [:fr]}],
|
||||
1 => [{:mday => 1, :name => "Jour de l'an", :regions => [:fr]}],
|
||||
5 => [{:mday => 1, :name => "Fête du travail", :regions => [:fr]},
|
||||
{:mday => 8, :name => "Victoire 1945", :regions => [:fr]}],
|
||||
7 => [{:mday => 14, :name => "Fête nationale", :regions => [:fr]}],
|
||||
8 => [{:mday => 15, :name => "Assomption", :regions => [:fr]}],
|
||||
11 => [{:mday => 1, :name => "Toussaint", :regions => [:fr]},
|
||||
{:mday => 11, :name => "Armistice 1918", :regions => [:fr]}],
|
||||
12 => [{:mday => 25, :name => "Nöel", :regions => [:fr]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::FR.defined_regions, Holidays::FR.holidays_by_month)
|
||||
|
|
|
@ -1,40 +1,45 @@
|
|||
module Holidays
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/gb.yaml
|
||||
#
|
||||
# To use the definitions in this file, load them right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/gb'
|
||||
#
|
||||
# More definitions are available at http://code.dunae.ca/holidays.
|
||||
module GB # :nodoc:
|
||||
DEFINED_REGIONS = [:gb, :je, :gb_jsy, :gg, :gb_gsy, :gb_eng, :gb_wls, :gb_eaw, :gb_nir, :gb_sct, :im, :gb_iom, :gb_con]
|
||||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:wday => 1, :week => 1, :name => "May Day", :regions => [:gb]},
|
||||
{:mday => 9, :name => "Liberation Day", :regions => [:je, :gb_jsy, :gg, :gb_gsy]},
|
||||
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:gb]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Easter Sunday", :regions => [:gb]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Easter Monday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir]}],
|
||||
11 => [{:mday => 5, :type => :informal, :name => "Guy Fawkes Day", :regions => [:gb]}],
|
||||
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:gb]},
|
||||
{:mday => 2, :name => "New Year's", :regions => [:gb_sct]}],
|
||||
12 => [{:mday => 25, :observed => lambda { |date| Holidays.to_monday_if_weekend(date) }, :observed_id => "to_monday_if_weekend", :name => "Christmas Day", :regions => [:gb]},
|
||||
{:mday => 26, :observed => lambda { |date| Holidays.to_weekday_if_boxing_weekend(date) }, :observed_id => "to_weekday_if_boxing_weekend", :name => "Boxing Day", :regions => [:gb]}],
|
||||
7 => [{:mday => 5, :name => "Tynwald Day", :regions => [:im, :gb_iom]},
|
||||
{:mday => 12, :name => "Battle of the Boyne", :regions => [:gb_nir]}],
|
||||
8 => [{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:gb_sct]},
|
||||
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir]}],
|
||||
3 => [{:mday => 5, :name => "St. Piran's Day", :regions => [:gb_con]},
|
||||
{:mday => 17, :name => "St. Patrick's Day", :regions => [:gb_nir]}]
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::GB::DEFINED_REGIONS, Holidays::GB::HOLIDAYS_BY_MONTH)
|
||||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/gb.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/gb'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module GB # :nodoc:
|
||||
def self.defined_regions
|
||||
[:gb, :gb_eng, :gb_wls, :gb_eaw, :gb_nir, :gb_sct, :gb_con, :je, :gb_jsy, :gg, :gb_gsy, :im, :gb_iom]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:gb]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Easter Sunday", :regions => [:gb]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Easter Monday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir]}],
|
||||
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:gb]},
|
||||
{:mday => 2, :name => "New Year's", :regions => [:gb_sct]}],
|
||||
3 => [{:mday => 5, :name => "St. Piran's Day", :regions => [:gb_con]},
|
||||
{:mday => 17, :name => "St. Patrick's Day", :regions => [:gb_nir]}],
|
||||
5 => [{:wday => 1, :week => 1, :name => "May Day", :regions => [:gb]},
|
||||
{:mday => 9, :name => "Liberation Day", :regions => [:je, :gb_jsy, :gg, :gb_gsy]},
|
||||
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb]}],
|
||||
7 => [{:mday => 5, :name => "Tynwald Day", :regions => [:im, :gb_iom]},
|
||||
{:mday => 12, :name => "Battle of the Boyne", :regions => [:gb_nir]}],
|
||||
8 => [{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:gb_sct]},
|
||||
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir]}],
|
||||
11 => [{:mday => 5, :type => :informal, :name => "Guy Fawkes Day", :regions => [:gb]}],
|
||||
12 => [{:mday => 25, :observed => lambda { |date| Holidays.to_monday_if_weekend(date) }, :observed_id => "to_monday_if_weekend", :name => "Christmas Day", :regions => [:gb]},
|
||||
{:mday => 26, :observed => lambda { |date| Holidays.to_weekday_if_boxing_weekend(date) }, :observed_id => "to_weekday_if_boxing_weekend", :name => "Boxing Day", :regions => [:gb]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::GB.defined_regions, Holidays::GB.holidays_by_month)
|
||||
|
|
|
@ -1,32 +1,37 @@
|
|||
module Holidays
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/ie.yaml
|
||||
#
|
||||
# To use the definitions in this file, load them right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/ie'
|
||||
#
|
||||
# More definitions are available at http://code.dunae.ca/holidays.
|
||||
module IE # :nodoc:
|
||||
DEFINED_REGIONS = [:ie]
|
||||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:wday => 1, :week => 1, :name => "May Day", :regions => [:ie]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Easter Monday", :regions => [:ie]}],
|
||||
6 => [{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:ie]}],
|
||||
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:ie]}],
|
||||
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:ie]},
|
||||
{:mday => 26, :name => "St. Stephen's Day", :regions => [:ie]}],
|
||||
8 => [{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:ie]}],
|
||||
3 => [{:mday => 17, :name => "St. Patrick's Day", :regions => [:ie]}],
|
||||
10 => [{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:ie]}]
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::IE::DEFINED_REGIONS, Holidays::IE::HOLIDAYS_BY_MONTH)
|
||||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/ie.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/ie'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module IE # :nodoc:
|
||||
def self.defined_regions
|
||||
[:ie]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Easter Monday", :regions => [:ie]}],
|
||||
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:ie]}],
|
||||
3 => [{:mday => 17, :name => "St. Patrick's Day", :regions => [:ie]}],
|
||||
5 => [{:wday => 1, :week => 1, :name => "May Day", :regions => [:ie]}],
|
||||
6 => [{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:ie]}],
|
||||
8 => [{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:ie]}],
|
||||
10 => [{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:ie]}],
|
||||
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:ie]},
|
||||
{:mday => 26, :name => "St. Stephen's Day", :regions => [:ie]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::IE.defined_regions, Holidays::IE.holidays_by_month)
|
||||
|
|
|
@ -1,61 +1,66 @@
|
|||
module Holidays
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/is.yaml
|
||||
#
|
||||
# To use the definitions in this file, load them right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/is'
|
||||
#
|
||||
# More definitions are available at http://code.dunae.ca/holidays.
|
||||
module IS # :nodoc:
|
||||
DEFINED_REGIONS = [:is]
|
||||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:mday => 1, :name => "Verkalýðsdagurinn", :regions => [:is]},
|
||||
{:mday => 13, :name => "Mæðradagurinn", :regions => [:is]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-48 }, :function_id => "easter(year)-48", :name => "Bolludagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :name => "Sprengidagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-46 }, :function_id => "easter(year)-46", :name => "Öskudagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Pálmasunnudagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skírdagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Föstudaginn langi", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Páskadagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Annar í páskum", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Uppstigningardagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Hvítasunnudagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Annar í hvítasunnu", :regions => [:is]}],
|
||||
11 => [{:mday => 16, :name => "Dagur íslenskrar tungu", :regions => [:is]}],
|
||||
6 => [{:mday => 3, :type => :informal, :name => "Sjómannadagurinn", :regions => [:is]},
|
||||
{:mday => 17, :name => "Lýðveldisdagurinn", :regions => [:is]}],
|
||||
1 => [{:mday => 1, :name => "Nýársdagur", :regions => [:is]},
|
||||
{:mday => 6, :name => "Þrettándinn", :regions => [:is]},
|
||||
{:mday => 19, :type => :informal, :name => "Bóndadagur", :regions => [:is]}],
|
||||
12 => [{:mday => 24, :name => "Jól", :regions => [:is]},
|
||||
{:mday => 25, :name => "Jól", :regions => [:is]},
|
||||
{:mday => 26, :name => "Jól", :regions => [:is]},
|
||||
{:mday => 31, :name => "Gamlárskvöld", :regions => [:is]}],
|
||||
2 => [{:mday => 18, :type => :informal, :name => "Konudagur", :regions => [:is]}],
|
||||
8 => [{:wday => 1, :week => 1, :name => "Frídagur verslunarmanna", :regions => [:is]}],
|
||||
4 => [{:function => lambda { |year| Holidays.is_sumardagurinn_fyrsti(year) }, :function_id => "is_sumardagurinn_fyrsti(year)", :name => "Sumardagurinn fyrsti", :regions => [:is]}]
|
||||
}
|
||||
end
|
||||
|
||||
# Iceland: first day of summer (Thursday after 18 April)
|
||||
def self.is_sumardagurinn_fyrsti(year)
|
||||
date = Date.civil(year,4,18)
|
||||
if date.wday < 4
|
||||
date += (4 - date.wday)
|
||||
else date
|
||||
date += (11 - date.wday)
|
||||
end
|
||||
date
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::IS::DEFINED_REGIONS, Holidays::IS::HOLIDAYS_BY_MONTH)
|
||||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/is.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/is'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module IS # :nodoc:
|
||||
def self.defined_regions
|
||||
[:is]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-48 }, :function_id => "easter(year)-48", :name => "Bolludagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :name => "Sprengidagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-46 }, :function_id => "easter(year)-46", :name => "Öskudagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Pálmasunnudagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skírdagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Föstudaginn langi", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Páskadagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Annar í páskum", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Uppstigningardagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Hvítasunnudagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Annar í hvítasunnu", :regions => [:is]}],
|
||||
1 => [{:mday => 1, :name => "Nýársdagur", :regions => [:is]},
|
||||
{:mday => 6, :name => "Þrettándinn", :regions => [:is]},
|
||||
{:mday => 19, :type => :informal, :name => "Bóndadagur", :regions => [:is]}],
|
||||
2 => [{:mday => 18, :type => :informal, :name => "Konudagur", :regions => [:is]}],
|
||||
4 => [{:function => lambda { |year| Holidays.is_sumardagurinn_fyrsti(year) }, :function_id => "is_sumardagurinn_fyrsti(year)", :name => "Sumardagurinn fyrsti", :regions => [:is]}],
|
||||
5 => [{:mday => 1, :name => "Verkalýðsdagurinn", :regions => [:is]},
|
||||
{:mday => 13, :name => "Mæðradagurinn", :regions => [:is]}],
|
||||
6 => [{:mday => 3, :type => :informal, :name => "Sjómannadagurinn", :regions => [:is]},
|
||||
{:mday => 17, :name => "Lýðveldisdagurinn", :regions => [:is]}],
|
||||
8 => [{:wday => 1, :week => 1, :name => "Frídagur verslunarmanna", :regions => [:is]}],
|
||||
11 => [{:mday => 16, :name => "Dagur íslenskrar tungu", :regions => [:is]}],
|
||||
12 => [{:mday => 24, :name => "Jól", :regions => [:is]},
|
||||
{:mday => 25, :name => "Jól", :regions => [:is]},
|
||||
{:mday => 26, :name => "Jól", :regions => [:is]},
|
||||
{:mday => 31, :name => "Gamlárskvöld", :regions => [:is]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
# Iceland: first day of summer (Thursday after 18 April)
|
||||
def self.is_sumardagurinn_fyrsti(year)
|
||||
date = Date.civil(year,4,18)
|
||||
if date.wday < 4
|
||||
date += (4 - date.wday)
|
||||
else date
|
||||
date += (11 - date.wday)
|
||||
end
|
||||
date
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::IS.defined_regions, Holidays::IS.holidays_by_month)
|
||||
|
|
|
@ -1,35 +1,40 @@
|
|||
module Holidays
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/it.yaml
|
||||
#
|
||||
# To use the definitions in this file, load them right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/it'
|
||||
#
|
||||
# More definitions are available at http://code.dunae.ca/holidays.
|
||||
module IT # :nodoc:
|
||||
DEFINED_REGIONS = [:it]
|
||||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:mday => 1, :name => "Festa dei Lavoratori", :regions => [:it]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pasqua", :regions => [:it]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Lunedì dell'Angelo", :regions => [:it]}],
|
||||
11 => [{:mday => 1, :name => "Ognissanti", :regions => [:it]}],
|
||||
6 => [{:mday => 2, :name => "Festa della Repubblica", :regions => [:it]}],
|
||||
1 => [{:mday => 1, :name => "Capodanno", :regions => [:it]},
|
||||
{:mday => 6, :name => "Epifania", :regions => [:it]}],
|
||||
12 => [{:mday => 8, :name => "Immacolata Concezione", :regions => [:it]},
|
||||
{:mday => 25, :name => "Natale", :regions => [:it]},
|
||||
{:mday => 26, :name => "Santo Stefano", :regions => [:it]}],
|
||||
8 => [{:mday => 15, :name => "Assunzione", :regions => [:it]}],
|
||||
4 => [{:mday => 25, :name => "Festa della Liberazione", :regions => [:it]}]
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::IT::DEFINED_REGIONS, Holidays::IT::HOLIDAYS_BY_MONTH)
|
||||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/it.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/it'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module IT # :nodoc:
|
||||
def self.defined_regions
|
||||
[:it]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pasqua", :regions => [:it]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Lunedì dell'Angelo", :regions => [:it]}],
|
||||
1 => [{:mday => 1, :name => "Capodanno", :regions => [:it]},
|
||||
{:mday => 6, :name => "Epifania", :regions => [:it]}],
|
||||
4 => [{:mday => 25, :name => "Festa della Liberazione", :regions => [:it]}],
|
||||
5 => [{:mday => 1, :name => "Festa dei Lavoratori", :regions => [:it]}],
|
||||
6 => [{:mday => 2, :name => "Festa della Repubblica", :regions => [:it]}],
|
||||
8 => [{:mday => 15, :name => "Assunzione", :regions => [:it]}],
|
||||
11 => [{:mday => 1, :name => "Ognissanti", :regions => [:it]}],
|
||||
12 => [{:mday => 8, :name => "Immacolata Concezione", :regions => [:it]},
|
||||
{:mday => 25, :name => "Natale", :regions => [:it]},
|
||||
{:mday => 26, :name => "Santo Stefano", :regions => [:it]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::IT.defined_regions, Holidays::IT.holidays_by_month)
|
||||
|
|
|
@ -0,0 +1,113 @@
|
|||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/jp.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/jp'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module JP # :nodoc:
|
||||
def self.defined_regions
|
||||
[:jp]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
1 => [{:mday => 1, :name => "元日", :regions => [:jp]},
|
||||
{:wday => 1, :week => 2, :name => "成人の日", :regions => [:jp]}],
|
||||
2 => [{:mday => 11, :name => "建国記念日", :regions => [:jp]},
|
||||
{:function => lambda { |year| Holidays.jp_substitute_holiday(year, 2, 11) }, :function_id => "jp_substitute_holiday(year, 2, 11)", :name => "振替休日", :regions => [:jp]}],
|
||||
3 => [{:function => lambda { |year| Holidays.jp_vernal_equinox_day(year) }, :function_id => "jp_vernal_equinox_day(year)", :name => "春分の日", :regions => [:jp]},
|
||||
{:function => lambda { |year| Holidays.jp_substitute_holiday(Holidays.jp_vernal_equinox_day(year)) }, :function_id => "jp_substitute_holiday(Holidays.jp_vernal_equinox_day(year))", :name => "振替休日", :regions => [:jp]}],
|
||||
4 => [{:mday => 29, :name => "昭和の日", :regions => [:jp]},
|
||||
{:function => lambda { |year| Holidays.jp_substitute_holiday(year, 4, 29) }, :function_id => "jp_substitute_holiday(year, 4, 29)", :name => "振替休日", :regions => [:jp]}],
|
||||
5 => [{:mday => 3, :name => "憲法記念日", :regions => [:jp]},
|
||||
{:mday => 4, :name => "みどりの日", :regions => [:jp]},
|
||||
{:mday => 5, :name => "こどもの日", :regions => [:jp]},
|
||||
{:function => lambda { |year| Holidays.jp_substitute_holiday(year, 5, 3) }, :function_id => "jp_substitute_holiday(year, 5, 3)", :name => "振替休日", :regions => [:jp]},
|
||||
{:function => lambda { |year| Holidays.jp_substitute_holiday(year, 5, 5) }, :function_id => "jp_substitute_holiday(year, 5, 5)", :name => "振替休日", :regions => [:jp]}],
|
||||
7 => [{:wday => 1, :week => 3, :name => "海の日", :regions => [:jp]},
|
||||
{:function => lambda { |year| Holidays.jp_substitute_holiday(year, 7, Date.calculate_mday(year, 7, 3, 1)) }, :function_id => "jp_substitute_holiday(year, 7, Date.calculate_mday(year, 7, 3, 1))", :name => "振替休日", :regions => [:jp]}],
|
||||
9 => [{:wday => 1, :week => 3, :name => "敬老の日", :regions => [:jp]},
|
||||
{:function => lambda { |year| Holidays.jp_substitute_holiday(year, 9, Date.calculate_mday(year, 9, 3, 1)) }, :function_id => "jp_substitute_holiday(year, 9, Date.calculate_mday(year, 9, 3, 1))", :name => "振替休日", :regions => [:jp]},
|
||||
{:function => lambda { |year| Holidays.jp_citizons_holiday(year) }, :function_id => "jp_citizons_holiday(year)", :name => "国民の休日", :regions => [:jp]},
|
||||
{:function => lambda { |year| Holidays.jp_national_culture_day(year) }, :function_id => "jp_national_culture_day(year)", :name => "秋分の日", :regions => [:jp]},
|
||||
{:function => lambda { |year| Holidays.jp_substitute_holiday(Holidays.jp_national_culture_day(year)) }, :function_id => "jp_substitute_holiday(Holidays.jp_national_culture_day(year))", :name => "振替休日", :regions => [:jp]}],
|
||||
10 => [{:wday => 1, :week => 2, :name => "体育の日", :regions => [:jp]},
|
||||
{:function => lambda { |year| Holidays.jp_substitute_holiday(year, 10, Date.calculate_mday(year, 10, 2, 1)) }, :function_id => "jp_substitute_holiday(year, 10, Date.calculate_mday(year, 10, 2, 1))", :name => "振替休日", :regions => [:jp]}],
|
||||
11 => [{:mday => 3, :name => "文化の日", :regions => [:jp]},
|
||||
{:function => lambda { |year| Holidays.jp_substitute_holiday(year, 11, 3) }, :function_id => "jp_substitute_holiday(year, 11, 3)", :name => "振替休日", :regions => [:jp]},
|
||||
{:mday => 23, :name => "勤労感謝の日", :regions => [:jp]},
|
||||
{:function => lambda { |year| Holidays.jp_substitute_holiday(year, 11, 23) }, :function_id => "jp_substitute_holiday(year, 11, 23)", :name => "振替休日", :regions => [:jp]}],
|
||||
12 => [{:mday => 23, :name => "天皇誕生日", :regions => [:jp]},
|
||||
{:function => lambda { |year| Holidays.jp_substitute_holiday(year, 12, 23) }, :function_id => "jp_substitute_holiday(year, 12, 23)", :name => "振替休日", :regions => [:jp]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def self.jp_vernal_equinox_day(year)
|
||||
day =
|
||||
case year
|
||||
when 1851..1899
|
||||
19.8277
|
||||
when 1900..1979
|
||||
20.8357
|
||||
when 1980..2099
|
||||
20.8431
|
||||
when 2100..2150
|
||||
21.8510
|
||||
else
|
||||
raise IndexError.new("Out of range")
|
||||
end
|
||||
day += 0.242194 * (year - 1980) - ((year - 1980)/4).floor
|
||||
day = day.floor
|
||||
Date.civil(year, 3, day)
|
||||
end
|
||||
|
||||
|
||||
def self.jp_national_culture_day(year)
|
||||
day =
|
||||
case year
|
||||
when 1851..1899
|
||||
22.2588
|
||||
when 1900..1979
|
||||
23.2588
|
||||
when 1980..2099
|
||||
23.2488
|
||||
when 2100..2150
|
||||
24.2488
|
||||
else
|
||||
raise IndexError.new("Out of range")
|
||||
end
|
||||
day += 0.242194 * (year - 1980) - ((year - 1980)/4).floor
|
||||
day = day.floor
|
||||
Date.civil(year, 9, day)
|
||||
end
|
||||
|
||||
|
||||
def self.jp_citizons_holiday(year)
|
||||
year < 2003 and return nil
|
||||
ncd = Holidays.jp_national_culture_day(year)
|
||||
if ncd.wday == 3
|
||||
ncd - 1
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def self.jp_substitute_holiday(*date)
|
||||
date = date[0].kind_of?(Date) ? date.first : Date.civil(*date)
|
||||
date.wday == 0 ? date+1 : nil
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::JP.defined_regions, Holidays::JP.holidays_by_month)
|
|
@ -0,0 +1,48 @@
|
|||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/li.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/li'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module LI # :nodoc:
|
||||
def self.defined_regions
|
||||
[:li]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :name => "Fasnachtsdienstag", :regions => [:li]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Karfreitag", :regions => [:li]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :type => :informal, :name => "Ostern", :regions => [:li]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Ostermontag", :regions => [:li]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Auffahrt", :regions => [:li]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pfingstmontag", :regions => [:li]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+60 }, :function_id => "easter(year)+60", :name => "Fronleichnam", :regions => [:li]}],
|
||||
1 => [{:mday => 1, :name => "Neujahrstag", :regions => [:li]},
|
||||
{:mday => 6, :name => "Heilige Drei Könige", :regions => [:li]}],
|
||||
2 => [{:mday => 2, :name => "Maria Lichtmess", :regions => [:li]}],
|
||||
3 => [{:mday => 19, :name => "St. Josef", :regions => [:li]}],
|
||||
5 => [{:mday => 1, :name => "Tag der Arbeit", :regions => [:li]}],
|
||||
8 => [{:mday => 15, :name => "Staatsfeiertag", :regions => [:li]}],
|
||||
9 => [{:mday => 8, :name => "Maria Geburt", :regions => [:li]}],
|
||||
11 => [{:mday => 1, :name => "Allerheiligen", :regions => [:li]}],
|
||||
12 => [{:mday => 8, :name => "Maria Empfängnis", :regions => [:li]},
|
||||
{:mday => 24, :name => "Heilig Abend", :regions => [:li]},
|
||||
{:mday => 25, :name => "Weihnachten", :regions => [:li]},
|
||||
{:mday => 26, :name => "Stefanstag", :regions => [:li]},
|
||||
{:mday => 31, :name => "Silvester", :regions => [:li]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::LI.defined_regions, Holidays::LI.holidays_by_month)
|
|
@ -1,51 +1,56 @@
|
|||
module Holidays
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/mx.yaml, data/north_america_informal.yaml
|
||||
#
|
||||
# To use the definitions in this file, load them right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/mx'
|
||||
#
|
||||
# More definitions are available at http://code.dunae.ca/holidays.
|
||||
module MX # :nodoc:
|
||||
DEFINED_REGIONS = [:mx, :mx_pue, :us, :ca]
|
||||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:mday => 1, :name => "Día del Trabajo", :regions => [:mx]},
|
||||
{:mday => 5, :type => :informal, :name => "Cinco de Mayo", :regions => [:mx]},
|
||||
{:mday => 5, :name => "La Batalla de Puebla", :regions => [:mx_pue]},
|
||||
{:mday => 10, :type => :informal, :name => "Día de la Madre", :regions => [:mx]},
|
||||
{:mday => 15, :type => :informal, :name => "Día del Maestro", :regions => [:mx]},
|
||||
{:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
|
||||
11 => [{:mday => 1, :type => :informal, :name => "Todos los Santos", :regions => [:mx]},
|
||||
{:mday => 2, :type => :informal, :name => "Los Fieles Difuntos", :regions => [:mx]},
|
||||
{:wday => 1, :week => 3, :name => "Día de la Revolución", :regions => [:mx]}],
|
||||
6 => [{:wday => 0, :week => 3, :type => :informal, :name => "Día del Padre", :regions => [:mx]}],
|
||||
1 => [{:mday => 1, :name => "Año nuevo", :regions => [:mx]},
|
||||
{:mday => 6, :name => "Dia de los Santos Reyes", :regions => [:mx]}],
|
||||
12 => [{:mday => 12, :type => :informal, :name => "Día de la Virgen de Guadalupe", :regions => [:mx]},
|
||||
{:mday => 24, :type => :informal, :name => "Nochebuena", :regions => [:mx]},
|
||||
{:mday => 25, :name => "Navidad", :regions => [:mx]},
|
||||
{:mday => 28, :name => "Los Santos Inocentes", :regions => [:mx]}],
|
||||
2 => [{:wday => 1, :week => 1, :name => "Día de la Constitución", :regions => [:mx]},
|
||||
{:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
|
||||
{:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
|
||||
3 => [{:wday => 1, :week => 3, :name => "Natalicio de Benito Juárez", :regions => [:mx]},
|
||||
{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
|
||||
9 => [{:mday => 15, :name => "Grito de Dolores", :regions => [:mx]},
|
||||
{:mday => 16, :name => "Día de la Independencia", :regions => [:mx]}],
|
||||
4 => [{:mday => 30, :type => :informal, :name => "Día del Niño", :regions => [:mx]},
|
||||
{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
|
||||
{:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}],
|
||||
10 => [{:mday => 12, :type => :informal, :name => "Día de la Raza", :regions => [:mx]},
|
||||
{:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}]
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::MX::DEFINED_REGIONS, Holidays::MX::HOLIDAYS_BY_MONTH)
|
||||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/mx.yaml, data/north_america_informal.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/mx'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module MX # :nodoc:
|
||||
def self.defined_regions
|
||||
[:mx, :mx_pue, :us, :ca]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
1 => [{:mday => 1, :name => "Año nuevo", :regions => [:mx]},
|
||||
{:mday => 6, :name => "Dia de los Santos Reyes", :regions => [:mx]}],
|
||||
2 => [{:wday => 1, :week => 1, :name => "Día de la Constitución", :regions => [:mx]},
|
||||
{:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
|
||||
{:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
|
||||
3 => [{:wday => 1, :week => 3, :name => "Natalicio de Benito Juárez", :regions => [:mx]},
|
||||
{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
|
||||
4 => [{:mday => 30, :type => :informal, :name => "Día del Niño", :regions => [:mx]},
|
||||
{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
|
||||
{:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}],
|
||||
5 => [{:mday => 1, :name => "Día del Trabajo", :regions => [:mx]},
|
||||
{:mday => 5, :type => :informal, :name => "Cinco de Mayo", :regions => [:mx]},
|
||||
{:mday => 5, :name => "La Batalla de Puebla", :regions => [:mx_pue]},
|
||||
{:mday => 10, :type => :informal, :name => "Día de la Madre", :regions => [:mx]},
|
||||
{:mday => 15, :type => :informal, :name => "Día del Maestro", :regions => [:mx]},
|
||||
{:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
|
||||
6 => [{:wday => 0, :week => 3, :type => :informal, :name => "Día del Padre", :regions => [:mx]}],
|
||||
9 => [{:mday => 15, :name => "Grito de Dolores", :regions => [:mx]},
|
||||
{:mday => 16, :name => "Día de la Independencia", :regions => [:mx]}],
|
||||
10 => [{:mday => 12, :type => :informal, :name => "Día de la Raza", :regions => [:mx]},
|
||||
{:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}],
|
||||
11 => [{:mday => 1, :type => :informal, :name => "Todos los Santos", :regions => [:mx]},
|
||||
{:mday => 2, :type => :informal, :name => "Los Fieles Difuntos", :regions => [:mx]},
|
||||
{:wday => 1, :week => 3, :name => "Día de la Revolución", :regions => [:mx]}],
|
||||
12 => [{:mday => 12, :type => :informal, :name => "Día de la Virgen de Guadalupe", :regions => [:mx]},
|
||||
{:mday => 24, :type => :informal, :name => "Nochebuena", :regions => [:mx]},
|
||||
{:mday => 25, :name => "Navidad", :regions => [:mx]},
|
||||
{:mday => 28, :name => "Los Santos Inocentes", :regions => [:mx]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::MX.defined_regions, Holidays::MX.holidays_by_month)
|
||||
|
|
|
@ -1,36 +1,41 @@
|
|||
module Holidays
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/nl.yaml
|
||||
#
|
||||
# To use the definitions in this file, load them right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/nl'
|
||||
#
|
||||
# More definitions are available at http://code.dunae.ca/holidays.
|
||||
module NL # :nodoc:
|
||||
DEFINED_REGIONS = [:nl]
|
||||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:mday => 4, :name => "Dodenherdenking", :regions => [:nl]},
|
||||
{:mday => 5, :name => "Bevrijdingsdag", :regions => [:nl]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Goede Vrijdag", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pasen", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Pasen", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Hemelvaartsdag", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pinksteren", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pinksteren", :regions => [:nl]}],
|
||||
1 => [{:mday => 1, :name => "Nieuwjaar", :regions => [:nl]}],
|
||||
12 => [{:mday => 5, :type => :informal, :name => "Sinterklaas", :regions => [:nl]},
|
||||
{:mday => 25, :name => "Kerstmis", :regions => [:nl]},
|
||||
{:mday => 26, :name => "Kerstmis", :regions => [:nl]}],
|
||||
4 => [{:mday => 30, :name => "Koninginnedag", :regions => [:nl]}]
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::NL::DEFINED_REGIONS, Holidays::NL::HOLIDAYS_BY_MONTH)
|
||||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/nl.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/nl'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module NL # :nodoc:
|
||||
def self.defined_regions
|
||||
[:nl]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Goede Vrijdag", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pasen", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Pasen", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Hemelvaartsdag", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pinksteren", :regions => [:nl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pinksteren", :regions => [:nl]}],
|
||||
1 => [{:mday => 1, :name => "Nieuwjaar", :regions => [:nl]}],
|
||||
4 => [{:mday => 30, :name => "Koninginnedag", :regions => [:nl]}],
|
||||
5 => [{:mday => 4, :name => "Dodenherdenking", :regions => [:nl]},
|
||||
{:mday => 5, :name => "Bevrijdingsdag", :regions => [:nl]}],
|
||||
12 => [{:mday => 5, :type => :informal, :name => "Sinterklaas", :regions => [:nl]},
|
||||
{:mday => 25, :name => "Kerstmis", :regions => [:nl]},
|
||||
{:mday => 26, :name => "Kerstmis", :regions => [:nl]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::NL.defined_regions, Holidays::NL.holidays_by_month)
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/no.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/no'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module NO # :nodoc:
|
||||
def self.defined_regions
|
||||
[:no]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-49 }, :function_id => "easter(year)-49", :type => :informal, :name => "Fastelavn", :regions => [:no]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Palmesøndag", :regions => [:no]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skjærtorsdag", :regions => [:no]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Langfredag", :regions => [:no]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "1. påskedag", :regions => [:no]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "2. påskedag", :regions => [:no]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi Himmelfartsdag", :regions => [:no]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "1. pinsedag", :regions => [:no]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "2. pinsedag", :regions => [:no]}],
|
||||
1 => [{:mday => 1, :name => "Nyttårsdag", :regions => [:no]}],
|
||||
5 => [{:mday => 1, :name => "1. mai", :regions => [:no]},
|
||||
{:mday => 17, :name => "17. mai", :regions => [:no]}],
|
||||
12 => [{:mday => 24, :type => :informal, :name => "Julaften", :regions => [:no]},
|
||||
{:mday => 25, :name => "1. juledag", :regions => [:no]},
|
||||
{:mday => 26, :name => "2. juledag", :regions => [:no]},
|
||||
{:mday => 31, :type => :informal, :name => "Nyttårsaften", :regions => [:no]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::NO.defined_regions, Holidays::NO.holidays_by_month)
|
|
@ -1,107 +1,112 @@
|
|||
module Holidays
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/ca.yaml, data/mx.yaml, data/us.yaml, data/north_america_informal.yaml
|
||||
#
|
||||
# To use the definitions in this file, load them right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/north_america'
|
||||
#
|
||||
# More definitions are available at http://code.dunae.ca/holidays.
|
||||
module North_America # :nodoc:
|
||||
DEFINED_REGIONS = [:ca, :ca_qc, :ca_nf, :ca_nt, :ca_nu, :ca_ab, :ca_on, :ca_sk, :ca_mb, :ca_bc, :ca_ns, :ca_yk, :mx, :mx_pue, :us, :us_dc]
|
||||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:function => lambda { |year| Holidays.ca_victoria_day(year) }, :function_id => "ca_victoria_day(year)", :name => "Victoria Day", :regions => [:ca]},
|
||||
{:function => lambda { |year| Holidays.ca_victoria_day(year) }, :function_id => "ca_victoria_day(year)", :name => "National Patriotes Day", :regions => [:ca_qc]},
|
||||
{:mday => 1, :name => "Día del Trabajo", :regions => [:mx]},
|
||||
{:mday => 5, :type => :informal, :name => "Cinco de Mayo", :regions => [:mx]},
|
||||
{:mday => 5, :name => "La Batalla de Puebla", :regions => [:mx_pue]},
|
||||
{:mday => 10, :type => :informal, :name => "Día de la Madre", :regions => [:mx]},
|
||||
{:mday => 15, :type => :informal, :name => "Día del Maestro", :regions => [:mx]},
|
||||
{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:us]},
|
||||
{:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:ca]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :type => :informal, :name => "Easter Monday", :regions => [:ca]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :type => :informal, :name => "Good Friday", :regions => [:us]}],
|
||||
11 => [{:mday => 11, :name => "Rememberance Day", :regions => [:ca]},
|
||||
{:mday => 1, :type => :informal, :name => "Todos los Santos", :regions => [:mx]},
|
||||
{:mday => 2, :type => :informal, :name => "Los Fieles Difuntos", :regions => [:mx]},
|
||||
{:wday => 1, :week => 3, :name => "Día de la Revolución", :regions => [:mx]},
|
||||
{:mday => 11, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Veterans Day", :regions => [:us]},
|
||||
{:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:us]}],
|
||||
6 => [{:mday => 24, :name => "Discovery Day", :regions => [:ca_nf]},
|
||||
{:mday => 24, :name => "Fête Nationale", :regions => [:ca_qc]},
|
||||
{:mday => 21, :name => "National Aboriginal Day", :regions => [:ca_nt]},
|
||||
{:wday => 0, :week => 3, :type => :informal, :name => "Día del Padre", :regions => [:mx]}],
|
||||
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:ca]},
|
||||
{:mday => 2, :name => "New Year's", :regions => [:ca_qc]},
|
||||
{:mday => 1, :name => "Año nuevo", :regions => [:mx]},
|
||||
{:mday => 6, :name => "Dia de los Santos Reyes", :regions => [:mx]},
|
||||
{:mday => 1, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "New Year's Day", :regions => [:us]},
|
||||
{:wday => 1, :week => 3, :name => "Martin Luther King, Jr. Day", :regions => [:us]},
|
||||
{:function => lambda { |year| Holidays.us_inauguration_day(year) }, :function_id => "us_inauguration_day(year)", :name => "Inauguration Day", :regions => [:us_dc]}],
|
||||
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:ca]},
|
||||
{:mday => 26, :name => "Boxing Day", :regions => [:ca]},
|
||||
{:mday => 12, :type => :informal, :name => "Día de la Virgen de Guadalupe", :regions => [:mx]},
|
||||
{:mday => 24, :type => :informal, :name => "Nochebuena", :regions => [:mx]},
|
||||
{:mday => 25, :name => "Navidad", :regions => [:mx]},
|
||||
{:mday => 28, :name => "Los Santos Inocentes", :regions => [:mx]},
|
||||
{:mday => 25, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Christmas Day", :regions => [:us]}],
|
||||
7 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Canada Day", :regions => [:ca]},
|
||||
{:mday => 12, :name => "Orangemen's Day", :regions => [:ca_nf]},
|
||||
{:mday => 9, :name => "Nunavut Day", :regions => [:ca_nu]},
|
||||
{:mday => 4, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Independence Day", :regions => [:us]}],
|
||||
2 => [{:wday => 1, :week => 3, :name => "Family Day", :regions => [:ca_ab, :ca_on, :ca_sk]},
|
||||
{:wday => 1, :week => 3, :name => "Louis Riel Day", :regions => [:ca_mb]},
|
||||
{:wday => 1, :week => 1, :name => "Día de la Constitución", :regions => [:mx]},
|
||||
{:wday => 1, :week => 3, :name => "Presidents' Day", :regions => [:us]},
|
||||
{:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
|
||||
{:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
|
||||
8 => [{:wday => 1, :week => 1, :name => "BC Day", :regions => [:ca_bc]},
|
||||
{:wday => 1, :week => 1, :name => "Saskatchewan Day", :regions => [:ca_sk]},
|
||||
{:wday => 1, :week => 1, :name => "Heritage Day", :regions => [:ca_ab]},
|
||||
{:wday => 1, :week => 1, :name => "Natal Day", :regions => [:ca_ns]},
|
||||
{:wday => 1, :week => 1, :name => "Civic Holiday", :regions => [:ca_on]},
|
||||
{:wday => 1, :week => 3, :name => "Discovery Day", :regions => [:ca_yk]}],
|
||||
3 => [{:mday => 23, :name => "St. George's Day", :regions => [:ca_nf]},
|
||||
{:wday => 1, :week => 3, :name => "Natalicio de Benito Juárez", :regions => [:mx]},
|
||||
{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
|
||||
9 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:ca]},
|
||||
{:mday => 15, :name => "Grito de Dolores", :regions => [:mx]},
|
||||
{:mday => 16, :name => "Día de la Independencia", :regions => [:mx]},
|
||||
{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:us]}],
|
||||
4 => [{:mday => 30, :type => :informal, :name => "Día del Niño", :regions => [:mx]},
|
||||
{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
|
||||
{:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}],
|
||||
10 => [{:wday => 1, :week => 2, :name => "Thanksgiving", :regions => [:ca]},
|
||||
{:mday => 12, :type => :informal, :name => "Día de la Raza", :regions => [:mx]},
|
||||
{:wday => 1, :week => 2, :name => "Columbus Day", :regions => [:us]},
|
||||
{:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}]
|
||||
}
|
||||
end
|
||||
|
||||
# Monday on or before May 24
|
||||
def self.ca_victoria_day(year)
|
||||
date = Date.civil(year,5,24)
|
||||
if date.wday > 1
|
||||
date -= (date.wday - 1)
|
||||
elsif date.wday == 0
|
||||
date -= 6
|
||||
end
|
||||
date
|
||||
end
|
||||
|
||||
|
||||
# January 20, every fourth year, following Presidential election
|
||||
def self.us_inauguration_day(year)
|
||||
year % 4 == 1 ? 20 : nil
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::North_America::DEFINED_REGIONS, Holidays::North_America::HOLIDAYS_BY_MONTH)
|
||||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/ca.yaml, data/mx.yaml, data/us.yaml, data/north_america_informal.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/north_america'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module North_America # :nodoc:
|
||||
def self.defined_regions
|
||||
[:ca, :ca_qc, :ca_ab, :ca_on, :ca_sk, :ca_mb, :ca_nf, :ca_nt, :ca_nu, :ca_bc, :ca_ns, :ca_yk, :mx, :mx_pue, :us, :us_dc]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:ca]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :type => :informal, :name => "Easter Monday", :regions => [:ca]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :type => :informal, :name => "Good Friday", :regions => [:us]}],
|
||||
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:ca]},
|
||||
{:mday => 2, :name => "New Year's", :regions => [:ca_qc]},
|
||||
{:mday => 1, :name => "Año nuevo", :regions => [:mx]},
|
||||
{:mday => 6, :name => "Dia de los Santos Reyes", :regions => [:mx]},
|
||||
{:mday => 1, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "New Year's Day", :regions => [:us]},
|
||||
{:wday => 1, :week => 3, :name => "Martin Luther King, Jr. Day", :regions => [:us]},
|
||||
{:function => lambda { |year| Holidays.us_inauguration_day(year) }, :function_id => "us_inauguration_day(year)", :name => "Inauguration Day", :regions => [:us_dc]}],
|
||||
2 => [{:wday => 1, :week => 3, :name => "Family Day", :regions => [:ca_ab, :ca_on, :ca_sk]},
|
||||
{:wday => 1, :week => 3, :name => "Louis Riel Day", :regions => [:ca_mb]},
|
||||
{:wday => 1, :week => 1, :name => "Día de la Constitución", :regions => [:mx]},
|
||||
{:wday => 1, :week => 3, :name => "Presidents' Day", :regions => [:us]},
|
||||
{:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
|
||||
{:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
|
||||
3 => [{:mday => 23, :name => "St. George's Day", :regions => [:ca_nf]},
|
||||
{:wday => 1, :week => 3, :name => "Natalicio de Benito Juárez", :regions => [:mx]},
|
||||
{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
|
||||
5 => [{:function => lambda { |year| Holidays.ca_victoria_day(year) }, :function_id => "ca_victoria_day(year)", :name => "Victoria Day", :regions => [:ca]},
|
||||
{:function => lambda { |year| Holidays.ca_victoria_day(year) }, :function_id => "ca_victoria_day(year)", :name => "National Patriotes Day", :regions => [:ca_qc]},
|
||||
{:mday => 1, :name => "Día del Trabajo", :regions => [:mx]},
|
||||
{:mday => 5, :type => :informal, :name => "Cinco de Mayo", :regions => [:mx]},
|
||||
{:mday => 5, :name => "La Batalla de Puebla", :regions => [:mx_pue]},
|
||||
{:mday => 10, :type => :informal, :name => "Día de la Madre", :regions => [:mx]},
|
||||
{:mday => 15, :type => :informal, :name => "Día del Maestro", :regions => [:mx]},
|
||||
{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:us]},
|
||||
{:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
|
||||
6 => [{:mday => 24, :name => "Discovery Day", :regions => [:ca_nf]},
|
||||
{:mday => 24, :name => "Fête Nationale", :regions => [:ca_qc]},
|
||||
{:mday => 21, :name => "National Aboriginal Day", :regions => [:ca_nt]},
|
||||
{:wday => 0, :week => 3, :type => :informal, :name => "Día del Padre", :regions => [:mx]}],
|
||||
7 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Canada Day", :regions => [:ca]},
|
||||
{:mday => 12, :name => "Orangemen's Day", :regions => [:ca_nf]},
|
||||
{:mday => 9, :name => "Nunavut Day", :regions => [:ca_nu]},
|
||||
{:mday => 4, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Independence Day", :regions => [:us]}],
|
||||
8 => [{:wday => 1, :week => 1, :name => "BC Day", :regions => [:ca_bc]},
|
||||
{:wday => 1, :week => 1, :name => "Saskatchewan Day", :regions => [:ca_sk]},
|
||||
{:wday => 1, :week => 1, :name => "Heritage Day", :regions => [:ca_ab]},
|
||||
{:wday => 1, :week => 1, :name => "Natal Day", :regions => [:ca_ns]},
|
||||
{:wday => 1, :week => 1, :name => "Civic Holiday", :regions => [:ca_on]},
|
||||
{:wday => 1, :week => 3, :name => "Discovery Day", :regions => [:ca_yk]}],
|
||||
9 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:ca]},
|
||||
{:mday => 15, :name => "Grito de Dolores", :regions => [:mx]},
|
||||
{:mday => 16, :name => "Día de la Independencia", :regions => [:mx]},
|
||||
{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:us]}],
|
||||
10 => [{:wday => 1, :week => 2, :name => "Thanksgiving", :regions => [:ca]},
|
||||
{:mday => 12, :type => :informal, :name => "Día de la Raza", :regions => [:mx]},
|
||||
{:wday => 1, :week => 2, :name => "Columbus Day", :regions => [:us]},
|
||||
{:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}],
|
||||
11 => [{:mday => 11, :name => "Remembrance Day", :regions => [:ca]},
|
||||
{:mday => 1, :type => :informal, :name => "Todos los Santos", :regions => [:mx]},
|
||||
{:mday => 2, :type => :informal, :name => "Los Fieles Difuntos", :regions => [:mx]},
|
||||
{:wday => 1, :week => 3, :name => "Día de la Revolución", :regions => [:mx]},
|
||||
{:mday => 11, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Veterans Day", :regions => [:us]},
|
||||
{:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:us]}],
|
||||
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:ca]},
|
||||
{:mday => 26, :name => "Boxing Day", :regions => [:ca]},
|
||||
{:mday => 12, :type => :informal, :name => "Día de la Virgen de Guadalupe", :regions => [:mx]},
|
||||
{:mday => 24, :type => :informal, :name => "Nochebuena", :regions => [:mx]},
|
||||
{:mday => 25, :name => "Navidad", :regions => [:mx]},
|
||||
{:mday => 28, :name => "Los Santos Inocentes", :regions => [:mx]},
|
||||
{:mday => 25, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Christmas Day", :regions => [:us]}],
|
||||
4 => [{:mday => 30, :type => :informal, :name => "Día del Niño", :regions => [:mx]},
|
||||
{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
|
||||
{:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
# Monday on or before May 24
|
||||
def self.ca_victoria_day(year)
|
||||
date = Date.civil(year,5,24)
|
||||
if date.wday > 1
|
||||
date -= (date.wday - 1)
|
||||
elsif date.wday == 0
|
||||
date -= 6
|
||||
end
|
||||
date
|
||||
end
|
||||
|
||||
|
||||
# January 20, every fourth year, following Presidential election
|
||||
def self.us_inauguration_day(year)
|
||||
year % 4 == 1 ? 20 : nil
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::North_America.defined_regions, Holidays::North_America.holidays_by_month)
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/nyse.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/nyse'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module NYSE # :nodoc:
|
||||
def self.defined_regions
|
||||
[:nyse]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:nyse]}],
|
||||
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:nyse]},
|
||||
{:wday => 1, :week => 3, :name => "Martin Luther King, Jr. Day", :regions => [:nyse]}],
|
||||
2 => [{:wday => 1, :week => 3, :name => "Presidents' Day", :regions => [:nyse]}],
|
||||
5 => [{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:nyse]}],
|
||||
7 => [{:mday => 4, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Independence Day", :regions => [:nyse]}],
|
||||
9 => [{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:nyse]}],
|
||||
11 => [{:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:nyse]}],
|
||||
12 => [{:mday => 25, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Christmas Day", :regions => [:nyse]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::NYSE.defined_regions, Holidays::NYSE.holidays_by_month)
|
|
@ -0,0 +1,73 @@
|
|||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/nz.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/nz'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module NZ # :nodoc:
|
||||
def self.defined_regions
|
||||
[:nz, :nz_sl, :nz_we, :nz_ak, :nz_nl, :nz_ot, :nz_sc, :nz_hb, :nz_mb, :nz_ca, :nz_ch, :nz_wl]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:nz]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-1 }, :function_id => "easter(year)-1", :name => "Easter Saturday", :regions => [:nz]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Easter Monday", :regions => [:nz]}],
|
||||
1 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_weekend(date) }, :observed_id => "to_monday_if_weekend", :name => "New Year's Day", :regions => [:nz]},
|
||||
{:mday => 2, :observed => lambda { |date| Holidays.to_weekday_if_boxing_weekend(date) }, :observed_id => "to_weekday_if_boxing_weekend", :name => "Day after New Year's Day", :regions => [:nz]},
|
||||
{:mday => 17, :name => "Southland Anniversary Day", :regions => [:nz_sl]},
|
||||
{:mday => 22, :observed => lambda { |date| Holidays.closest_monday(date) }, :observed_id => "closest_monday", :name => "Wellington Anniversary Day", :regions => [:nz_we]},
|
||||
{:mday => 29, :observed => lambda { |date| Holidays.closest_monday(date) }, :observed_id => "closest_monday", :name => "Auckland Anniversary Day", :regions => [:nz_ak]},
|
||||
{:mday => 29, :observed => lambda { |date| Holidays.closest_monday(date) }, :observed_id => "closest_monday", :name => "Northland Anniversary Day", :regions => [:nz_nl]}],
|
||||
2 => [{:mday => 1, :observed => lambda { |date| Holidays.closest_monday(date) }, :observed_id => "closest_monday", :name => "Nelson Anniversary Day", :regions => [:nz_ak]},
|
||||
{:mday => 6, :name => "Waitangi Day", :regions => [:nz]}],
|
||||
3 => [{:mday => 23, :observed => lambda { |date| Holidays.closest_monday(date) }, :observed_id => "closest_monday", :name => "Otago Anniversary Day", :regions => [:nz_ot]},
|
||||
{:wday => 1, :week => 2, :name => "Taranaki Anniversary Day", :regions => [:nz_ak]}],
|
||||
4 => [{:mday => 25, :name => "ANZAC Day", :regions => [:nz]}],
|
||||
6 => [{:wday => 1, :week => 1, :name => "Queen's Birthday", :regions => [:nz]}],
|
||||
9 => [{:wday => 1, :week => 4, :name => "Dominion Day", :regions => [:nz_sc]}],
|
||||
10 => [{:wday => 1, :week => 1, :observed => lambda { |date| Holidays.previous_friday(date) }, :observed_id => "previous_friday", :name => "Hawke's bay Anniversary Day", :regions => [:nz_hb]},
|
||||
{:wday => 1, :week => 4, :name => "Labour Day", :regions => [:nz]},
|
||||
{:wday => 1, :week => 4, :observed => lambda { |date| Holidays.next_week(date) }, :observed_id => "next_week", :name => "Marlborough Anniversary Day", :regions => [:nz_mb]}],
|
||||
11 => [{:wday => 5, :week => 2, :name => "Canterbury Anniversary Day", :regions => [:nz_ca]},
|
||||
{:mday => 30, :observed => lambda { |date| Holidays.closest_monday(date) }, :observed_id => "closest_monday", :name => "Chatham Island Anniversary Day", :regions => [:nz_ch]}],
|
||||
12 => [{:mday => 1, :observed => lambda { |date| Holidays.closest_monday(date) }, :observed_id => "closest_monday", :name => "Westland Anniversary Day", :regions => [:nz_wl]},
|
||||
{:mday => 25, :observed => lambda { |date| Holidays.to_monday_if_weekend(date) }, :observed_id => "to_monday_if_weekend", :name => "Christmas Day", :regions => [:nz]},
|
||||
{:mday => 26, :observed => lambda { |date| Holidays.to_weekday_if_boxing_weekend(date) }, :observed_id => "to_weekday_if_boxing_weekend", :name => "Boxing Day", :regions => [:nz]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
def self.closest_monday(date)
|
||||
if [1, 2, 3, 4].include?(date.wday)
|
||||
date -= (date.wday - 1)
|
||||
elsif 0 == date.wday
|
||||
date += 1
|
||||
else
|
||||
date += 8 - date.wday
|
||||
end
|
||||
date
|
||||
end
|
||||
|
||||
|
||||
def self.previous_friday(date)
|
||||
date - 3
|
||||
end
|
||||
|
||||
|
||||
def self.next_week(date)
|
||||
date + 7
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::NZ.defined_regions, Holidays::NZ.holidays_by_month)
|
|
@ -0,0 +1,80 @@
|
|||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/pl.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/pl'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module PL # :nodoc:
|
||||
def self.defined_regions
|
||||
[:pl]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-52 }, :function_id => "easter(year)-52", :type => :informal, :name => "Tłusty Czwartek", :regions => [:pl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :type => :informal, :name => "Ostatki", :regions => [:pl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-46 }, :function_id => "easter(year)-46", :type => :informal, :name => "Środa Popielcowa", :regions => [:pl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :type => :informal, :name => "Niedziela Palmowa", :regions => [:pl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :type => :informal, :name => "Wielki Czwartek", :regions => [:pl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :type => :informal, :name => "Wielki Piątek", :regions => [:pl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-1 }, :function_id => "easter(year)-1", :type => :informal, :name => "Wielka Sobota", :regions => [:pl]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Niedziela Wielkanocna", :regions => [:pl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Poniedziałek Wielkanocny (Lany Poniedziałek)", :regions => [:pl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Zesłanie Ducha Świętego (Zielone Świątki)", :regions => [:pl]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+60 }, :function_id => "easter(year)+60", :name => "Uroczystość Najświętszego Ciała i Krwi Pańskiej (Boże Ciało)", :regions => [:pl]}],
|
||||
1 => [{:mday => 1, :name => "Nowy Rok", :regions => [:pl]},
|
||||
{:function => lambda { |year| Holidays.pl_trzech_kroli(year) }, :function_id => "pl_trzech_kroli(year)", :name => "Objawienie Pańskie (święto Trzech Króli)", :regions => [:pl]},
|
||||
{:function => lambda { |year| Holidays.pl_trzech_kroli_informal(year) }, :function_id => "pl_trzech_kroli_informal(year)", :type => :informal, :name => "Objawienie Pańskie (święto Trzech Króli)", :regions => [:pl]},
|
||||
{:mday => 21, :type => :informal, :name => "Dzień Babci", :regions => [:pl]},
|
||||
{:mday => 22, :type => :informal, :name => "Dzień Dziadka", :regions => [:pl]}],
|
||||
2 => [{:mday => 2, :type => :informal, :name => "Ofiarowanie Pańskie (Matki Boskiej Gromnicznej)", :regions => [:pl]},
|
||||
{:mday => 14, :type => :informal, :name => "Dzień Zakochanych (Walentynki)", :regions => [:pl]}],
|
||||
3 => [{:mday => 8, :type => :informal, :name => "Dzień Kobiet", :regions => [:pl]},
|
||||
{:mday => 10, :type => :informal, :name => "Dzień Mężczyzn", :regions => [:pl]}],
|
||||
4 => [{:mday => 1, :type => :informal, :name => "Prima Aprilis", :regions => [:pl]},
|
||||
{:mday => 22, :type => :informal, :name => "Międzynarodowy Dzień Ziemi", :regions => [:pl]}],
|
||||
5 => [{:mday => 1, :name => "Święto Państwowe (Święto Pracy)", :regions => [:pl]},
|
||||
{:mday => 2, :type => :informal, :name => "Dzień Flagi Rzeczpospolitej Polskiej", :regions => [:pl]},
|
||||
{:mday => 3, :name => "Święto Narodowe Trzeciego Maja", :regions => [:pl]}],
|
||||
6 => [{:mday => 23, :type => :informal, :name => "Dzień Ojca", :regions => [:pl]}],
|
||||
8 => [{:mday => 15, :name => "Wniebowzięcie Najświętszej Maryi Panny", :regions => [:pl]},
|
||||
{:mday => 15, :name => "Święto Wojska Polskiego", :regions => [:pl]}],
|
||||
9 => [{:mday => 30, :type => :informal, :name => "Dzień Chłopaka", :regions => [:pl]}],
|
||||
10 => [{:mday => 14, :type => :informal, :name => "Dzień Nauczyciela (Dzień Edukacji Narodowej)", :regions => [:pl]}],
|
||||
11 => [{:mday => 1, :name => "Wszystkich Świętych", :regions => [:pl]},
|
||||
{:mday => 2, :type => :informal, :name => "Dzień Zaduszny", :regions => [:pl]},
|
||||
{:mday => 11, :name => "Narodowe Święto Niepodległości", :regions => [:pl]},
|
||||
{:mday => 29, :type => :informal, :name => "Andrzejki", :regions => [:pl]}],
|
||||
12 => [{:mday => 4, :type => :informal, :name => "Barbórka (Dzień Górnika, Naftowca i Gazownika)", :regions => [:pl]},
|
||||
{:mday => 6, :type => :informal, :name => "Mikołajki", :regions => [:pl]},
|
||||
{:mday => 24, :type => :informal, :name => "Wigilia Bożego Narodzenia", :regions => [:pl]},
|
||||
{:mday => 25, :name => "pierwszy dzień Bożego Narodzenia", :regions => [:pl]},
|
||||
{:mday => 26, :name => "drugi dzień Bożego Narodzenia", :regions => [:pl]},
|
||||
{:mday => 31, :type => :informal, :name => "Sylwester", :regions => [:pl]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
# Poland: January 6 is holiday since 2011
|
||||
def self.pl_trzech_kroli(year)
|
||||
year >= 2011 ? 6 : nil
|
||||
end
|
||||
|
||||
|
||||
# Poland: January 6 wasn't holiday before 2011
|
||||
def self.pl_trzech_kroli_informal(year)
|
||||
year < 2011 ? 6 : nil
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::PL.defined_regions, Holidays::PL.holidays_by_month)
|
|
@ -1,52 +1,42 @@
|
|||
module Holidays
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/se.yaml
|
||||
#
|
||||
# To use the definitions in this file, load them right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/pt'
|
||||
#
|
||||
# More definitions are available at http://code.dunae.ca/holidays.
|
||||
module PT # :nodoc:
|
||||
DEFINED_REGIONS = [:se]
|
||||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:mday => 1, :name => "Första maj", :regions => [:se]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Långfredagen", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Påskdagen", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Annandag påsk", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi himmelsfärdsdag", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pingstdagen", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.se_alla_helgons_dag(year) }, :function_id => "se_alla_helgons_dag(year)", :name => "Alla helgons dag", :regions => [:se]}],
|
||||
6 => [{:mday => 6, :name => "Nationaldagen", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.se_midsommardagen(year) }, :function_id => "se_midsommardagen(year)", :name => "Midsommardagen", :regions => [:se]}],
|
||||
1 => [{:mday => 1, :name => "Nyårsdagen", :regions => [:se]},
|
||||
{:mday => 6, :name => "Trettondedag jul", :regions => [:se]}],
|
||||
12 => [{:mday => 25, :name => "Juldagen", :regions => [:se]},
|
||||
{:mday => 26, :name => "Annandag jul", :regions => [:se]}]
|
||||
}
|
||||
end
|
||||
|
||||
# Sweden: All Saint's Day (Saturday between Oct 31 and Nov 6)
|
||||
def self.se_alla_helgons_dag(year)
|
||||
date = Date.civil(year,10,31)
|
||||
date += (6 - date.wday)
|
||||
date
|
||||
end
|
||||
|
||||
|
||||
# Sweden: Mid-summer (Saturday between June 20–26)
|
||||
def self.se_midsommardagen(year)
|
||||
date = Date.civil(year,6,20)
|
||||
date += (6 - date.wday)
|
||||
date
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::PT::DEFINED_REGIONS, Holidays::PT::HOLIDAYS_BY_MONTH)
|
||||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/pt.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/pt'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module PT # :nodoc:
|
||||
def self.defined_regions
|
||||
[:pt]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :type => :informal, :name => "Carnaval", :regions => [:pt]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Sexta-feira Santa", :regions => [:pt]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Páscoa", :regions => [:pt]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+60 }, :function_id => "easter(year)+60", :name => "Corpo de Deus", :regions => [:pt]}],
|
||||
1 => [{:mday => 1, :name => "Ano Novo", :regions => [:pt]}],
|
||||
4 => [{:mday => 25, :name => "Dia da Liberdade", :regions => [:pt]}],
|
||||
5 => [{:mday => 1, :name => "Dia do Trabalhador", :regions => [:pt]}],
|
||||
6 => [{:mday => 10, :name => "Dia de Portugal", :regions => [:pt]}],
|
||||
8 => [{:mday => 15, :name => "Assunção de Nossa Senhora", :regions => [:pt]}],
|
||||
10 => [{:mday => 5, :name => "Implantação da República", :regions => [:pt]}],
|
||||
11 => [{:mday => 1, :name => "Todos os Santos", :regions => [:pt]}],
|
||||
12 => [{:mday => 1, :name => "Restauração da Independência", :regions => [:pt]},
|
||||
{:mday => 8, :name => "Imaculada Conceição", :regions => [:pt]},
|
||||
{:mday => 25, :name => "Natal", :regions => [:pt]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::PT.defined_regions, Holidays::PT.holidays_by_month)
|
||||
|
|
|
@ -1,114 +1,158 @@
|
|||
module Holidays
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/dk.yaml, data/is.yaml, data/se.yaml
|
||||
#
|
||||
# To use the definitions in this file, load them right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/scandinavia'
|
||||
#
|
||||
# More definitions are available at http://code.dunae.ca/holidays.
|
||||
module SCANDINAVIA # :nodoc:
|
||||
DEFINED_REGIONS = [:dk, :is, :se]
|
||||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:mday => 1, :name => "Arbejdernes kampdag", :regions => [:dk]},
|
||||
{:mday => 5, :type => :informal, :name => "Danmarks befrielse", :regions => [:dk]},
|
||||
{:mday => 1, :name => "Verkalýðsdagurinn", :regions => [:is]},
|
||||
{:mday => 13, :name => "Mæðradagurinn", :regions => [:is]},
|
||||
{:mday => 1, :name => "Första maj", :regions => [:se]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-49 }, :function_id => "easter(year)-49", :type => :informal, :name => "Fastelavn", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Palmesøndag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skærtorsdag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Langfredag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Påskedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "2. påskedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+26 }, :function_id => "easter(year)+26", :name => "Store Bededag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi Himmelfartsdag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pinsedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "2. Pinsedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-48 }, :function_id => "easter(year)-48", :name => "Bolludagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :name => "Sprengidagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-46 }, :function_id => "easter(year)-46", :name => "Öskudagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Pálmasunnudagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skírdagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Föstudaginn langi", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Páskadagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Annar í páskum", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Uppstigningardagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Hvítasunnudagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Annar í hvítasunnu", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Långfredagen", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Påskdagen", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Annandag påsk", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi himmelsfärdsdag", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pingstdagen", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.se_alla_helgons_dag(year) }, :function_id => "se_alla_helgons_dag(year)", :name => "Alla helgons dag", :regions => [:se]}],
|
||||
11 => [{:mday => 10, :type => :informal, :name => "Mortensaften", :regions => [:dk]},
|
||||
{:mday => 16, :name => "Dagur íslenskrar tungu", :regions => [:is]}],
|
||||
6 => [{:mday => 5, :name => "Grundlovsdag", :regions => [:dk]},
|
||||
{:mday => 15, :type => :informal, :name => "Valdemarsdag og Genforeningsdag", :regions => [:dk]},
|
||||
{:mday => 23, :type => :informal, :name => "Sankt Hans aften", :regions => [:dk]},
|
||||
{:mday => 3, :type => :informal, :name => "Sjómannadagurinn", :regions => [:is]},
|
||||
{:mday => 17, :name => "Lýðveldisdagurinn", :regions => [:is]},
|
||||
{:mday => 6, :name => "Nationaldagen", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.se_midsommardagen(year) }, :function_id => "se_midsommardagen(year)", :name => "Midsommardagen", :regions => [:se]}],
|
||||
1 => [{:mday => 1, :name => "Nytårsdag", :regions => [:dk]},
|
||||
{:mday => 1, :name => "Nýársdagur", :regions => [:is]},
|
||||
{:mday => 6, :name => "Þrettándinn", :regions => [:is]},
|
||||
{:mday => 19, :type => :informal, :name => "Bóndadagur", :regions => [:is]},
|
||||
{:mday => 1, :name => "Nyårsdagen", :regions => [:se]},
|
||||
{:mday => 6, :name => "Trettondedag jul", :regions => [:se]}],
|
||||
12 => [{:mday => 13, :type => :informal, :name => "Sankt Lucia", :regions => [:dk]},
|
||||
{:mday => 24, :name => "Juleaftensdag", :regions => [:dk]},
|
||||
{:mday => 25, :name => "1. juledag", :regions => [:dk]},
|
||||
{:mday => 26, :name => "2. juledag", :regions => [:dk]},
|
||||
{:mday => 24, :name => "Jól", :regions => [:is]},
|
||||
{:mday => 25, :name => "Jól", :regions => [:is]},
|
||||
{:mday => 26, :name => "Jól", :regions => [:is]},
|
||||
{:mday => 31, :name => "Gamlárskvöld", :regions => [:is]},
|
||||
{:mday => 25, :name => "Juldagen", :regions => [:se]},
|
||||
{:mday => 26, :name => "Annandag jul", :regions => [:se]}],
|
||||
2 => [{:mday => 18, :type => :informal, :name => "Konudagur", :regions => [:is]}],
|
||||
8 => [{:wday => 1, :week => 1, :name => "Frídagur verslunarmanna", :regions => [:is]}],
|
||||
4 => [{:mday => 1, :type => :informal, :name => "1. april", :regions => [:dk]},
|
||||
{:mday => 9, :type => :informal, :name => "Danmarks besættelse", :regions => [:dk]},
|
||||
{:mday => 16, :type => :informal, :name => "Dronningens fødselsdag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.is_sumardagurinn_fyrsti(year) }, :function_id => "is_sumardagurinn_fyrsti(year)", :name => "Sumardagurinn fyrsti", :regions => [:is]}]
|
||||
}
|
||||
end
|
||||
|
||||
# Iceland: first day of summer (Thursday after 18 April)
|
||||
def self.is_sumardagurinn_fyrsti(year)
|
||||
date = Date.civil(year,4,18)
|
||||
if date.wday < 4
|
||||
date += (4 - date.wday)
|
||||
else date
|
||||
date += (11 - date.wday)
|
||||
end
|
||||
date
|
||||
end
|
||||
|
||||
|
||||
# Sweden: All Saint's Day (Saturday between Oct 31 and Nov 6)
|
||||
def self.se_alla_helgons_dag(year)
|
||||
date = Date.civil(year,10,31)
|
||||
date += (6 - date.wday)
|
||||
date
|
||||
end
|
||||
|
||||
|
||||
# Sweden: Mid-summer (Saturday between June 20–26)
|
||||
def self.se_midsommardagen(year)
|
||||
date = Date.civil(year,6,20)
|
||||
date += (6 - date.wday)
|
||||
date
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::SCANDINAVIA::DEFINED_REGIONS, Holidays::SCANDINAVIA::HOLIDAYS_BY_MONTH)
|
||||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/dk.yaml, data/is.yaml, data/no.yaml, data/se.yaml, data/fi.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/scandinavia'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module Scandinavia # :nodoc:
|
||||
def self.defined_regions
|
||||
[:dk, :no, :is, :se, :fi]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-49 }, :function_id => "easter(year)-49", :type => :informal, :name => "Fastelavn", :regions => [:dk, :no]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Palmesøndag", :regions => [:dk, :no]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skærtorsdag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Langfredag", :regions => [:dk, :no]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Påskedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "2. påskedag", :regions => [:dk, :no]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+26 }, :function_id => "easter(year)+26", :name => "Store Bededag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi Himmelfartsdag", :regions => [:dk, :no]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pinsedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "2. Pinsedag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-48 }, :function_id => "easter(year)-48", :name => "Bolludagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :name => "Sprengidagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-46 }, :function_id => "easter(year)-46", :name => "Öskudagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Pálmasunnudagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skírdagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Föstudaginn langi", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Páskadagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Annar í páskum", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Uppstigningardagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Hvítasunnudagur", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Annar í hvítasunnu", :regions => [:is]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skjærtorsdag", :regions => [:no]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "1. påskedag", :regions => [:no]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "1. pinsedag", :regions => [:no]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "2. pinsedag", :regions => [:no]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Långfredagen", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Påskdagen", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Annandag påsk", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi himmelsfärdsdag", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pingstdagen", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.se_alla_helgons_dag(year) }, :function_id => "se_alla_helgons_dag(year)", :name => "Alla helgons dag", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Pitkäperjantai", :regions => [:fi]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pääsiäispäivä", :regions => [:fi]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "2. Pääsiäispäivä", :regions => [:fi]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Helatorstai", :regions => [:fi]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Helluntaipäivä", :regions => [:fi]},
|
||||
{:function => lambda { |year| Holidays.fi_pyhainpaiva(year) }, :function_id => "fi_pyhainpaiva(year)", :name => "Pyhäinpäivä", :regions => [:fi]}],
|
||||
1 => [{:mday => 1, :name => "Nytårsdag", :regions => [:dk]},
|
||||
{:mday => 1, :name => "Nýársdagur", :regions => [:is]},
|
||||
{:mday => 6, :name => "Þrettándinn", :regions => [:is]},
|
||||
{:mday => 19, :type => :informal, :name => "Bóndadagur", :regions => [:is]},
|
||||
{:mday => 1, :name => "Nyttårsdag", :regions => [:no]},
|
||||
{:mday => 1, :name => "Nyårsdagen", :regions => [:se]},
|
||||
{:mday => 6, :name => "Trettondedag jul", :regions => [:se]},
|
||||
{:mday => 1, :name => "Uudenvuodenpäivä", :regions => [:fi]},
|
||||
{:mday => 6, :name => "Loppiainen", :regions => [:fi]}],
|
||||
4 => [{:mday => 1, :type => :informal, :name => "1. april", :regions => [:dk]},
|
||||
{:mday => 9, :type => :informal, :name => "Danmarks besættelse", :regions => [:dk]},
|
||||
{:mday => 16, :type => :informal, :name => "Dronningens fødselsdag", :regions => [:dk]},
|
||||
{:function => lambda { |year| Holidays.is_sumardagurinn_fyrsti(year) }, :function_id => "is_sumardagurinn_fyrsti(year)", :name => "Sumardagurinn fyrsti", :regions => [:is]}],
|
||||
5 => [{:mday => 1, :name => "Arbejdernes kampdag", :regions => [:dk]},
|
||||
{:mday => 5, :type => :informal, :name => "Danmarks befrielse", :regions => [:dk]},
|
||||
{:mday => 1, :name => "Verkalýðsdagurinn", :regions => [:is]},
|
||||
{:mday => 13, :name => "Mæðradagurinn", :regions => [:is]},
|
||||
{:mday => 1, :name => "1. mai", :regions => [:no]},
|
||||
{:mday => 17, :name => "17. mai", :regions => [:no]},
|
||||
{:mday => 1, :name => "Första maj", :regions => [:se]},
|
||||
{:mday => 1, :name => "Vappu", :regions => [:fi]}],
|
||||
6 => [{:mday => 5, :name => "Grundlovsdag", :regions => [:dk]},
|
||||
{:mday => 15, :type => :informal, :name => "Valdemarsdag og Genforeningsdag", :regions => [:dk]},
|
||||
{:mday => 23, :type => :informal, :name => "Sankt Hans aften", :regions => [:dk]},
|
||||
{:mday => 3, :type => :informal, :name => "Sjómannadagurinn", :regions => [:is]},
|
||||
{:mday => 17, :name => "Lýðveldisdagurinn", :regions => [:is]},
|
||||
{:mday => 6, :name => "Nationaldagen", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.se_midsommardagen(year) }, :function_id => "se_midsommardagen(year)", :name => "Midsommardagen", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.fi_juhannuspaiva(year) }, :function_id => "fi_juhannuspaiva(year)", :name => "Juhannuspäivä", :regions => [:fi]}],
|
||||
11 => [{:mday => 10, :type => :informal, :name => "Mortensaften", :regions => [:dk]},
|
||||
{:mday => 16, :name => "Dagur íslenskrar tungu", :regions => [:is]}],
|
||||
12 => [{:mday => 13, :type => :informal, :name => "Sankt Lucia", :regions => [:dk]},
|
||||
{:mday => 24, :name => "Juleaftensdag", :regions => [:dk]},
|
||||
{:mday => 25, :name => "1. juledag", :regions => [:dk, :no]},
|
||||
{:mday => 26, :name => "2. juledag", :regions => [:dk, :no]},
|
||||
{:mday => 24, :name => "Jól", :regions => [:is]},
|
||||
{:mday => 25, :name => "Jól", :regions => [:is]},
|
||||
{:mday => 26, :name => "Jól", :regions => [:is]},
|
||||
{:mday => 31, :name => "Gamlárskvöld", :regions => [:is]},
|
||||
{:mday => 24, :type => :informal, :name => "Julaften", :regions => [:no]},
|
||||
{:mday => 31, :type => :informal, :name => "Nyttårsaften", :regions => [:no]},
|
||||
{:mday => 25, :name => "Juldagen", :regions => [:se]},
|
||||
{:mday => 26, :name => "Annandag jul", :regions => [:se]},
|
||||
{:mday => 6, :name => "Itsenäisyyspäivä", :regions => [:fi]},
|
||||
{:mday => 24, :name => "Jouluaatto", :regions => [:fi]},
|
||||
{:mday => 25, :name => "Joulupäivä", :regions => [:fi]},
|
||||
{:mday => 26, :name => "Tapaninpäivä", :regions => [:fi]}],
|
||||
2 => [{:mday => 18, :type => :informal, :name => "Konudagur", :regions => [:is]}],
|
||||
8 => [{:wday => 1, :week => 1, :name => "Frídagur verslunarmanna", :regions => [:is]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
# Iceland: first day of summer (Thursday after 18 April)
|
||||
def self.is_sumardagurinn_fyrsti(year)
|
||||
date = Date.civil(year,4,18)
|
||||
if date.wday < 4
|
||||
date += (4 - date.wday)
|
||||
else date
|
||||
date += (11 - date.wday)
|
||||
end
|
||||
date
|
||||
end
|
||||
|
||||
|
||||
# Sweden: Mid-summer (Saturday between June 20–26)
|
||||
def self.se_midsommardagen(year)
|
||||
date = Date.civil(year,6,20)
|
||||
date += (6 - date.wday)
|
||||
date
|
||||
end
|
||||
|
||||
|
||||
# Sweden: All Saint's Day (Saturday between Oct 31 and Nov 6)
|
||||
def self.se_alla_helgons_dag(year)
|
||||
date = Date.civil(year,10,31)
|
||||
date += (6 - date.wday)
|
||||
date
|
||||
end
|
||||
|
||||
|
||||
# Finland: Mid-summer (Saturday between June 20–26)
|
||||
def self.fi_juhannuspaiva(year)
|
||||
date = Date.civil(year,6,20)
|
||||
date += (6 - date.wday)
|
||||
date
|
||||
end
|
||||
|
||||
|
||||
# Finland: All Saint's Day (Saturday between Oct 31 and Nov 6)
|
||||
def self.fi_pyhainpaiva(year)
|
||||
date = Date.civil(year,10,31)
|
||||
date += (6 - date.wday)
|
||||
date
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::Scandinavia.defined_regions, Holidays::Scandinavia.holidays_by_month)
|
||||
|
|
|
@ -1,52 +1,57 @@
|
|||
module Holidays
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/se.yaml
|
||||
#
|
||||
# To use the definitions in this file, load them right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/se'
|
||||
#
|
||||
# More definitions are available at http://code.dunae.ca/holidays.
|
||||
module SE # :nodoc:
|
||||
DEFINED_REGIONS = [:se]
|
||||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:mday => 1, :name => "Första maj", :regions => [:se]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Långfredagen", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Påskdagen", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Annandag påsk", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi himmelsfärdsdag", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pingstdagen", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.se_alla_helgons_dag(year) }, :function_id => "se_alla_helgons_dag(year)", :name => "Alla helgons dag", :regions => [:se]}],
|
||||
6 => [{:mday => 6, :name => "Nationaldagen", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.se_midsommardagen(year) }, :function_id => "se_midsommardagen(year)", :name => "Midsommardagen", :regions => [:se]}],
|
||||
1 => [{:mday => 1, :name => "Nyårsdagen", :regions => [:se]},
|
||||
{:mday => 6, :name => "Trettondedag jul", :regions => [:se]}],
|
||||
12 => [{:mday => 25, :name => "Juldagen", :regions => [:se]},
|
||||
{:mday => 26, :name => "Annandag jul", :regions => [:se]}]
|
||||
}
|
||||
end
|
||||
|
||||
# Sweden: All Saint's Day (Saturday between Oct 31 and Nov 6)
|
||||
def self.se_alla_helgons_dag(year)
|
||||
date = Date.civil(year,10,31)
|
||||
date += (6 - date.wday)
|
||||
date
|
||||
end
|
||||
|
||||
|
||||
# Sweden: Mid-summer (Saturday between June 20–26)
|
||||
def self.se_midsommardagen(year)
|
||||
date = Date.civil(year,6,20)
|
||||
date += (6 - date.wday)
|
||||
date
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::SE::DEFINED_REGIONS, Holidays::SE::HOLIDAYS_BY_MONTH)
|
||||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/se.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/se'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module SE # :nodoc:
|
||||
def self.defined_regions
|
||||
[:se]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Långfredagen", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Påskdagen", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Annandag påsk", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi himmelsfärdsdag", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pingstdagen", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.se_alla_helgons_dag(year) }, :function_id => "se_alla_helgons_dag(year)", :name => "Alla helgons dag", :regions => [:se]}],
|
||||
1 => [{:mday => 1, :name => "Nyårsdagen", :regions => [:se]},
|
||||
{:mday => 6, :name => "Trettondedag jul", :regions => [:se]}],
|
||||
5 => [{:mday => 1, :name => "Första maj", :regions => [:se]}],
|
||||
6 => [{:mday => 6, :name => "Nationaldagen", :regions => [:se]},
|
||||
{:function => lambda { |year| Holidays.se_midsommardagen(year) }, :function_id => "se_midsommardagen(year)", :name => "Midsommardagen", :regions => [:se]}],
|
||||
12 => [{:mday => 25, :name => "Juldagen", :regions => [:se]},
|
||||
{:mday => 26, :name => "Annandag jul", :regions => [:se]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
# Sweden: Mid-summer (Saturday between June 20–26)
|
||||
def self.se_midsommardagen(year)
|
||||
date = Date.civil(year,6,20)
|
||||
date += (6 - date.wday)
|
||||
date
|
||||
end
|
||||
|
||||
|
||||
# Sweden: All Saint's Day (Saturday between Oct 31 and Nov 6)
|
||||
def self.se_alla_helgons_dag(year)
|
||||
date = Date.civil(year,10,31)
|
||||
date += (6 - date.wday)
|
||||
date
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::SE.defined_regions, Holidays::SE.holidays_by_month)
|
||||
|
|
|
@ -1,24 +1,85 @@
|
|||
module Holidays
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/united_nations.yaml
|
||||
#
|
||||
# To use the definitions in this file, load them right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/united_nations'
|
||||
#
|
||||
# More definitions are available at http://code.dunae.ca/holidays.
|
||||
module United_Nations # :nodoc:
|
||||
DEFINED_REGIONS = [:]
|
||||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::United_Nations::DEFINED_REGIONS, Holidays::United_Nations::HOLIDAYS_BY_MONTH)
|
||||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/united_nations.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/united_nations'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module United_Nations # :nodoc:
|
||||
def self.defined_regions
|
||||
[:united_nations]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
2 => [{:mday => 2, :name => "International Mother Language Day", :regions => [:united_nations]}],
|
||||
3 => [{:mday => 8, :name => "United Nations Day for Women's Rights and International Peace", :regions => [:united_nations]},
|
||||
{:mday => 21, :name => "International Day for the Elimination of Racial Discrimination", :regions => [:united_nations]},
|
||||
{:mday => 21, :name => "Beginning of the Week of Solidarity with the Peoples Struggling against Racism and Racial Discrimination", :regions => [:united_nations]},
|
||||
{:mday => 22, :name => "World Day for Water", :regions => [:united_nations]},
|
||||
{:mday => 23, :name => "World Meteorological Day", :regions => [:united_nations]}],
|
||||
4 => [{:mday => 7, :name => "World Health Day", :regions => [:united_nations]},
|
||||
{:mday => 23, :name => "World Book and Copyright Day", :regions => [:united_nations]}],
|
||||
5 => [{:mday => 3, :name => "World Press Freedom Day", :regions => [:united_nations]},
|
||||
{:mday => 15, :name => "International Day of Families", :regions => [:united_nations]},
|
||||
{:mday => 17, :name => "World Telecommunication Day", :regions => [:united_nations]},
|
||||
{:mday => 21, :name => "World Day for Cultural Diversity for Dialogue and Development", :regions => [:united_nations]},
|
||||
{:mday => 22, :name => "International Day for Biological Diversity", :regions => [:united_nations]},
|
||||
{:mday => 25, :name => "Beginning of the Week of Solidarity with the Peoples of Non-Self-Governing Territories", :regions => [:united_nations]},
|
||||
{:mday => 29, :name => "International Day of United Nations Peacekeepers", :regions => [:united_nations]},
|
||||
{:mday => 31, :name => "World No-Tobacco Day", :regions => [:united_nations]}],
|
||||
6 => [{:mday => 4, :name => "International Day of Innocent Children Victims of Aggression", :regions => [:united_nations]},
|
||||
{:mday => 5, :name => "World Environment Day", :regions => [:united_nations]},
|
||||
{:mday => 17, :name => "World Day to Combat Desertification and Drought", :regions => [:united_nations]},
|
||||
{:mday => 20, :name => "World Refugee Day", :regions => [:united_nations]},
|
||||
{:mday => 23, :name => "United Nations Public Service Day", :regions => [:united_nations]},
|
||||
{:mday => 26, :name => "International Day against Drug Abuse and Illicit Trafficking", :regions => [:united_nations]},
|
||||
{:mday => 26, :name => "International Day in Support of Victims of Torture", :regions => [:united_nations]}],
|
||||
7 => [{:wday => 6, :week => 1, :name => "International Day of Cooperatives", :regions => [:united_nations]},
|
||||
{:mday => 11, :name => "World Population Day", :regions => [:united_nations]}],
|
||||
8 => [{:mday => 9, :name => "International Day of the World's Indigenous People", :regions => [:united_nations]},
|
||||
{:mday => 12, :name => "International Youth Day", :regions => [:united_nations]},
|
||||
{:mday => 23, :name => "International Day for the Remembrance of the Slave Trade and Its Abolition", :regions => [:united_nations]}],
|
||||
9 => [{:mday => 8, :name => "International Literacy Day", :regions => [:united_nations]},
|
||||
{:mday => 16, :name => "International Day for the Preservation of the Ozone Layer", :regions => [:united_nations]},
|
||||
{:mday => 21, :name => "International Day of Peace", :regions => [:united_nations]},
|
||||
{:mday => 1, :name => "International Day of Older Persons", :regions => [:united_nations]}],
|
||||
10 => [{:mday => 4, :name => "World Space Week", :regions => [:united_nations]},
|
||||
{:mday => 5, :name => "World Teachers' Day", :regions => [:united_nations]},
|
||||
{:wday => 1, :week => 1, :name => "World Habitat Day", :regions => [:united_nations]},
|
||||
{:wday => 3, :week => 2, :name => "International Day for Natural Disaster Reduction", :regions => [:united_nations]},
|
||||
{:mday => 9, :name => "World Post Day", :regions => [:united_nations]},
|
||||
{:mday => 10, :name => "World Mental Health Day", :regions => [:united_nations]},
|
||||
{:mday => 16, :name => "World Food Day", :regions => [:united_nations]},
|
||||
{:mday => 17, :name => "International Day for the Eradication of Poverty", :regions => [:united_nations]},
|
||||
{:mday => 24, :name => "United Nations Day", :regions => [:united_nations]},
|
||||
{:mday => 24, :name => "World Development Information Day", :regions => [:united_nations]},
|
||||
{:mday => 24, :name => "Disarmament Week", :regions => [:united_nations]}],
|
||||
11 => [{:mday => 6, :name => "International Day for Preventing the Exploitation of the Environment in War and Armed Conflict", :regions => [:united_nations]},
|
||||
{:mday => 16, :name => "International Day for Tolerance", :regions => [:united_nations]},
|
||||
{:mday => 20, :name => "Africa Industrialization Day", :regions => [:united_nations]},
|
||||
{:mday => 20, :name => "Universal Children's Day", :regions => [:united_nations]},
|
||||
{:mday => 21, :name => "World Television Day", :regions => [:united_nations]},
|
||||
{:mday => 25, :name => "International Day for the Elimination of Violence against Women", :regions => [:united_nations]},
|
||||
{:mday => 29, :name => "International Day of Solidarity with the Palestinian People", :regions => [:united_nations]}],
|
||||
12 => [{:mday => 1, :name => "World AIDS Day", :regions => [:united_nations]},
|
||||
{:mday => 2, :name => "International Day for the Abolition of Slavery", :regions => [:united_nations]},
|
||||
{:mday => 3, :name => "International Day of Disabled Persons", :regions => [:united_nations]},
|
||||
{:mday => 5, :name => "International Volunteer Day for Economic and Social Development", :regions => [:united_nations]},
|
||||
{:mday => 7, :name => "International Civil Aviation Day", :regions => [:united_nations]},
|
||||
{:mday => 10, :name => "Human Rights Day", :regions => [:united_nations]},
|
||||
{:mday => 18, :name => "International Migrants Day", :regions => [:united_nations]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::United_Nations.defined_regions, Holidays::United_Nations.holidays_by_month)
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/ups.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/ups'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module UPS # :nodoc:
|
||||
def self.defined_regions
|
||||
[:ups]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
1 => [{:mday => 1, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "New Year's Day", :regions => [:ups]}],
|
||||
5 => [{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:ups]}],
|
||||
7 => [{:mday => 4, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Independence Day", :regions => [:ups]}],
|
||||
9 => [{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:ups]}],
|
||||
11 => [{:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:ups]},
|
||||
{:wday => 5, :week => 4, :name => "Day After Thanksgiving", :regions => [:ups]}],
|
||||
12 => [{:mday => 25, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Christmas Day", :regions => [:ups]},
|
||||
{:mday => 31, :name => "New Year's Eve", :regions => [:ups]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::UPS.defined_regions, Holidays::UPS.holidays_by_month)
|
|
@ -1,48 +1,53 @@
|
|||
module Holidays
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/us.yaml, data/north_america_informal.yaml
|
||||
#
|
||||
# To use the definitions in this file, load them right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/us'
|
||||
#
|
||||
# More definitions are available at http://code.dunae.ca/holidays.
|
||||
module US # :nodoc:
|
||||
DEFINED_REGIONS = [:us, :us_dc, :ca]
|
||||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:us]},
|
||||
{:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :type => :informal, :name => "Good Friday", :regions => [:us]}],
|
||||
11 => [{:mday => 11, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Veterans Day", :regions => [:us]},
|
||||
{:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:us]}],
|
||||
1 => [{:mday => 1, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "New Year's Day", :regions => [:us]},
|
||||
{:wday => 1, :week => 3, :name => "Martin Luther King, Jr. Day", :regions => [:us]},
|
||||
{:function => lambda { |year| Holidays.us_inauguration_day(year) }, :function_id => "us_inauguration_day(year)", :name => "Inauguration Day", :regions => [:us_dc]}],
|
||||
12 => [{:mday => 25, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Christmas Day", :regions => [:us]}],
|
||||
7 => [{:mday => 4, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Independence Day", :regions => [:us]}],
|
||||
2 => [{:wday => 1, :week => 3, :name => "Presidents' Day", :regions => [:us]},
|
||||
{:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
|
||||
{:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
|
||||
3 => [{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
|
||||
9 => [{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:us]}],
|
||||
4 => [{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
|
||||
{:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}],
|
||||
10 => [{:wday => 1, :week => 2, :name => "Columbus Day", :regions => [:us]},
|
||||
{:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}]
|
||||
}
|
||||
end
|
||||
|
||||
# January 20, every fourth year, following Presidential election
|
||||
def self.us_inauguration_day(year)
|
||||
year % 4 == 1 ? 20 : nil
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::US::DEFINED_REGIONS, Holidays::US::HOLIDAYS_BY_MONTH)
|
||||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/us.yaml, data/north_america_informal.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/us'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module US # :nodoc:
|
||||
def self.defined_regions
|
||||
[:us, :us_dc, :ca]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :type => :informal, :name => "Good Friday", :regions => [:us]}],
|
||||
1 => [{:mday => 1, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "New Year's Day", :regions => [:us]},
|
||||
{:wday => 1, :week => 3, :name => "Martin Luther King, Jr. Day", :regions => [:us]},
|
||||
{:function => lambda { |year| Holidays.us_inauguration_day(year) }, :function_id => "us_inauguration_day(year)", :name => "Inauguration Day", :regions => [:us_dc]}],
|
||||
2 => [{:wday => 1, :week => 3, :name => "Presidents' Day", :regions => [:us]},
|
||||
{:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
|
||||
{:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
|
||||
5 => [{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:us]},
|
||||
{:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
|
||||
7 => [{:mday => 4, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Independence Day", :regions => [:us]}],
|
||||
9 => [{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:us]}],
|
||||
10 => [{:wday => 1, :week => 2, :name => "Columbus Day", :regions => [:us]},
|
||||
{:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}],
|
||||
11 => [{:mday => 11, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Veterans Day", :regions => [:us]},
|
||||
{:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:us]}],
|
||||
12 => [{:mday => 25, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Christmas Day", :regions => [:us]}],
|
||||
3 => [{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
|
||||
4 => [{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
|
||||
{:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
# January 20, every fourth year, following Presidential election
|
||||
def self.us_inauguration_day(year)
|
||||
year % 4 == 1 ? 20 : nil
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::US.defined_regions, Holidays::US.holidays_by_month)
|
||||
|
|
|
@ -1,35 +1,40 @@
|
|||
module Holidays
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/za.yaml
|
||||
#
|
||||
# To use the definitions in this file, load them right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/za'
|
||||
#
|
||||
# More definitions are available at http://code.dunae.ca/holidays.
|
||||
module ZA # :nodoc:
|
||||
DEFINED_REGIONS = [:za]
|
||||
|
||||
HOLIDAYS_BY_MONTH = {
|
||||
5 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Workers Day", :regions => [:za]}],
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:za]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Family Day", :regions => [:za]}],
|
||||
6 => [{:mday => 16, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Youth Day", :regions => [:za]}],
|
||||
1 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "New Year's Day", :regions => [:za]}],
|
||||
12 => [{:mday => 16, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Day of Reconciliation", :regions => [:za]},
|
||||
{:mday => 25, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Christmas Day", :regions => [:za]},
|
||||
{:mday => 26, :observed => lambda { |date| Holidays.to_weekday_if_boxing_weekend(date) }, :observed_id => "to_weekday_if_boxing_weekend", :name => "Day of Goodwill", :regions => [:za]}],
|
||||
8 => [{:mday => 9, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "National Women's Day", :regions => [:za]}],
|
||||
3 => [{:mday => 21, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Human Rights Day", :regions => [:za]}],
|
||||
9 => [{:mday => 24, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Heritage Day", :regions => [:za]}],
|
||||
4 => [{:mday => 27, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Freedom Day", :regions => [:za]}]
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::ZA::DEFINED_REGIONS, Holidays::ZA::HOLIDAYS_BY_MONTH)
|
||||
# encoding: utf-8
|
||||
module Holidays
|
||||
# This file is generated by the Ruby Holidays gem.
|
||||
#
|
||||
# Definitions loaded: data/za.yaml
|
||||
#
|
||||
# To use the definitions in this file, load it right after you load the
|
||||
# Holiday gem:
|
||||
#
|
||||
# require 'holidays'
|
||||
# require 'holidays/za'
|
||||
#
|
||||
# All the definitions are available at https://github.com/alexdunae/holidays
|
||||
module ZA # :nodoc:
|
||||
def self.defined_regions
|
||||
[:za]
|
||||
end
|
||||
|
||||
def self.holidays_by_month
|
||||
{
|
||||
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:za]},
|
||||
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Family Day", :regions => [:za]}],
|
||||
1 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "New Year's Day", :regions => [:za]}],
|
||||
3 => [{:mday => 21, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Human Rights Day", :regions => [:za]}],
|
||||
4 => [{:mday => 27, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Freedom Day", :regions => [:za]}],
|
||||
5 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Workers Day", :regions => [:za]}],
|
||||
6 => [{:mday => 16, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Youth Day", :regions => [:za]}],
|
||||
8 => [{:mday => 9, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "National Women's Day", :regions => [:za]}],
|
||||
9 => [{:mday => 24, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Heritage Day", :regions => [:za]}],
|
||||
12 => [{:mday => 16, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Day of Reconciliation", :regions => [:za]},
|
||||
{:mday => 25, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Christmas Day", :regions => [:za]},
|
||||
{:mday => 26, :observed => lambda { |date| Holidays.to_weekday_if_boxing_weekend(date) }, :observed_id => "to_weekday_if_boxing_weekend", :name => "Day of Goodwill", :regions => [:za]}]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
Holidays.merge_defs(Holidays::ZA.defined_regions, Holidays::ZA.holidays_by_month)
|
||||
|
|
220
rakefile.rb
220
rakefile.rb
|
@ -1,113 +1,107 @@
|
|||
require 'rake'
|
||||
require 'rake/testtask'
|
||||
require 'rake/rdoctask'
|
||||
require 'rake/gempackagetask'
|
||||
require 'yaml'
|
||||
require 'fileutils'
|
||||
require 'lib/holidays'
|
||||
require 'data/build_defs'
|
||||
|
||||
desc 'Run all tests'
|
||||
task :test => ["test:lib", "test:defs"]
|
||||
|
||||
namespace :test do
|
||||
desc 'Run the unit tests.'
|
||||
Rake::TestTask.new(:lib) do |t|
|
||||
t.libs << 'lib'
|
||||
t.test_files = FileList['test/defs/test*.rb'].exclude('test_helper.rb')
|
||||
t.verbose = false
|
||||
end
|
||||
|
||||
desc 'Run the definition tests.'
|
||||
Rake::TestTask.new(:defs) do |t|
|
||||
t.libs << 'lib'
|
||||
t.test_files = FileList['test/test*.rb'].exclude('test_helper.rb')
|
||||
t.verbose = false
|
||||
end
|
||||
end
|
||||
|
||||
task :doc => ["defs:manifest", :rdoc]
|
||||
|
||||
desc 'Generate documentation.'
|
||||
Rake::RDocTask.new(:rdoc) do |rdoc|
|
||||
rdoc.rdoc_dir = 'doc'
|
||||
rdoc.title = 'Ruby Holidays Gem'
|
||||
rdoc.options << '--all' << '--inline-source' << '--line-numbers'
|
||||
rdoc.options << '--charset' << 'utf-8'
|
||||
#rdoc.template = 'extras/rdoc_template.rb'
|
||||
rdoc.rdoc_files.include('README')
|
||||
rdoc.rdoc_files.include('data/SYNTAX')
|
||||
rdoc.rdoc_files.include('lib/holidays/MANIFEST')
|
||||
rdoc.rdoc_files.include('REFERENCES')
|
||||
rdoc.rdoc_files.include('CHANGELOG')
|
||||
rdoc.rdoc_files.include('LICENSE')
|
||||
rdoc.rdoc_files.include('lib/*.rb')
|
||||
end
|
||||
|
||||
spec = Gem::Specification.new do |s|
|
||||
s.name = 'holidays'
|
||||
s.version = '0.9.0'
|
||||
s.author = 'Alex Dunae'
|
||||
s.homepage = 'http://code.dunae.ca/holidays'
|
||||
s.platform = Gem::Platform::RUBY
|
||||
s.description = <<-EOF
|
||||
A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!
|
||||
EOF
|
||||
s.summary = 'A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!'
|
||||
s.files = FileList["{lib}/**/*", "{data}/**/*"].to_a
|
||||
s.test_files = FileList['test/defs/test*.rb'].exclude('test_helper.rb')
|
||||
s.has_rdoc = true
|
||||
s.extra_rdoc_files = ['README', 'data/SYNTAX', 'lib/holidays/MANIFEST', 'REFERENCES', 'CHANGELOG', 'LICENSE']
|
||||
s.rdoc_options << '--all' << '--inline-source' << '--line-numbers' << '--charset' << 'utf-8'
|
||||
end
|
||||
|
||||
desc 'Build the gem.'
|
||||
Rake::GemPackageTask.new(spec) do |pkg|
|
||||
pkg.need_zip = true
|
||||
pkg.need_tar = true
|
||||
end
|
||||
|
||||
desc 'Definition file tasks'
|
||||
namespace :defs do
|
||||
DATA_PATH = 'data'
|
||||
|
||||
desc 'Build holiday definition files'
|
||||
task :build_all do
|
||||
# load the index
|
||||
def_index = YAML.load_file("#{DATA_PATH}/index.yaml")
|
||||
|
||||
# create a dir for the generated tests
|
||||
FileUtils.mkdir_p('test/defs')
|
||||
|
||||
def_index['defs'].each do |region, files|
|
||||
puts "Building #{region} definition module:"
|
||||
files = files.collect { |f| "#{DATA_PATH}/#{f}" }
|
||||
files.uniq!
|
||||
|
||||
module_src, test_src = parse_holiday_defs(region, files)
|
||||
File.open("lib/holidays/#{region.to_s}.rb","w") do |file|
|
||||
file.puts module_src
|
||||
end
|
||||
unless test_src.empty?
|
||||
File.open("test/defs/test_defs_#{region.to_s}.rb","w") do |file|
|
||||
file.puts test_src
|
||||
end
|
||||
end
|
||||
puts "Done.\n\n"
|
||||
end
|
||||
end
|
||||
|
||||
desc 'Build the definition manifest.'
|
||||
task :manifest do
|
||||
File.open("lib/holidays/MANIFEST","w") do |file|
|
||||
file.puts <<-EOH
|
||||
==== Regional definitions
|
||||
The following definition files are included in this installation:
|
||||
|
||||
EOH
|
||||
FileList.new('lib/holidays/*.rb').each do |str|
|
||||
file.puts('* ' + str.gsub(/^lib\/|\.rb$/, ''))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
$:.unshift File.expand_path('../lib', __FILE__)
|
||||
require 'rake'
|
||||
require 'rake/testtask'
|
||||
require 'rdoc/task'
|
||||
require 'yaml'
|
||||
require 'fileutils'
|
||||
require 'holidays'
|
||||
require File.expand_path('data/build_defs')
|
||||
|
||||
task :default => :test
|
||||
|
||||
desc 'Run all tests'
|
||||
task :test => ["test:lib", "test:defs"]
|
||||
|
||||
namespace :test do
|
||||
desc 'Run the unit tests.'
|
||||
Rake::TestTask.new(:defs) do |t|
|
||||
t.libs << 'lib'
|
||||
t.test_files = FileList['test/defs/test*.rb'].exclude('test_helper.rb')
|
||||
t.verbose = false
|
||||
end
|
||||
|
||||
desc 'Run the definition tests.'
|
||||
Rake::TestTask.new(:lib) do |t|
|
||||
t.libs << 'lib'
|
||||
t.test_files = FileList['test/test*.rb'].exclude('test_helper.rb')
|
||||
t.verbose = false
|
||||
end
|
||||
end
|
||||
|
||||
task :doc => ["defs:manifest", :rdoc]
|
||||
|
||||
desc 'Generate documentation.'
|
||||
RDoc::Task.new do |rdoc|
|
||||
rdoc.rdoc_dir = 'doc'
|
||||
rdoc.title = 'Ruby Holidays Gem'
|
||||
rdoc.options << '--all' << '--inline-source' << '--line-numbers'
|
||||
rdoc.options << '--charset' << 'utf-8'
|
||||
rdoc.rdoc_files.include('README.rdoc')
|
||||
rdoc.rdoc_files.include('data/SYNTAX.rdoc')
|
||||
rdoc.rdoc_files.include('lib/holidays/MANIFEST')
|
||||
rdoc.rdoc_files.include('REFERENCES')
|
||||
rdoc.rdoc_files.include('CHANGELOG')
|
||||
rdoc.rdoc_files.include('LICENSE')
|
||||
rdoc.rdoc_files.include('lib/*.rb')
|
||||
end
|
||||
|
||||
desc 'Definition file tasks'
|
||||
namespace :defs do
|
||||
DATA_PATH = 'data'
|
||||
|
||||
desc 'Build holiday definition files'
|
||||
task :build_all do
|
||||
# load the index
|
||||
def_index = YAML.load_file("#{DATA_PATH}/index.yaml")
|
||||
|
||||
# create a dir for the generated tests
|
||||
FileUtils.mkdir_p('test/defs')
|
||||
|
||||
def_index['defs'].each do |region, files|
|
||||
puts "Building #{region} definition module:"
|
||||
files = files.collect { |f| "#{DATA_PATH}/#{f}" }
|
||||
files.uniq!
|
||||
|
||||
module_src, test_src = parse_holiday_defs(region, files)
|
||||
File.open("lib/holidays/#{region.downcase.to_s}.rb","w") do |file|
|
||||
file.puts module_src
|
||||
end
|
||||
unless test_src.empty?
|
||||
File.open("test/defs/test_defs_#{region.downcase.to_s}.rb","w") do |file|
|
||||
file.puts test_src
|
||||
end
|
||||
end
|
||||
puts "Done.\n\n"
|
||||
end
|
||||
end
|
||||
|
||||
desc 'Build the definition manifest.'
|
||||
task :manifest do
|
||||
File.open("lib/holidays/MANIFEST","w") do |file|
|
||||
file.puts <<-EOH
|
||||
==== Regional definitions
|
||||
The following definition files are included in this installation:
|
||||
|
||||
EOH
|
||||
FileList.new('lib/holidays/*.rb').each do |str|
|
||||
file.puts('* ' + str.gsub(/^lib\/|\.rb$/, ''))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
begin
|
||||
require 'jeweler'
|
||||
Jeweler::Tasks.new do |gemspec|
|
||||
gemspec.name = "holidays"
|
||||
gemspec.summary = "A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!"
|
||||
gemspec.description = "A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!"
|
||||
gemspec.email = "code@dunae.ca"
|
||||
gemspec.homepage = "https://github.com/alexdunae/holidays"
|
||||
gemspec.version = Holidays::VERSION
|
||||
gemspec.authors = ["Alex Dunae"]
|
||||
gemspec.add_development_dependency 'rdoc', '>= 2.4.2'
|
||||
end
|
||||
rescue LoadError
|
||||
puts "Jeweler not available. Install it with: gem install jeweler"
|
||||
end
|
||||
|
|
|
@ -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
|
|
@ -1,36 +1,36 @@
|
|||
require File.dirname(__FILE__) + '/../test_helper'
|
||||
require 'holidays/au'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/au.yaml
|
||||
class AuDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_au
|
||||
{Date.civil(2007,1,1) => 'New Year\'s Day',
|
||||
Date.civil(2007,1,26) => 'Australia Day',
|
||||
Date.civil(2007,4,6) => 'Good Friday',
|
||||
Date.civil(2007,4,9) => 'Easter Monday',
|
||||
Date.civil(2007,4,25) => 'ANZAC Day',
|
||||
Date.civil(2007,12,25) => 'Christmas Day',
|
||||
Date.civil(2007,12,26) => 'Boxing Day'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :au, :informal)[0][:name]
|
||||
end
|
||||
|
||||
[:au_sa, :au_act, :au_nsw, :au_].each do |r|
|
||||
assert_equal 'Labour Day', Date.civil(2007,10,1).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:au_sa, :au_act, :au_nsw, :au_vic, :au_tas, :au_qld, :au_nt, :au_].each do |r|
|
||||
assert_equal 'Queen\'s Birthday', Date.civil(2007,6,11).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
assert_equal 'Labour Day', Date.civil(2007,3,5).holidays(:au_wa)[0][:name]
|
||||
assert_equal 'Labour Day', Date.civil(2007,3,12).holidays(:au_vic)[0][:name]
|
||||
assert_equal 'Labour Day', Date.civil(2007,5,7).holidays(:au_qld)[0][:name]
|
||||
|
||||
assert_equal 'May Day', Date.civil(2007,5,7).holidays(:au_nt)[0][:name]
|
||||
|
||||
assert_equal 'Eight Hours Day', Date.civil(2007,3,12).holidays(:au_tas)[0][:name]
|
||||
end
|
||||
end
|
||||
# encoding: utf-8
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/au.yaml
|
||||
class AuDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_au
|
||||
{Date.civil(2007,1,1) => 'New Year\'s Day',
|
||||
Date.civil(2007,1,26) => 'Australia Day',
|
||||
Date.civil(2007,4,6) => 'Good Friday',
|
||||
Date.civil(2007,4,9) => 'Easter Monday',
|
||||
Date.civil(2007,4,25) => 'ANZAC Day',
|
||||
Date.civil(2007,12,25) => 'Christmas Day',
|
||||
Date.civil(2007,12,26) => 'Boxing Day'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :au, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
[:au_sa, :au_act, :au_nsw, :au_].each do |r|
|
||||
assert_equal 'Labour Day', Date.civil(2007,10,1).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:au_sa, :au_act, :au_nsw, :au_vic, :au_tas, :au_qld, :au_nt, :au_].each do |r|
|
||||
assert_equal 'Queen\'s Birthday', Date.civil(2007,6,11).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
assert_equal 'Labour Day', Date.civil(2007,3,5).holidays(:au_wa)[0][:name]
|
||||
assert_equal 'Labour Day', Date.civil(2007,3,12).holidays(:au_vic)[0][:name]
|
||||
assert_equal 'Labour Day', Date.civil(2007,5,7).holidays(:au_qld)[0][:name]
|
||||
|
||||
assert_equal 'May Day', Date.civil(2007,5,7).holidays(:au_nt)[0][:name]
|
||||
|
||||
assert_equal 'Eight Hours Day', Date.civil(2007,3,12).holidays(:au_tas)[0][:name]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
# encoding: utf-8
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/br.yaml
|
||||
class BrDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_br
|
||||
{Date.civil(2008,1,1) => 'Dia da Confraternização Universal',
|
||||
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,21) => 'Sexta-feira Santa',
|
||||
Date.civil(2008,3,23) => 'Páscoa',
|
||||
Date.civil(2008,4,21) => 'Dia de Tiradentes',
|
||||
Date.civil(2008,5,1) => 'Dia do Trabalho',
|
||||
Date.civil(2005,5,26) => 'Corpus Christ',
|
||||
Date.civil(2007,6,7) => 'Corpus Christ',
|
||||
Date.civil(2008,5,22) => 'Corpus Christ',
|
||||
Date.civil(2008,9,7) => 'Proclamação da Independência',
|
||||
Date.civil(2008,10,12) => 'Dia de Nossa Senhora Aparecida',
|
||||
Date.civil(2008,11,2) => 'Dia de Finados',
|
||||
Date.civil(2008,11,15) => 'Proclamação da República',
|
||||
Date.civil(2008,12,25) => 'Natal'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :br, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -1,29 +1,29 @@
|
|||
require File.dirname(__FILE__) + '/../test_helper'
|
||||
require 'holidays/ca'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/ca.yaml, data/north_america_informal.yaml
|
||||
class CaDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_ca
|
||||
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
||||
Date.civil(2008,3,21) => 'Good Friday',
|
||||
Date.civil(2008,3,24) => 'Easter Monday',
|
||||
Date.civil(2008,5,19) => 'Victoria Day',
|
||||
Date.civil(2008,7,1) => 'Canada Day',
|
||||
Date.civil(2008,9,1) => 'Labour Day',
|
||||
Date.civil(2008,10,13) => 'Thanksgiving',
|
||||
Date.civil(2008,11,11) => 'Rememberance Day',
|
||||
Date.civil(2008,12,25) => 'Christmas Day',
|
||||
Date.civil(2008,12,26) => 'Boxing Day'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :ca, :informal)[0][:name]
|
||||
end
|
||||
|
||||
# Victoria Day
|
||||
[Date.civil(2004,5,24), Date.civil(2005,5,23), Date.civil(2006,5,22),
|
||||
Date.civil(2007,5,21), Date.civil(2008,5,19)].each do |date|
|
||||
assert_equal 'Victoria Day', Holidays.on(date, :ca)[0][:name]
|
||||
end
|
||||
end
|
||||
end
|
||||
# encoding: utf-8
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/ca.yaml, data/north_america_informal.yaml
|
||||
class CaDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_ca
|
||||
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
||||
Date.civil(2008,3,21) => 'Good Friday',
|
||||
Date.civil(2008,3,24) => 'Easter Monday',
|
||||
Date.civil(2008,5,19) => 'Victoria Day',
|
||||
Date.civil(2008,7,1) => 'Canada Day',
|
||||
Date.civil(2008,9,1) => 'Labour Day',
|
||||
Date.civil(2008,10,13) => 'Thanksgiving',
|
||||
Date.civil(2008,11,11) => 'Remembrance Day',
|
||||
Date.civil(2008,12,25) => 'Christmas Day',
|
||||
Date.civil(2008,12,26) => 'Boxing Day'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :ca, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Victoria Day
|
||||
[Date.civil(2004,5,24), Date.civil(2005,5,23), Date.civil(2006,5,22),
|
||||
Date.civil(2007,5,21), Date.civil(2008,5,19)].each do |date|
|
||||
assert_equal 'Victoria Day', Holidays.on(date, :ca)[0][:name]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
# encoding: utf-8
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/cz.yaml
|
||||
class CzDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_cz
|
||||
{Date.civil(2010,1,1) => 'Den obnovy samostatného českého státu',
|
||||
Date.civil(2010,4,5) => 'Velikonoční pondělí',
|
||||
Date.civil(2010,5,1) => 'Svátek práce',
|
||||
Date.civil(2010,5,8) => 'Den vítězství',
|
||||
Date.civil(2010,7,5) => 'Den slovanských věrozvěstů Cyrila a Metoděje',
|
||||
Date.civil(2010,7,6) => 'Den upálení mistra Jana Husa',
|
||||
Date.civil(2010,9,28) => 'Den české státnosti',
|
||||
Date.civil(2010,10,28) => 'Den vzniku samostatného československého státu',
|
||||
Date.civil(2010,11,17) => 'Den boje za svobodu a demokracii',
|
||||
Date.civil(2010,12,24) => 'Štědrý den',
|
||||
Date.civil(2010,12,25) => '1. svátek vánoční',
|
||||
Date.civil(2010,12,26) => '2. svátek vánoční'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :cz, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -1,46 +1,51 @@
|
|||
require File.dirname(__FILE__) + '/../test_helper'
|
||||
require 'holidays/de'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/de.yaml
|
||||
class DeDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_de
|
||||
{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]
|
||||
|
||||
end
|
||||
end
|
||||
# encoding: utf-8
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/de.yaml
|
||||
class DeDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_de
|
||||
{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]
|
||||
end
|
||||
|
||||
[: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|
|
||||
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'
|
||||
|
||||
# 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]
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
require File.dirname(__FILE__) + '/../test_helper'
|
||||
require 'holidays/dk'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/dk.yaml
|
||||
class DkDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_dk
|
||||
{Date.civil(2007,1,1) => 'Nytårsdag',
|
||||
Date.civil(2007,2,18) => 'Fastelavn',
|
||||
Date.civil(2007,4,9) => 'Danmarks besættelse',
|
||||
Date.civil(2007,4,16) => 'Dronningens fødselsdag',
|
||||
Date.civil(2007,4,5) => 'Skærtorsdag',
|
||||
Date.civil(2007,4,6) => 'Langfredag',
|
||||
Date.civil(2007,4,8) => 'Påskedag',
|
||||
Date.civil(2007,4,9) => '2. påskedag',
|
||||
Date.civil(2007,5,1) => 'Arbejdernes kampdag',
|
||||
Date.civil(2007,5,4) => 'Store Bededag',
|
||||
Date.civil(2007,5,17) => 'Kristi Himmelfartsdag',
|
||||
Date.civil(2007,5,27) => 'Pinsedag',
|
||||
Date.civil(2007,5,28) => '2. Pinsedag',
|
||||
Date.civil(2007,6,5) => 'Grundlovsdag',
|
||||
Date.civil(2007,12,24) => 'Juleaftensdag',
|
||||
Date.civil(2007,12,25) => '1. juledag',
|
||||
Date.civil(2007,12,26) => '2. juledag'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :dk, :informal)[0][:name]
|
||||
end
|
||||
end
|
||||
end
|
||||
# encoding: utf-8
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/dk.yaml
|
||||
class DkDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_dk
|
||||
{Date.civil(2007,1,1) => 'Nytårsdag',
|
||||
Date.civil(2007,2,18) => 'Fastelavn',
|
||||
Date.civil(2007,4,9) => 'Danmarks besættelse',
|
||||
Date.civil(2007,4,16) => 'Dronningens fødselsdag',
|
||||
Date.civil(2007,4,5) => 'Skærtorsdag',
|
||||
Date.civil(2007,4,6) => 'Langfredag',
|
||||
Date.civil(2007,4,8) => 'Påskedag',
|
||||
Date.civil(2007,4,9) => '2. påskedag',
|
||||
Date.civil(2007,5,1) => 'Arbejdernes kampdag',
|
||||
Date.civil(2007,5,4) => 'Store Bededag',
|
||||
Date.civil(2007,5,17) => 'Kristi Himmelfartsdag',
|
||||
Date.civil(2007,5,27) => 'Pinsedag',
|
||||
Date.civil(2007,5,28) => '2. Pinsedag',
|
||||
Date.civil(2007,6,5) => 'Grundlovsdag',
|
||||
Date.civil(2007,12,24) => 'Juleaftensdag',
|
||||
Date.civil(2007,12,25) => '1. juledag',
|
||||
Date.civil(2007,12,26) => '2. juledag'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :dk, :informal)[0] || {})[:name]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
# encoding: utf-8
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/el.yaml
|
||||
class ElDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_el
|
||||
{Date.civil(2011,1,1) => 'Πρωτοχρονιά',
|
||||
Date.civil(2011,1,6) => 'Θεοφάνεια',
|
||||
Date.civil(2011,4,22) => 'Μεγάλη Παρασκευή',
|
||||
Date.civil(1970,4,25) => 'Μεγάλο Σάββατο',
|
||||
Date.civil(1985,4,14) => 'Κυριακή του Πάσχα',
|
||||
Date.civil(2011,4,24) => 'Κυριακή του Πάσχα',
|
||||
Date.civil(2027,5,2) => 'Κυριακή του Πάσχα',
|
||||
Date.civil(2046,4,30) => 'Δευτέρα του Πάσχα',
|
||||
Date.civil(2011,5,1) => 'Πρωτομαγιά',
|
||||
Date.civil(2011,6,13) => 'Αγίου Πνεύματος',
|
||||
Date.civil(2012,6,4) => 'Αγίου Πνεύματος',
|
||||
Date.civil(2011,3,7) => 'Καθαρά Δευτέρα',
|
||||
Date.civil(2012,2,27) => 'Καθαρά Δευτέρα',
|
||||
Date.civil(2011,12,25) => 'Χριστούγεννα',
|
||||
Date.civil(2011,12,26) => 'Δεύτερη ημέρα των Χριστουγέννων'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :el, :informal)[0] || {})[:name]
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,57 +1,57 @@
|
|||
require File.dirname(__FILE__) + '/../test_helper'
|
||||
require 'holidays/es'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/es.yaml
|
||||
class EsDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_es
|
||||
{Date.civil(2009,1,1) => 'Año Nuevo',
|
||||
Date.civil(2009,1,6) => 'Día de Reyes',
|
||||
Date.civil(2009,4,10) => 'Viernes Santo',
|
||||
Date.civil(2009,5,1) => 'Día del Trabajador',
|
||||
Date.civil(2009,8,15) => 'Asunción',
|
||||
Date.civil(2009,10,12) => 'Día de la Hispanidad',
|
||||
Date.civil(2009,11,1) => 'Todos los Santos',
|
||||
Date.civil(2009,12,6) => 'Día de la Constitución',
|
||||
Date.civil(2009,12,8) => 'Inmaculada Concepción',
|
||||
Date.civil(2009,12,25) => 'Navidad del Señor'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :es, :informal)[0][:name]
|
||||
end
|
||||
|
||||
[:es_pv, :es_ct, :es_na, :es_v, :es_vc, :es_].each do |r|
|
||||
assert_equal 'Jueves Santo', Date.civil(2009,4,9).holidays(r)[0][:name]
|
||||
assert_equal 'Lunes de Pascua', Date.civil(2009,4,13).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:es_v, :es_vc, :es_cm, :es_mu, :es_m, :es_].each do |r|
|
||||
assert_equal 'San José', Date.civil(2009,3,19).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:es_ar, :es_cl, :es_].each do |r|
|
||||
assert_equal 'San Jorge', Date.civil(2009,4,23).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:es_vc, :es_v, :es_].each do |r|
|
||||
assert_equal 'Día de Valencia', Date.civil(2009,10,9).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:es_ib, :es_ct, :es_].each do |r|
|
||||
assert_equal 'San Esteban', Date.civil(2009,12,26).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
assert_equal 'Día de Andalucía', Date.civil(2009,2,28).holidays(:es_an)[0][:name]
|
||||
assert_equal 'Día de las Islas Baleares', Date.civil(2009,3,1).holidays(:es_ib)[0][:name]
|
||||
assert_equal 'Fiesta de la Comunidad', Date.civil(2006,5,2).holidays(:es_m)[0][:name]
|
||||
assert_equal 'Día de las Canarias', Date.civil(2006,5,30).holidays(:es_cn)[0][:name]
|
||||
assert_equal 'Día de la Región Castilla-La Mancha', Date.civil(2009,5,31).holidays(:es_cm)[0][:name]
|
||||
assert_equal 'Día de la Región de Murcia', Date.civil(2009,6,9).holidays(:es_mu)[0][:name]
|
||||
assert_equal 'Día de La Rioja', Date.civil(2009,6,9).holidays(:es_lo)[0][:name]
|
||||
assert_equal 'Santiago Apostol', Date.civil(2009,7,23).holidays(:es_ga)[0][:name]
|
||||
assert_equal 'Día de Ceuta', Date.civil(2009,9,2).holidays(:es_ce)[0][:name]
|
||||
assert_equal 'Día de Asturias', Date.civil(2009,9,8).holidays(:es_o)[0][:name]
|
||||
assert_equal 'Día de Extremadura', Date.civil(2009,9,8).holidays(:es_ex)[0][:name]
|
||||
assert_equal 'Fiesta Nacional de Cataluña', Date.civil(2009,9,11).holidays(:es_ct)[0][:name]
|
||||
end
|
||||
end
|
||||
# encoding: utf-8
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/es.yaml
|
||||
class EsDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_es
|
||||
{Date.civil(2009,1,1) => 'Año Nuevo',
|
||||
Date.civil(2009,1,6) => 'Día de Reyes',
|
||||
Date.civil(2009,4,10) => 'Viernes Santo',
|
||||
Date.civil(2009,5,1) => 'Día del Trabajador',
|
||||
Date.civil(2009,8,15) => 'Asunción',
|
||||
Date.civil(2009,10,12) => 'Día de la Hispanidad',
|
||||
Date.civil(2009,11,1) => 'Todos los Santos',
|
||||
Date.civil(2009,12,6) => 'Día de la Constitución',
|
||||
Date.civil(2009,12,8) => 'Inmaculada Concepción',
|
||||
Date.civil(2009,12,25) => 'Navidad del Señor'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :es, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
[:es_pv, :es_ct, :es_na, :es_v, :es_vc, :es_].each do |r|
|
||||
assert_equal 'Jueves Santo', Date.civil(2009,4,9).holidays(r)[0][:name]
|
||||
assert_equal 'Lunes de Pascua', Date.civil(2009,4,13).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:es_v, :es_vc, :es_cm, :es_mu, :es_m, :es_].each do |r|
|
||||
assert_equal 'San José', Date.civil(2009,3,19).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:es_ar, :es_cl, :es_].each do |r|
|
||||
assert_equal 'San Jorge', Date.civil(2009,4,23).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:es_vc, :es_v, :es_].each do |r|
|
||||
assert_equal 'Día de Valencia', Date.civil(2009,10,9).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:es_ib, :es_ct, :es_].each do |r|
|
||||
assert_equal 'San Esteban', Date.civil(2009,12,26).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
assert_equal 'Día de Andalucía', Date.civil(2009,2,28).holidays(:es_an)[0][:name]
|
||||
assert_equal 'Día de las Islas Baleares', Date.civil(2009,3,1).holidays(:es_ib)[0][:name]
|
||||
assert_equal 'Fiesta de la Comunidad', Date.civil(2006,5,2).holidays(:es_m)[0][:name]
|
||||
assert_equal 'Día de las Canarias', Date.civil(2006,5,30).holidays(:es_cn)[0][:name]
|
||||
assert_equal 'Día de la Región Castilla-La Mancha', Date.civil(2009,5,31).holidays(:es_cm)[0][:name]
|
||||
assert_equal 'Día de la Región de Murcia', Date.civil(2009,6,9).holidays(:es_mu)[0][:name]
|
||||
assert_equal 'Día de La Rioja', Date.civil(2009,6,9).holidays(:es_lo)[0][:name]
|
||||
assert_equal 'Santiago Apostol', Date.civil(2009,7,23).holidays(:es_ga)[0][:name]
|
||||
assert_equal 'Día de Ceuta', Date.civil(2009,9,2).holidays(:es_ce)[0][:name]
|
||||
assert_equal 'Día de Asturias', Date.civil(2009,9,8).holidays(:es_o)[0][:name]
|
||||
assert_equal 'Día de Extremadura', Date.civil(2009,9,8).holidays(:es_ex)[0][:name]
|
||||
assert_equal 'Fiesta Nacional de Cataluña', Date.civil(2009,9,11).holidays(:es_ct)[0][:name]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,240 +1,472 @@
|
|||
require File.dirname(__FILE__) + '/../test_helper'
|
||||
require 'holidays/europe'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/dk.yaml, data/de.yaml, data/es.yaml, data/fr.yaml, data/gb.yaml, data/ie.yaml, data/is.yaml, data/it.yaml, data/nl.yaml, data/pt.yaml
|
||||
class EuropeDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_europe
|
||||
{Date.civil(2007,1,1) => 'Nytårsdag',
|
||||
Date.civil(2007,2,18) => 'Fastelavn',
|
||||
Date.civil(2007,4,9) => 'Danmarks besættelse',
|
||||
Date.civil(2007,4,16) => 'Dronningens fødselsdag',
|
||||
Date.civil(2007,4,5) => 'Skærtorsdag',
|
||||
Date.civil(2007,4,6) => 'Langfredag',
|
||||
Date.civil(2007,4,8) => 'Påskedag',
|
||||
Date.civil(2007,4,9) => '2. påskedag',
|
||||
Date.civil(2007,5,1) => 'Arbejdernes kampdag',
|
||||
Date.civil(2007,5,4) => 'Store Bededag',
|
||||
Date.civil(2007,5,17) => 'Kristi Himmelfartsdag',
|
||||
Date.civil(2007,5,27) => 'Pinsedag',
|
||||
Date.civil(2007,5,28) => '2. Pinsedag',
|
||||
Date.civil(2007,6,5) => 'Grundlovsdag',
|
||||
Date.civil(2007,12,24) => 'Juleaftensdag',
|
||||
Date.civil(2007,12,25) => '1. juledag',
|
||||
Date.civil(2007,12,26) => '2. juledag'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :dk, :informal)[0][:name]
|
||||
end
|
||||
|
||||
{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]
|
||||
|
||||
|
||||
{Date.civil(2009,1,1) => 'Año Nuevo',
|
||||
Date.civil(2009,1,6) => 'Día de Reyes',
|
||||
Date.civil(2009,4,10) => 'Viernes Santo',
|
||||
Date.civil(2009,5,1) => 'Día del Trabajador',
|
||||
Date.civil(2009,8,15) => 'Asunción',
|
||||
Date.civil(2009,10,12) => 'Día de la Hispanidad',
|
||||
Date.civil(2009,11,1) => 'Todos los Santos',
|
||||
Date.civil(2009,12,6) => 'Día de la Constitución',
|
||||
Date.civil(2009,12,8) => 'Inmaculada Concepción',
|
||||
Date.civil(2009,12,25) => 'Navidad del Señor'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :es, :informal)[0][:name]
|
||||
end
|
||||
|
||||
[:es_pv, :es_ct, :es_na, :es_v, :es_vc, :es_].each do |r|
|
||||
assert_equal 'Jueves Santo', Date.civil(2009,4,9).holidays(r)[0][:name]
|
||||
assert_equal 'Lunes de Pascua', Date.civil(2009,4,13).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:es_v, :es_vc, :es_cm, :es_mu, :es_m, :es_].each do |r|
|
||||
assert_equal 'San José', Date.civil(2009,3,19).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:es_ar, :es_cl, :es_].each do |r|
|
||||
assert_equal 'San Jorge', Date.civil(2009,4,23).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:es_vc, :es_v, :es_].each do |r|
|
||||
assert_equal 'Día de Valencia', Date.civil(2009,10,9).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:es_ib, :es_ct, :es_].each do |r|
|
||||
assert_equal 'San Esteban', Date.civil(2009,12,26).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
assert_equal 'Día de Andalucía', Date.civil(2009,2,28).holidays(:es_an)[0][:name]
|
||||
assert_equal 'Día de las Islas Baleares', Date.civil(2009,3,1).holidays(:es_ib)[0][:name]
|
||||
assert_equal 'Fiesta de la Comunidad', Date.civil(2006,5,2).holidays(:es_m)[0][:name]
|
||||
assert_equal 'Día de las Canarias', Date.civil(2006,5,30).holidays(:es_cn)[0][:name]
|
||||
assert_equal 'Día de la Región Castilla-La Mancha', Date.civil(2009,5,31).holidays(:es_cm)[0][:name]
|
||||
assert_equal 'Día de la Región de Murcia', Date.civil(2009,6,9).holidays(:es_mu)[0][:name]
|
||||
assert_equal 'Día de La Rioja', Date.civil(2009,6,9).holidays(:es_lo)[0][:name]
|
||||
assert_equal 'Santiago Apostol', Date.civil(2009,7,23).holidays(:es_ga)[0][:name]
|
||||
assert_equal 'Día de Ceuta', Date.civil(2009,9,2).holidays(:es_ce)[0][:name]
|
||||
assert_equal 'Día de Asturias', Date.civil(2009,9,8).holidays(:es_o)[0][:name]
|
||||
assert_equal 'Día de Extremadura', Date.civil(2009,9,8).holidays(:es_ex)[0][:name]
|
||||
assert_equal 'Fiesta Nacional de Cataluña', Date.civil(2009,9,11).holidays(:es_ct)[0][:name]
|
||||
|
||||
{Date.civil(2007,1,1) => 'Jour de l\'an',
|
||||
Date.civil(2007,4,8) => 'Pâques',
|
||||
Date.civil(2007,4,9) => 'Lundi de Pâques',
|
||||
Date.civil(2007,5,1) => 'Fête du travail',
|
||||
Date.civil(2007,5,8) => 'Victoire 1945',
|
||||
Date.civil(2007,5,17) => 'Ascension',
|
||||
Date.civil(2007,5,27) => 'Pentecôte',
|
||||
Date.civil(2007,5,28) => 'Lundi de Pentecôte',
|
||||
Date.civil(2007,7,14) => 'Fête nationale',
|
||||
Date.civil(2007,8,15) => 'Assomption',
|
||||
Date.civil(2007,11,1) => 'Toussaint',
|
||||
Date.civil(2007,11,11) => 'Armistice 1918',
|
||||
Date.civil(2007,12,25) => 'Nöel'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :fr, :informal)[0][:name]
|
||||
end
|
||||
|
||||
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
||||
Date.civil(2008,3,21) => 'Good Friday',
|
||||
Date.civil(2008,3,23) => 'Easter Sunday',
|
||||
Date.civil(2008,5,5) => 'May Day',
|
||||
Date.civil(2008,5,26) => 'Bank Holiday',
|
||||
Date.civil(2008,11,5) => 'Guy Fawkes Day',
|
||||
Date.civil(2008,12,25) => 'Christmas Day',
|
||||
Date.civil(2008,12,26) => 'Boxing Day'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :gb, :informal)[0][:name]
|
||||
end
|
||||
|
||||
assert_equal 'St. Patrick\'s Day', Date.civil(2008,3,17).holidays(:gb_nir, :informal)[0][:name]
|
||||
|
||||
assert_equal 'Christmas Day', Date.civil(2008,12,25).holidays(:gb_, :observed)[0][:name]
|
||||
assert_equal 'Christmas Day', Date.civil(2009,12,25).holidays(:gb_, :observed)[0][:name]
|
||||
assert_equal 'Christmas Day', Date.civil(2010,12,27).holidays(:gb_, :observed)[0][:name]
|
||||
|
||||
assert_equal 'Boxing Day', Date.civil(2008,12,26).holidays(:gb_, :observed)[0][:name]
|
||||
assert_equal 'Boxing Day', Date.civil(2009,12,28).holidays(:gb_, :observed)[0][:name]
|
||||
assert_equal 'Boxing Day', Date.civil(2010,12,28).holidays(:gb_, :observed)[0][:name]
|
||||
|
||||
[:gb_wls, :gb_eng, :gb_nir, :gb_eaw, :gb_].each do |r|
|
||||
assert_equal 'Easter Monday', Date.civil(2008,3,24).holidays(r)[0][:name]
|
||||
assert_equal 'Bank Holiday', Date.civil(2008,8,25).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
||||
Date.civil(2008,3,17) => 'St. Patrick\'s Day',
|
||||
Date.civil(2008,3,24) => 'Easter Monday',
|
||||
Date.civil(2008,5,5) => 'May Day',
|
||||
Date.civil(2008,6,2) => 'Bank Holiday',
|
||||
Date.civil(2008,8,4) => 'Bank Holiday',
|
||||
Date.civil(2008,12,25) => 'Christmas Day',
|
||||
Date.civil(2008,12,26) => 'St. Stephen\'s Day'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :ie, :informal)[0][:name]
|
||||
end
|
||||
|
||||
{Date.civil(2007,1,1) => 'Nýársdagur',
|
||||
Date.civil(2007,1,6) => 'Þrettándinn',
|
||||
Date.civil(2007,1,19) => 'Bóndadagur',
|
||||
Date.civil(2007,2,18) => 'Konudagur',
|
||||
Date.civil(2007,4,5) => 'Skírdagur',
|
||||
Date.civil(2007,4,6) => 'Föstudaginn langi',
|
||||
Date.civil(2007,4,8) => 'Páskadagur',
|
||||
Date.civil(2007,4,9) => 'Annar í páskum',
|
||||
Date.civil(2007,4,19) => 'Sumardagurinn fyrsti',
|
||||
Date.civil(2007,5,1) => 'Verkalýðsdagurinn',
|
||||
Date.civil(2007,5,17) => 'Uppstigningardagur',
|
||||
Date.civil(2007,5,27) => 'Hvítasunnudagur',
|
||||
Date.civil(2007,5,28) => 'Annar í hvítasunnu',
|
||||
Date.civil(2007,6,3) => 'Sjómannadagurinn',
|
||||
Date.civil(2007,6,17) => 'Lýðveldisdagurinn',
|
||||
Date.civil(2007,8,6) => 'Frídagur verslunarmanna',
|
||||
Date.civil(2007,12,24) => 'Jól',
|
||||
Date.civil(2007,12,25) => 'Jól',
|
||||
Date.civil(2007,12,26) => 'Jól',
|
||||
Date.civil(2007,12,31) => 'Gamlárskvöld'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :is, :informal)[0][:name]
|
||||
end
|
||||
|
||||
{Date.civil(2007,1,1) => 'Capodanno',
|
||||
Date.civil(2007,1,6) => 'Epifania',
|
||||
Date.civil(2007,4,8) => 'Pasqua',
|
||||
Date.civil(2007,4,9) => 'Lunedì dell\'Angelo',
|
||||
Date.civil(2007,4,25) => 'Festa della Liberazione',
|
||||
Date.civil(2007,5,1) => 'Festa dei Lavoratori',
|
||||
Date.civil(2007,6,2) => 'Festa della Repubblica',
|
||||
Date.civil(2007,8,15) => 'Assunzione',
|
||||
Date.civil(2007,11,1) => 'Ognissanti',
|
||||
Date.civil(2007,12,8) => 'Immacolata Concezione',
|
||||
Date.civil(2007,12,25) => 'Natale',
|
||||
Date.civil(2007,12,26) => 'Santo Stefano'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :it, :informal)[0][:name]
|
||||
end
|
||||
|
||||
{Date.civil(2008,1,1) => 'Nieuwjaar',
|
||||
Date.civil(2008,3,21) => 'Goede Vrijdag',
|
||||
Date.civil(2008,3,23) => 'Pasen',
|
||||
Date.civil(2008,3,24) => 'Pasen',
|
||||
Date.civil(2008,4,30) => 'Koninginnedag',
|
||||
Date.civil(2008,5,1) => 'Hemelvaartsdag', # Ascension, Easter+39
|
||||
Date.civil(2008,5,5) => 'Bevrijdingsdag',
|
||||
Date.civil(2008,5,11) => 'Pinksteren', # Pentecost, Easter+49
|
||||
Date.civil(2008,5,12) => 'Pinksteren', # Pentecost, Easter+50
|
||||
Date.civil(2008,12,25) => 'Kerstmis',
|
||||
Date.civil(2008,12,26) => 'Kerstmis'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :nl, :informal)[0][:name]
|
||||
end
|
||||
|
||||
{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,21) => 'Sexta-feira Santa',
|
||||
Date.civil(2008,3,23) => '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, :informal)[0][:name]
|
||||
end
|
||||
end
|
||||
end
|
||||
# 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, data/cz.yaml, data/dk.yaml, data/de.yaml, data/el.yaml, data/es.yaml, data/fr.yaml, data/gb.yaml, data/ie.yaml, data/is.yaml, data/it.yaml, data/li.yaml, data/nl.yaml, data/no.yaml, data/pl.yaml, data/pt.yaml
|
||||
class EuropeDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_europe
|
||||
{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'
|
||||
|
||||
|
||||
{Date.civil(2010,1,1) => 'Den obnovy samostatného českého státu',
|
||||
Date.civil(2010,4,5) => 'Velikonoční pondělí',
|
||||
Date.civil(2010,5,1) => 'Svátek práce',
|
||||
Date.civil(2010,5,8) => 'Den vítězství',
|
||||
Date.civil(2010,7,5) => 'Den slovanských věrozvěstů Cyrila a Metoděje',
|
||||
Date.civil(2010,7,6) => 'Den upálení mistra Jana Husa',
|
||||
Date.civil(2010,9,28) => 'Den české státnosti',
|
||||
Date.civil(2010,10,28) => 'Den vzniku samostatného československého státu',
|
||||
Date.civil(2010,11,17) => 'Den boje za svobodu a demokracii',
|
||||
Date.civil(2010,12,24) => 'Štědrý den',
|
||||
Date.civil(2010,12,25) => '1. svátek vánoční',
|
||||
Date.civil(2010,12,26) => '2. svátek vánoční'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :cz, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
|
||||
{Date.civil(2007,1,1) => 'Nytårsdag',
|
||||
Date.civil(2007,2,18) => 'Fastelavn',
|
||||
Date.civil(2007,4,9) => 'Danmarks besættelse',
|
||||
Date.civil(2007,4,16) => 'Dronningens fødselsdag',
|
||||
Date.civil(2007,4,5) => 'Skærtorsdag',
|
||||
Date.civil(2007,4,6) => 'Langfredag',
|
||||
Date.civil(2007,4,8) => 'Påskedag',
|
||||
Date.civil(2007,4,9) => '2. påskedag',
|
||||
Date.civil(2007,5,1) => 'Arbejdernes kampdag',
|
||||
Date.civil(2007,5,4) => 'Store Bededag',
|
||||
Date.civil(2007,5,17) => 'Kristi Himmelfartsdag',
|
||||
Date.civil(2007,5,27) => 'Pinsedag',
|
||||
Date.civil(2007,5,28) => '2. Pinsedag',
|
||||
Date.civil(2007,6,5) => 'Grundlovsdag',
|
||||
Date.civil(2007,12,24) => 'Juleaftensdag',
|
||||
Date.civil(2007,12,25) => '1. juledag',
|
||||
Date.civil(2007,12,26) => '2. juledag'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :dk, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
{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]
|
||||
end
|
||||
|
||||
[: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|
|
||||
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'
|
||||
|
||||
# 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]
|
||||
|
||||
|
||||
{Date.civil(2011,1,1) => 'Πρωτοχρονιά',
|
||||
Date.civil(2011,1,6) => 'Θεοφάνεια',
|
||||
Date.civil(2011,4,22) => 'Μεγάλη Παρασκευή',
|
||||
Date.civil(1970,4,25) => 'Μεγάλο Σάββατο',
|
||||
Date.civil(1985,4,14) => 'Κυριακή του Πάσχα',
|
||||
Date.civil(2011,4,24) => 'Κυριακή του Πάσχα',
|
||||
Date.civil(2027,5,2) => 'Κυριακή του Πάσχα',
|
||||
Date.civil(2046,4,30) => 'Δευτέρα του Πάσχα',
|
||||
Date.civil(2011,5,1) => 'Πρωτομαγιά',
|
||||
Date.civil(2011,6,13) => 'Αγίου Πνεύματος',
|
||||
Date.civil(2012,6,4) => 'Αγίου Πνεύματος',
|
||||
Date.civil(2011,3,7) => 'Καθαρά Δευτέρα',
|
||||
Date.civil(2012,2,27) => 'Καθαρά Δευτέρα',
|
||||
Date.civil(2011,12,25) => 'Χριστούγεννα',
|
||||
Date.civil(2011,12,26) => 'Δεύτερη ημέρα των Χριστουγέννων'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :el, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
{Date.civil(2009,1,1) => 'Año Nuevo',
|
||||
Date.civil(2009,1,6) => 'Día de Reyes',
|
||||
Date.civil(2009,4,10) => 'Viernes Santo',
|
||||
Date.civil(2009,5,1) => 'Día del Trabajador',
|
||||
Date.civil(2009,8,15) => 'Asunción',
|
||||
Date.civil(2009,10,12) => 'Día de la Hispanidad',
|
||||
Date.civil(2009,11,1) => 'Todos los Santos',
|
||||
Date.civil(2009,12,6) => 'Día de la Constitución',
|
||||
Date.civil(2009,12,8) => 'Inmaculada Concepción',
|
||||
Date.civil(2009,12,25) => 'Navidad del Señor'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :es, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
[:es_pv, :es_ct, :es_na, :es_v, :es_vc, :es_].each do |r|
|
||||
assert_equal 'Jueves Santo', Date.civil(2009,4,9).holidays(r)[0][:name]
|
||||
assert_equal 'Lunes de Pascua', Date.civil(2009,4,13).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:es_v, :es_vc, :es_cm, :es_mu, :es_m, :es_].each do |r|
|
||||
assert_equal 'San José', Date.civil(2009,3,19).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:es_ar, :es_cl, :es_].each do |r|
|
||||
assert_equal 'San Jorge', Date.civil(2009,4,23).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:es_vc, :es_v, :es_].each do |r|
|
||||
assert_equal 'Día de Valencia', Date.civil(2009,10,9).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:es_ib, :es_ct, :es_].each do |r|
|
||||
assert_equal 'San Esteban', Date.civil(2009,12,26).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
assert_equal 'Día de Andalucía', Date.civil(2009,2,28).holidays(:es_an)[0][:name]
|
||||
assert_equal 'Día de las Islas Baleares', Date.civil(2009,3,1).holidays(:es_ib)[0][:name]
|
||||
assert_equal 'Fiesta de la Comunidad', Date.civil(2006,5,2).holidays(:es_m)[0][:name]
|
||||
assert_equal 'Día de las Canarias', Date.civil(2006,5,30).holidays(:es_cn)[0][:name]
|
||||
assert_equal 'Día de la Región Castilla-La Mancha', Date.civil(2009,5,31).holidays(:es_cm)[0][:name]
|
||||
assert_equal 'Día de la Región de Murcia', Date.civil(2009,6,9).holidays(:es_mu)[0][:name]
|
||||
assert_equal 'Día de La Rioja', Date.civil(2009,6,9).holidays(:es_lo)[0][:name]
|
||||
assert_equal 'Santiago Apostol', Date.civil(2009,7,23).holidays(:es_ga)[0][:name]
|
||||
assert_equal 'Día de Ceuta', Date.civil(2009,9,2).holidays(:es_ce)[0][:name]
|
||||
assert_equal 'Día de Asturias', Date.civil(2009,9,8).holidays(:es_o)[0][:name]
|
||||
assert_equal 'Día de Extremadura', Date.civil(2009,9,8).holidays(:es_ex)[0][:name]
|
||||
assert_equal 'Fiesta Nacional de Cataluña', Date.civil(2009,9,11).holidays(:es_ct)[0][:name]
|
||||
|
||||
{Date.civil(2007,1,1) => 'Jour de l\'an',
|
||||
Date.civil(2007,4,8) => 'Pâques',
|
||||
Date.civil(2007,4,9) => 'Lundi de Pâques',
|
||||
Date.civil(2007,5,1) => 'Fête du travail',
|
||||
Date.civil(2007,5,8) => 'Victoire 1945',
|
||||
Date.civil(2007,5,17) => 'Ascension',
|
||||
Date.civil(2007,5,27) => 'Pentecôte',
|
||||
Date.civil(2007,5,28) => 'Lundi de Pentecôte',
|
||||
Date.civil(2007,7,14) => 'Fête nationale',
|
||||
Date.civil(2007,8,15) => 'Assomption',
|
||||
Date.civil(2007,11,1) => 'Toussaint',
|
||||
Date.civil(2007,11,11) => 'Armistice 1918',
|
||||
Date.civil(2007,12,25) => 'Nöel'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :fr, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
||||
Date.civil(2008,3,21) => 'Good Friday',
|
||||
Date.civil(2008,3,23) => 'Easter Sunday',
|
||||
Date.civil(2008,5,5) => 'May Day',
|
||||
Date.civil(2008,5,26) => 'Bank Holiday',
|
||||
Date.civil(2008,11,5) => 'Guy Fawkes Day',
|
||||
Date.civil(2008,12,25) => 'Christmas Day',
|
||||
Date.civil(2008,12,26) => 'Boxing Day'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :gb, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
assert_equal 'St. Patrick\'s Day', Date.civil(2008,3,17).holidays(:gb_nir, :informal)[0][:name]
|
||||
|
||||
assert_equal 'Christmas Day', Date.civil(2008,12,25).holidays(:gb_, :observed)[0][:name]
|
||||
assert_equal 'Christmas Day', Date.civil(2009,12,25).holidays(:gb_, :observed)[0][:name]
|
||||
assert_equal 'Christmas Day', Date.civil(2010,12,27).holidays(:gb_, :observed)[0][:name]
|
||||
|
||||
assert_equal 'Boxing Day', Date.civil(2008,12,26).holidays(:gb_, :observed)[0][:name]
|
||||
assert_equal 'Boxing Day', Date.civil(2009,12,28).holidays(:gb_, :observed)[0][:name]
|
||||
assert_equal 'Boxing Day', Date.civil(2010,12,28).holidays(:gb_, :observed)[0][:name]
|
||||
|
||||
[:gb_wls, :gb_eng, :gb_nir, :gb_eaw, :gb_].each do |r|
|
||||
assert_equal 'Easter Monday', Date.civil(2008,3,24).holidays(r)[0][:name]
|
||||
assert_equal 'Bank Holiday', Date.civil(2008,8,25).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
||||
Date.civil(2008,3,17) => 'St. Patrick\'s Day',
|
||||
Date.civil(2008,3,24) => 'Easter Monday',
|
||||
Date.civil(2008,5,5) => 'May Day',
|
||||
Date.civil(2008,6,2) => 'Bank Holiday',
|
||||
Date.civil(2008,8,4) => 'Bank Holiday',
|
||||
Date.civil(2008,12,25) => 'Christmas Day',
|
||||
Date.civil(2008,12,26) => 'St. Stephen\'s Day'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :ie, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
{Date.civil(2007,1,1) => 'Nýársdagur',
|
||||
Date.civil(2007,1,6) => 'Þrettándinn',
|
||||
Date.civil(2007,1,19) => 'Bóndadagur',
|
||||
Date.civil(2007,2,18) => 'Konudagur',
|
||||
Date.civil(2007,4,5) => 'Skírdagur',
|
||||
Date.civil(2007,4,6) => 'Föstudaginn langi',
|
||||
Date.civil(2007,4,8) => 'Páskadagur',
|
||||
Date.civil(2007,4,9) => 'Annar í páskum',
|
||||
Date.civil(2007,4,19) => 'Sumardagurinn fyrsti',
|
||||
Date.civil(2007,5,1) => 'Verkalýðsdagurinn',
|
||||
Date.civil(2007,5,17) => 'Uppstigningardagur',
|
||||
Date.civil(2007,5,27) => 'Hvítasunnudagur',
|
||||
Date.civil(2007,5,28) => 'Annar í hvítasunnu',
|
||||
Date.civil(2007,6,3) => 'Sjómannadagurinn',
|
||||
Date.civil(2007,6,17) => 'Lýðveldisdagurinn',
|
||||
Date.civil(2007,8,6) => 'Frídagur verslunarmanna',
|
||||
Date.civil(2007,12,24) => 'Jól',
|
||||
Date.civil(2007,12,25) => 'Jól',
|
||||
Date.civil(2007,12,26) => 'Jól',
|
||||
Date.civil(2007,12,31) => 'Gamlárskvöld'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :is, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
{Date.civil(2007,1,1) => 'Capodanno',
|
||||
Date.civil(2007,1,6) => 'Epifania',
|
||||
Date.civil(2007,4,8) => 'Pasqua',
|
||||
Date.civil(2007,4,9) => 'Lunedì dell\'Angelo',
|
||||
Date.civil(2007,4,25) => 'Festa della Liberazione',
|
||||
Date.civil(2007,5,1) => 'Festa dei Lavoratori',
|
||||
Date.civil(2007,6,2) => 'Festa della Repubblica',
|
||||
Date.civil(2007,8,15) => 'Assunzione',
|
||||
Date.civil(2007,11,1) => 'Ognissanti',
|
||||
Date.civil(2007,12,8) => 'Immacolata Concezione',
|
||||
Date.civil(2007,12,25) => 'Natale',
|
||||
Date.civil(2007,12,26) => 'Santo Stefano'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :it, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
{Date.civil(2009,1,1) => 'Neujahrstag',
|
||||
Date.civil(2011,3,8) => 'Fasnachtsdienstag',
|
||||
Date.civil(2009,4,10) => 'Karfreitag',
|
||||
Date.civil(2009,4,12) => 'Ostern',
|
||||
Date.civil(2009,4,13) => 'Ostermontag',
|
||||
Date.civil(2009,5,21) => 'Auffahrt',
|
||||
Date.civil(2009,6,1) => 'Pfingstmontag',
|
||||
Date.civil(2009,12,25) => 'Weihnachten',
|
||||
Date.civil(2009,12,26) => 'Stefanstag'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :li, :informal)[0][:name]
|
||||
end
|
||||
|
||||
[:li].each do |r|
|
||||
assert_equal 'Fronleichnam', Date.civil(2009,6,11).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:li].each do |r|
|
||||
assert_equal 'Staatsfeiertag', Date.civil(2009,8,15).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:li].each do |r|
|
||||
assert_equal 'Allerheiligen', Date.civil(2009,11,1).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
|
||||
{Date.civil(2008,1,1) => 'Nieuwjaar',
|
||||
Date.civil(2008,3,21) => 'Goede Vrijdag',
|
||||
Date.civil(2008,3,23) => 'Pasen',
|
||||
Date.civil(2008,3,24) => 'Pasen',
|
||||
Date.civil(2008,4,30) => 'Koninginnedag',
|
||||
Date.civil(2008,5,1) => 'Hemelvaartsdag', # Ascension, Easter+39
|
||||
Date.civil(2008,5,5) => 'Bevrijdingsdag',
|
||||
Date.civil(2008,5,11) => 'Pinksteren', # Pentecost, Easter+49
|
||||
Date.civil(2008,5,12) => 'Pinksteren', # Pentecost, Easter+50
|
||||
Date.civil(2008,12,25) => 'Kerstmis',
|
||||
Date.civil(2008,12,26) => 'Kerstmis'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :nl, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
{Date.civil(2010,1,1) => 'Nyttårsdag',
|
||||
Date.civil(2010,5,1) => '1. mai',
|
||||
Date.civil(2010,5,17) => '17. mai',
|
||||
Date.civil(2010,12,24) => 'Julaften',
|
||||
Date.civil(2010,12,25) => '1. juledag',
|
||||
Date.civil(2010,12,26) => '2. juledag',
|
||||
Date.civil(2010,12,31) => 'Nyttårsaften',
|
||||
Date.civil(2010,2,14) => 'Fastelavn',
|
||||
Date.civil(2010,3,28) => 'Palmesøndag',
|
||||
Date.civil(2010,4,1) => 'Skjærtorsdag',
|
||||
Date.civil(2010,4,2) => 'Langfredag',
|
||||
Date.civil(2010,4,4) => '1. påskedag',
|
||||
Date.civil(2010,4,5) => '2. påskedag',
|
||||
Date.civil(2010,5,13) => 'Kristi Himmelfartsdag',
|
||||
Date.civil(2010,5,23) => '1. pinsedag',
|
||||
Date.civil(2010,5,24) => '2. pinsedag'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :no, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
{Date.civil(2011,1,1) => 'Nowy Rok',
|
||||
Date.civil(2011,5,1) => 'Święto Państwowe (Święto Pracy)',
|
||||
Date.civil(2011,5,3) => 'Święto Narodowe Trzeciego Maja',
|
||||
Date.civil(2011,11,1) => 'Wszystkich Świętych',
|
||||
Date.civil(2011,11,11) => 'Narodowe Święto Niepodległości',
|
||||
Date.civil(2011,12,25) => 'pierwszy dzień Bożego Narodzenia',
|
||||
Date.civil(2011,12,26) => 'drugi dzień Bożego Narodzenia'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :pl)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# informal
|
||||
{Date.civil(2011,1,21) => 'Dzień Babci',
|
||||
Date.civil(2011,1,22) => 'Dzień Dziadka',
|
||||
Date.civil(2011,2,2) => 'Ofiarowanie Pańskie (Matki Boskiej Gromnicznej)',
|
||||
Date.civil(2011,2,14) => 'Dzień Zakochanych (Walentynki)',
|
||||
Date.civil(2010,3,8) => 'Dzień Kobiet',
|
||||
Date.civil(2011,3,10) => 'Dzień Mężczyzn',
|
||||
Date.civil(2011,4,1) => 'Prima Aprilis',
|
||||
Date.civil(2010,4,22) => 'Międzynarodowy Dzień Ziemi',
|
||||
Date.civil(2011,5,2) => 'Dzień Flagi Rzeczpospolitej Polskiej',
|
||||
Date.civil(2010,6,23) => 'Dzień Ojca',
|
||||
Date.civil(2011,9,30) => 'Dzień Chłopaka',
|
||||
Date.civil(2011,10,14) => 'Dzień Nauczyciela (Dzień Edukacji Narodowej)',
|
||||
Date.civil(2011,11,2) => 'Dzień Zaduszny',
|
||||
Date.civil(2011,11,29) => 'Andrzejki',
|
||||
Date.civil(2011,12,4) => 'Barbórka (Dzień Górnika, Naftowca i Gazownika)',
|
||||
Date.civil(2011,12,6) => 'Mikołajki',
|
||||
Date.civil(2011,12,24) => 'Wigilia Bożego Narodzenia',
|
||||
Date.civil(2011,12,31) => 'Sylwester'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :pl, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# informal
|
||||
{Date.civil(2011,1,21) => 'Dzień Babci',
|
||||
Date.civil(2011,1,22) => 'Dzień Dziadka',
|
||||
Date.civil(2011,2,2) => 'Ofiarowanie Pańskie (Matki Boskiej Gromnicznej)',
|
||||
Date.civil(2011,2,14) => 'Dzień Zakochanych (Walentynki)',
|
||||
Date.civil(2010,3,8) => 'Dzień Kobiet',
|
||||
Date.civil(2011,3,10) => 'Dzień Mężczyzn',
|
||||
Date.civil(2011,4,1) => 'Prima Aprilis',
|
||||
Date.civil(2010,4,22) => 'Międzynarodowy Dzień Ziemi',
|
||||
Date.civil(2011,5,2) => 'Dzień Flagi Rzeczpospolitej Polskiej',
|
||||
Date.civil(2010,6,23) => 'Dzień Ojca',
|
||||
Date.civil(2011,9,30) => 'Dzień Chłopaka',
|
||||
Date.civil(2011,10,14) => 'Dzień Nauczyciela (Dzień Edukacji Narodowej)',
|
||||
Date.civil(2011,11,2) => 'Dzień Zaduszny',
|
||||
Date.civil(2011,11,29) => 'Andrzejki',
|
||||
Date.civil(2011,12,4) => 'Barbórka (Dzień Górnika, Naftowca i Gazownika)',
|
||||
Date.civil(2011,12,6) => 'Mikołajki',
|
||||
Date.civil(2011,12,24) => 'Wigilia Bożego Narodzenia',
|
||||
Date.civil(2011,12,31) => 'Sylwester'}.each do |date, name|
|
||||
assert_equal nil, (Holidays.on(date, :pl)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Objawienie Pańskie (święto Trzech Króli) -- formal since 2011
|
||||
[Date.civil(2008,1,6), Date.civil(2009,1,6), Date.civil(2010,1,6)].each do |date|
|
||||
assert_equal nil, (Holidays.on(date, :pl)[0] || {})[:name]
|
||||
end
|
||||
[Date.civil(2008,1,6), Date.civil(2009,1,6), Date.civil(2010,1,6)].each do |date|
|
||||
assert_equal 'Objawienie Pańskie (święto Trzech Króli)', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
|
||||
end
|
||||
[Date.civil(2011,1,6), Date.civil(2012,1,6), Date.civil(2013,1,6)].each do |date|
|
||||
assert_equal 'Objawienie Pańskie (święto Trzech Króli)', (Holidays.on(date, :pl)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Tłusty Czwartek
|
||||
[Date.civil(2008,1,31), Date.civil(2009,2,19), Date.civil(2010,2,11),
|
||||
Date.civil(2011,3,3), Date.civil(2012,2,16)].each do |date|
|
||||
assert_equal 'Tłusty Czwartek', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Ostatki
|
||||
[Date.civil(2008,2,5), Date.civil(2009,2,24), Date.civil(2010,2,16),
|
||||
Date.civil(2011,3,8), Date.civil(2012,2,21)].each do |date|
|
||||
assert_equal 'Ostatki', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Środa Popielcowa
|
||||
[Date.civil(2008,2,6), Date.civil(2009,2,25), Date.civil(2010,2,17),
|
||||
Date.civil(2011,3,9), Date.civil(2012,2,22)].each do |date|
|
||||
assert_equal 'Środa Popielcowa', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Niedziela Palmowa
|
||||
[Date.civil(2008,3,16), Date.civil(2009,4,5), Date.civil(2010,3,28),
|
||||
Date.civil(2011,4,17), Date.civil(2012,4,1)].each do |date|
|
||||
assert_equal 'Niedziela Palmowa', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Wielki Czwartek
|
||||
[Date.civil(2008,3,20), Date.civil(2009,4,9), Date.civil(2010,4,1),
|
||||
Date.civil(2011,4,21), Date.civil(2012,4,5)].each do |date|
|
||||
assert_equal 'Wielki Czwartek', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Wielki Piątek
|
||||
[Date.civil(2008,3,21), Date.civil(2009,4,10), Date.civil(2010,4,2),
|
||||
Date.civil(2011,4,22), Date.civil(2012,4,6)].each do |date|
|
||||
assert_equal 'Wielki Piątek', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Wielka Sobota
|
||||
[Date.civil(2008,3,22), Date.civil(2009,4,11), Date.civil(2010,4,3),
|
||||
Date.civil(2011,4,23), Date.civil(2012,4,7)].each do |date|
|
||||
assert_equal 'Wielka Sobota', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Niedziela Wielkanocna
|
||||
[Date.civil(2008,3,23), Date.civil(2009,4,12), Date.civil(2010,4,4),
|
||||
Date.civil(2011,4,24), Date.civil(2012,4,8)].each do |date|
|
||||
assert_equal 'Niedziela Wielkanocna', (Holidays.on(date, :pl)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Poniedziałek Wielkanocny (Lany Poniedziałek)
|
||||
[Date.civil(2008,3,24), Date.civil(2009,4,13), Date.civil(2010,4,5),
|
||||
Date.civil(2011,4,25), Date.civil(2012,4,9)].each do |date|
|
||||
assert_equal 'Poniedziałek Wielkanocny (Lany Poniedziałek)', (Holidays.on(date, :pl)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Zesłanie Ducha Świętego (Zielone Świątki)
|
||||
[Date.civil(2008,5,11), Date.civil(2009,5,31), Date.civil(2010,5,23),
|
||||
Date.civil(2011,6,12), Date.civil(2012,5,27)].each do |date|
|
||||
assert_equal 'Zesłanie Ducha Świętego (Zielone Świątki)', (Holidays.on(date, :pl)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Uroczystość Najświętszego Ciała i Krwi Pańskiej (Boże Ciało)
|
||||
[Date.civil(2008,5,22), Date.civil(2009,6,11), Date.civil(2010,6,3),
|
||||
Date.civil(2011,6,23), Date.civil(2012,6,7)].each do |date|
|
||||
assert_equal 'Uroczystość Najświętszego Ciała i Krwi Pańskiej (Boże Ciało)', (Holidays.on(date, :pl)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Wniebowzięcie Najświętszej Maryi Panny & Święto Wojska Polskiego
|
||||
assert_equal 'Wniebowzięcie Najświętszej Maryi Panny', (Holidays.on(Date.civil(2011,8,15), :pl)[0] || {})[:name]
|
||||
assert_equal 'Święto Wojska Polskiego', (Holidays.on(Date.civil(2011,8,15), :pl)[1] || {})[:name]
|
||||
|
||||
{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,21) => 'Sexta-feira Santa',
|
||||
Date.civil(2008,3,23) => '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, :informal)[0] || {})[:name]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
# encoding: utf-8
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/fi.yaml
|
||||
class FiDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_fi
|
||||
{Date.civil(2008,1,1) => 'Uudenvuodenpäivä',
|
||||
Date.civil(2008,1,6) => 'Loppiainen',
|
||||
Date.civil(2008,3,21) => 'Pitkäperjantai',
|
||||
Date.civil(2008,3,23) => 'Pääsiäispäivä',
|
||||
Date.civil(2008,3,24) => '2. Pääsiäispäivä',
|
||||
Date.civil(2008,5,1) => 'Vappu',
|
||||
Date.civil(2008,5,1) => 'Helatorstai',
|
||||
Date.civil(2008,5,11) => 'Helluntaipäivä',
|
||||
Date.civil(2005,6,25) => 'Juhannuspäivä',
|
||||
Date.civil(2006,6,24) => 'Juhannuspäivä',
|
||||
Date.civil(2007,6,23) => 'Juhannuspäivä',
|
||||
Date.civil(2008,6,21) => 'Juhannuspäivä',
|
||||
Date.civil(2005,11,5) => 'Pyhäinpäivä',
|
||||
Date.civil(2006,11,4) => 'Pyhäinpäivä',
|
||||
Date.civil(2007,11,3) => 'Pyhäinpäivä',
|
||||
Date.civil(2008,11,1) => 'Pyhäinpäivä',
|
||||
Date.civil(2008,12,6) => 'Itsenäisyyspäivä',
|
||||
Date.civil(2008,12,24) => 'Jouluaatto',
|
||||
Date.civil(2008,12,25) => 'Joulupäivä',
|
||||
Date.civil(2008,12,26) => 'Tapaninpäivä'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :fi, :informal)[0] || {})[:name]
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,26 +1,26 @@
|
|||
require File.dirname(__FILE__) + '/../test_helper'
|
||||
require 'holidays/fr'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/fr.yaml
|
||||
class FrDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_fr
|
||||
{Date.civil(2007,1,1) => 'Jour de l\'an',
|
||||
Date.civil(2007,4,8) => 'Pâques',
|
||||
Date.civil(2007,4,9) => 'Lundi de Pâques',
|
||||
Date.civil(2007,5,1) => 'Fête du travail',
|
||||
Date.civil(2007,5,8) => 'Victoire 1945',
|
||||
Date.civil(2007,5,17) => 'Ascension',
|
||||
Date.civil(2007,5,27) => 'Pentecôte',
|
||||
Date.civil(2007,5,28) => 'Lundi de Pentecôte',
|
||||
Date.civil(2007,7,14) => 'Fête nationale',
|
||||
Date.civil(2007,8,15) => 'Assomption',
|
||||
Date.civil(2007,11,1) => 'Toussaint',
|
||||
Date.civil(2007,11,11) => 'Armistice 1918',
|
||||
Date.civil(2007,12,25) => 'Nöel'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :fr, :informal)[0][:name]
|
||||
end
|
||||
end
|
||||
end
|
||||
# encoding: utf-8
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/fr.yaml
|
||||
class FrDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_fr
|
||||
{Date.civil(2007,1,1) => 'Jour de l\'an',
|
||||
Date.civil(2007,4,8) => 'Pâques',
|
||||
Date.civil(2007,4,9) => 'Lundi de Pâques',
|
||||
Date.civil(2007,5,1) => 'Fête du travail',
|
||||
Date.civil(2007,5,8) => 'Victoire 1945',
|
||||
Date.civil(2007,5,17) => 'Ascension',
|
||||
Date.civil(2007,5,27) => 'Pentecôte',
|
||||
Date.civil(2007,5,28) => 'Lundi de Pentecôte',
|
||||
Date.civil(2007,7,14) => 'Fête nationale',
|
||||
Date.civil(2007,8,15) => 'Assomption',
|
||||
Date.civil(2007,11,1) => 'Toussaint',
|
||||
Date.civil(2007,11,11) => 'Armistice 1918',
|
||||
Date.civil(2007,12,25) => 'Nöel'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :fr, :informal)[0] || {})[:name]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,36 +1,36 @@
|
|||
require File.dirname(__FILE__) + '/../test_helper'
|
||||
require 'holidays/gb'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/gb.yaml
|
||||
class GbDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_gb
|
||||
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
||||
Date.civil(2008,3,21) => 'Good Friday',
|
||||
Date.civil(2008,3,23) => 'Easter Sunday',
|
||||
Date.civil(2008,5,5) => 'May Day',
|
||||
Date.civil(2008,5,26) => 'Bank Holiday',
|
||||
Date.civil(2008,11,5) => 'Guy Fawkes Day',
|
||||
Date.civil(2008,12,25) => 'Christmas Day',
|
||||
Date.civil(2008,12,26) => 'Boxing Day'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :gb, :informal)[0][:name]
|
||||
end
|
||||
|
||||
assert_equal 'St. Patrick\'s Day', Date.civil(2008,3,17).holidays(:gb_nir, :informal)[0][:name]
|
||||
|
||||
assert_equal 'Christmas Day', Date.civil(2008,12,25).holidays(:gb_, :observed)[0][:name]
|
||||
assert_equal 'Christmas Day', Date.civil(2009,12,25).holidays(:gb_, :observed)[0][:name]
|
||||
assert_equal 'Christmas Day', Date.civil(2010,12,27).holidays(:gb_, :observed)[0][:name]
|
||||
|
||||
assert_equal 'Boxing Day', Date.civil(2008,12,26).holidays(:gb_, :observed)[0][:name]
|
||||
assert_equal 'Boxing Day', Date.civil(2009,12,28).holidays(:gb_, :observed)[0][:name]
|
||||
assert_equal 'Boxing Day', Date.civil(2010,12,28).holidays(:gb_, :observed)[0][:name]
|
||||
|
||||
[:gb_wls, :gb_eng, :gb_nir, :gb_eaw, :gb_].each do |r|
|
||||
assert_equal 'Easter Monday', Date.civil(2008,3,24).holidays(r)[0][:name]
|
||||
assert_equal 'Bank Holiday', Date.civil(2008,8,25).holidays(r)[0][:name]
|
||||
end
|
||||
end
|
||||
end
|
||||
# encoding: utf-8
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/gb.yaml
|
||||
class GbDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_gb
|
||||
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
||||
Date.civil(2008,3,21) => 'Good Friday',
|
||||
Date.civil(2008,3,23) => 'Easter Sunday',
|
||||
Date.civil(2008,5,5) => 'May Day',
|
||||
Date.civil(2008,5,26) => 'Bank Holiday',
|
||||
Date.civil(2008,11,5) => 'Guy Fawkes Day',
|
||||
Date.civil(2008,12,25) => 'Christmas Day',
|
||||
Date.civil(2008,12,26) => 'Boxing Day'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :gb, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
assert_equal 'St. Patrick\'s Day', Date.civil(2008,3,17).holidays(:gb_nir, :informal)[0][:name]
|
||||
|
||||
assert_equal 'Christmas Day', Date.civil(2008,12,25).holidays(:gb_, :observed)[0][:name]
|
||||
assert_equal 'Christmas Day', Date.civil(2009,12,25).holidays(:gb_, :observed)[0][:name]
|
||||
assert_equal 'Christmas Day', Date.civil(2010,12,27).holidays(:gb_, :observed)[0][:name]
|
||||
|
||||
assert_equal 'Boxing Day', Date.civil(2008,12,26).holidays(:gb_, :observed)[0][:name]
|
||||
assert_equal 'Boxing Day', Date.civil(2009,12,28).holidays(:gb_, :observed)[0][:name]
|
||||
assert_equal 'Boxing Day', Date.civil(2010,12,28).holidays(:gb_, :observed)[0][:name]
|
||||
|
||||
[:gb_wls, :gb_eng, :gb_nir, :gb_eaw, :gb_].each do |r|
|
||||
assert_equal 'Easter Monday', Date.civil(2008,3,24).holidays(r)[0][:name]
|
||||
assert_equal 'Bank Holiday', Date.civil(2008,8,25).holidays(r)[0][:name]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
require File.dirname(__FILE__) + '/../test_helper'
|
||||
require 'holidays/ie'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/ie.yaml
|
||||
class IeDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_ie
|
||||
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
||||
Date.civil(2008,3,17) => 'St. Patrick\'s Day',
|
||||
Date.civil(2008,3,24) => 'Easter Monday',
|
||||
Date.civil(2008,5,5) => 'May Day',
|
||||
Date.civil(2008,6,2) => 'Bank Holiday',
|
||||
Date.civil(2008,8,4) => 'Bank Holiday',
|
||||
Date.civil(2008,12,25) => 'Christmas Day',
|
||||
Date.civil(2008,12,26) => 'St. Stephen\'s Day'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :ie, :informal)[0][:name]
|
||||
end
|
||||
end
|
||||
end
|
||||
# encoding: utf-8
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/ie.yaml
|
||||
class IeDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_ie
|
||||
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
||||
Date.civil(2008,3,17) => 'St. Patrick\'s Day',
|
||||
Date.civil(2008,3,24) => 'Easter Monday',
|
||||
Date.civil(2008,5,5) => 'May Day',
|
||||
Date.civil(2008,6,2) => 'Bank Holiday',
|
||||
Date.civil(2008,8,4) => 'Bank Holiday',
|
||||
Date.civil(2008,12,25) => 'Christmas Day',
|
||||
Date.civil(2008,12,26) => 'St. Stephen\'s Day'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :ie, :informal)[0] || {})[:name]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,33 +1,33 @@
|
|||
require File.dirname(__FILE__) + '/../test_helper'
|
||||
require 'holidays/is'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/is.yaml
|
||||
class IsDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_is
|
||||
{Date.civil(2007,1,1) => 'Nýársdagur',
|
||||
Date.civil(2007,1,6) => 'Þrettándinn',
|
||||
Date.civil(2007,1,19) => 'Bóndadagur',
|
||||
Date.civil(2007,2,18) => 'Konudagur',
|
||||
Date.civil(2007,4,5) => 'Skírdagur',
|
||||
Date.civil(2007,4,6) => 'Föstudaginn langi',
|
||||
Date.civil(2007,4,8) => 'Páskadagur',
|
||||
Date.civil(2007,4,9) => 'Annar í páskum',
|
||||
Date.civil(2007,4,19) => 'Sumardagurinn fyrsti',
|
||||
Date.civil(2007,5,1) => 'Verkalýðsdagurinn',
|
||||
Date.civil(2007,5,17) => 'Uppstigningardagur',
|
||||
Date.civil(2007,5,27) => 'Hvítasunnudagur',
|
||||
Date.civil(2007,5,28) => 'Annar í hvítasunnu',
|
||||
Date.civil(2007,6,3) => 'Sjómannadagurinn',
|
||||
Date.civil(2007,6,17) => 'Lýðveldisdagurinn',
|
||||
Date.civil(2007,8,6) => 'Frídagur verslunarmanna',
|
||||
Date.civil(2007,12,24) => 'Jól',
|
||||
Date.civil(2007,12,25) => 'Jól',
|
||||
Date.civil(2007,12,26) => 'Jól',
|
||||
Date.civil(2007,12,31) => 'Gamlárskvöld'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :is, :informal)[0][:name]
|
||||
end
|
||||
end
|
||||
end
|
||||
# encoding: utf-8
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/is.yaml
|
||||
class IsDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_is
|
||||
{Date.civil(2007,1,1) => 'Nýársdagur',
|
||||
Date.civil(2007,1,6) => 'Þrettándinn',
|
||||
Date.civil(2007,1,19) => 'Bóndadagur',
|
||||
Date.civil(2007,2,18) => 'Konudagur',
|
||||
Date.civil(2007,4,5) => 'Skírdagur',
|
||||
Date.civil(2007,4,6) => 'Föstudaginn langi',
|
||||
Date.civil(2007,4,8) => 'Páskadagur',
|
||||
Date.civil(2007,4,9) => 'Annar í páskum',
|
||||
Date.civil(2007,4,19) => 'Sumardagurinn fyrsti',
|
||||
Date.civil(2007,5,1) => 'Verkalýðsdagurinn',
|
||||
Date.civil(2007,5,17) => 'Uppstigningardagur',
|
||||
Date.civil(2007,5,27) => 'Hvítasunnudagur',
|
||||
Date.civil(2007,5,28) => 'Annar í hvítasunnu',
|
||||
Date.civil(2007,6,3) => 'Sjómannadagurinn',
|
||||
Date.civil(2007,6,17) => 'Lýðveldisdagurinn',
|
||||
Date.civil(2007,8,6) => 'Frídagur verslunarmanna',
|
||||
Date.civil(2007,12,24) => 'Jól',
|
||||
Date.civil(2007,12,25) => 'Jól',
|
||||
Date.civil(2007,12,26) => 'Jól',
|
||||
Date.civil(2007,12,31) => 'Gamlárskvöld'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :is, :informal)[0] || {})[:name]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
require File.dirname(__FILE__) + '/../test_helper'
|
||||
require 'holidays/it'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/it.yaml
|
||||
class ItDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_it
|
||||
{Date.civil(2007,1,1) => 'Capodanno',
|
||||
Date.civil(2007,1,6) => 'Epifania',
|
||||
Date.civil(2007,4,8) => 'Pasqua',
|
||||
Date.civil(2007,4,9) => 'Lunedì dell\'Angelo',
|
||||
Date.civil(2007,4,25) => 'Festa della Liberazione',
|
||||
Date.civil(2007,5,1) => 'Festa dei Lavoratori',
|
||||
Date.civil(2007,6,2) => 'Festa della Repubblica',
|
||||
Date.civil(2007,8,15) => 'Assunzione',
|
||||
Date.civil(2007,11,1) => 'Ognissanti',
|
||||
Date.civil(2007,12,8) => 'Immacolata Concezione',
|
||||
Date.civil(2007,12,25) => 'Natale',
|
||||
Date.civil(2007,12,26) => 'Santo Stefano'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :it, :informal)[0][:name]
|
||||
end
|
||||
end
|
||||
end
|
||||
# encoding: utf-8
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/it.yaml
|
||||
class ItDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_it
|
||||
{Date.civil(2007,1,1) => 'Capodanno',
|
||||
Date.civil(2007,1,6) => 'Epifania',
|
||||
Date.civil(2007,4,8) => 'Pasqua',
|
||||
Date.civil(2007,4,9) => 'Lunedì dell\'Angelo',
|
||||
Date.civil(2007,4,25) => 'Festa della Liberazione',
|
||||
Date.civil(2007,5,1) => 'Festa dei Lavoratori',
|
||||
Date.civil(2007,6,2) => 'Festa della Repubblica',
|
||||
Date.civil(2007,8,15) => 'Assunzione',
|
||||
Date.civil(2007,11,1) => 'Ognissanti',
|
||||
Date.civil(2007,12,8) => 'Immacolata Concezione',
|
||||
Date.civil(2007,12,25) => 'Natale',
|
||||
Date.civil(2007,12,26) => 'Santo Stefano'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :it, :informal)[0] || {})[:name]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
# encoding: utf-8
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/jp.yaml
|
||||
class JpDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_jp
|
||||
{Date.civil(2008,1,1) => '元日',
|
||||
Date.civil(2010,1,11) => '成人の日',
|
||||
Date.civil(2008,2,11) => '建国記念日',
|
||||
Date.civil(2008,4,29) => '昭和の日',
|
||||
Date.civil(2008,5,3) => '憲法記念日',
|
||||
Date.civil(2008,5,5) => 'こどもの日',
|
||||
Date.civil(2010,7,19) => '海の日',
|
||||
Date.civil(2010,9,20) => '敬老の日',
|
||||
Date.civil(2010,10,11) => '体育の日',
|
||||
Date.civil(2008,11,3) => '文化の日',
|
||||
Date.civil(2008,11,23) => '勤労感謝の日',
|
||||
Date.civil(2008,12,23) => '天皇誕生日',
|
||||
Date.civil(2010,3,22) => '振替休日',
|
||||
Date.civil(2008,11,24) => '振替休日',
|
||||
}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :jp, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# vernal equinox day
|
||||
[Date.civil(2004,3,20), Date.civil(2005,3,20), Date.civil(2006,3,21),
|
||||
Date.civil(2007,3,21), Date.civil(2008,3,20), Date.civil(2009,3,20),
|
||||
Date.civil(2010,3,21)].each do |date|
|
||||
assert_equal '春分の日', Holidays.on(date, :jp)[0][:name]
|
||||
end
|
||||
|
||||
# national culture day
|
||||
[Date.civil(2004,9,23), Date.civil(2005,9,23), Date.civil(2006,9,23),
|
||||
Date.civil(2007,9,23), Date.civil(2008,9,23), Date.civil(2009,9,23),
|
||||
Date.civil(2010,9,23), Date.civil(2011,9,23), Date.civil(2012,9,22),
|
||||
Date.civil(2013,9,23)].each do |date|
|
||||
assert_equal '秋分の日', Holidays.on(date, :jp)[0][:name]
|
||||
end
|
||||
|
||||
# citizens holiday
|
||||
[Date.civil(2032,9,21), Date.civil(2049,9,21), Date.civil(2009,9,22),
|
||||
Date.civil(2015,9,22), Date.civil(2026,9,22)].each do |date|
|
||||
assert_equal '国民の休日', Holidays.on(date, :jp)[0][:name]
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -0,0 +1,35 @@
|
|||
# encoding: utf-8
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/li.yaml
|
||||
class LiDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_li
|
||||
{Date.civil(2009,1,1) => 'Neujahrstag',
|
||||
Date.civil(2011,3,8) => 'Fasnachtsdienstag',
|
||||
Date.civil(2009,4,10) => 'Karfreitag',
|
||||
Date.civil(2009,4,12) => 'Ostern',
|
||||
Date.civil(2009,4,13) => 'Ostermontag',
|
||||
Date.civil(2009,5,21) => 'Auffahrt',
|
||||
Date.civil(2009,6,1) => 'Pfingstmontag',
|
||||
Date.civil(2009,12,25) => 'Weihnachten',
|
||||
Date.civil(2009,12,26) => 'Stefanstag'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :li, :informal)[0][:name]
|
||||
end
|
||||
|
||||
[:li].each do |r|
|
||||
assert_equal 'Fronleichnam', Date.civil(2009,6,11).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:li].each do |r|
|
||||
assert_equal 'Staatsfeiertag', Date.civil(2009,8,15).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
[:li].each do |r|
|
||||
assert_equal 'Allerheiligen', Date.civil(2009,11,1).holidays(r)[0][:name]
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -1,22 +1,22 @@
|
|||
require File.dirname(__FILE__) + '/../test_helper'
|
||||
require 'holidays/mx'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/mx.yaml, data/north_america_informal.yaml
|
||||
class MxDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_mx
|
||||
{Date.civil(2007,1,1) => 'Año nuevo',
|
||||
Date.civil(2007,2,5) => 'Día de la Constitución',
|
||||
Date.civil(2007,5,1) => 'Día del Trabajo',
|
||||
Date.civil(2007,5,5) => 'Cinco de Mayo',
|
||||
Date.civil(2007,9,16) => 'Día de la Independencia',
|
||||
Date.civil(2007,11,1) => 'Todos los Santos',
|
||||
Date.civil(2007,11,2) => 'Los Fieles Difuntos',
|
||||
Date.civil(2007,11,19) => 'Día de la Revolución',
|
||||
Date.civil(2007,12,25) => 'Navidad'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :mx, :informal)[0][:name]
|
||||
end
|
||||
end
|
||||
end
|
||||
# encoding: utf-8
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/mx.yaml, data/north_america_informal.yaml
|
||||
class MxDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_mx
|
||||
{Date.civil(2007,1,1) => 'Año nuevo',
|
||||
Date.civil(2007,2,5) => 'Día de la Constitución',
|
||||
Date.civil(2007,5,1) => 'Día del Trabajo',
|
||||
Date.civil(2007,5,5) => 'Cinco de Mayo',
|
||||
Date.civil(2007,9,16) => 'Día de la Independencia',
|
||||
Date.civil(2007,11,1) => 'Todos los Santos',
|
||||
Date.civil(2007,11,2) => 'Los Fieles Difuntos',
|
||||
Date.civil(2007,11,19) => 'Día de la Revolución',
|
||||
Date.civil(2007,12,25) => 'Navidad'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :mx, :informal)[0] || {})[:name]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
require File.dirname(__FILE__) + '/../test_helper'
|
||||
require 'holidays/nl'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/nl.yaml
|
||||
class NlDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_nl
|
||||
{Date.civil(2008,1,1) => 'Nieuwjaar',
|
||||
Date.civil(2008,3,21) => 'Goede Vrijdag',
|
||||
Date.civil(2008,3,23) => 'Pasen',
|
||||
Date.civil(2008,3,24) => 'Pasen',
|
||||
Date.civil(2008,4,30) => 'Koninginnedag',
|
||||
Date.civil(2008,5,1) => 'Hemelvaartsdag', # Ascension, Easter+39
|
||||
Date.civil(2008,5,5) => 'Bevrijdingsdag',
|
||||
Date.civil(2008,5,11) => 'Pinksteren', # Pentecost, Easter+49
|
||||
Date.civil(2008,5,12) => 'Pinksteren', # Pentecost, Easter+50
|
||||
Date.civil(2008,12,25) => 'Kerstmis',
|
||||
Date.civil(2008,12,26) => 'Kerstmis'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :nl, :informal)[0][:name]
|
||||
end
|
||||
end
|
||||
end
|
||||
# encoding: utf-8
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/nl.yaml
|
||||
class NlDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_nl
|
||||
{Date.civil(2008,1,1) => 'Nieuwjaar',
|
||||
Date.civil(2008,3,21) => 'Goede Vrijdag',
|
||||
Date.civil(2008,3,23) => 'Pasen',
|
||||
Date.civil(2008,3,24) => 'Pasen',
|
||||
Date.civil(2008,4,30) => 'Koninginnedag',
|
||||
Date.civil(2008,5,1) => 'Hemelvaartsdag', # Ascension, Easter+39
|
||||
Date.civil(2008,5,5) => 'Bevrijdingsdag',
|
||||
Date.civil(2008,5,11) => 'Pinksteren', # Pentecost, Easter+49
|
||||
Date.civil(2008,5,12) => 'Pinksteren', # Pentecost, Easter+50
|
||||
Date.civil(2008,12,25) => 'Kerstmis',
|
||||
Date.civil(2008,12,26) => 'Kerstmis'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :nl, :informal)[0] || {})[:name]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
# encoding: utf-8
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/no.yaml
|
||||
class NoDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_no
|
||||
{Date.civil(2010,1,1) => 'Nyttårsdag',
|
||||
Date.civil(2010,5,1) => '1. mai',
|
||||
Date.civil(2010,5,17) => '17. mai',
|
||||
Date.civil(2010,12,24) => 'Julaften',
|
||||
Date.civil(2010,12,25) => '1. juledag',
|
||||
Date.civil(2010,12,26) => '2. juledag',
|
||||
Date.civil(2010,12,31) => 'Nyttårsaften',
|
||||
Date.civil(2010,2,14) => 'Fastelavn',
|
||||
Date.civil(2010,3,28) => 'Palmesøndag',
|
||||
Date.civil(2010,4,1) => 'Skjærtorsdag',
|
||||
Date.civil(2010,4,2) => 'Langfredag',
|
||||
Date.civil(2010,4,4) => '1. påskedag',
|
||||
Date.civil(2010,4,5) => '2. påskedag',
|
||||
Date.civil(2010,5,13) => 'Kristi Himmelfartsdag',
|
||||
Date.civil(2010,5,23) => '1. pinsedag',
|
||||
Date.civil(2010,5,24) => '2. pinsedag'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :no, :informal)[0] || {})[:name]
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,54 +1,54 @@
|
|||
require File.dirname(__FILE__) + '/../test_helper'
|
||||
require 'holidays/north_america'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/ca.yaml, data/mx.yaml, data/us.yaml, data/north_america_informal.yaml
|
||||
class North_americaDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_north_america
|
||||
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
||||
Date.civil(2008,3,21) => 'Good Friday',
|
||||
Date.civil(2008,3,24) => 'Easter Monday',
|
||||
Date.civil(2008,5,19) => 'Victoria Day',
|
||||
Date.civil(2008,7,1) => 'Canada Day',
|
||||
Date.civil(2008,9,1) => 'Labour Day',
|
||||
Date.civil(2008,10,13) => 'Thanksgiving',
|
||||
Date.civil(2008,11,11) => 'Rememberance Day',
|
||||
Date.civil(2008,12,25) => 'Christmas Day',
|
||||
Date.civil(2008,12,26) => 'Boxing Day'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :ca, :informal)[0][:name]
|
||||
end
|
||||
|
||||
# Victoria Day
|
||||
[Date.civil(2004,5,24), Date.civil(2005,5,23), Date.civil(2006,5,22),
|
||||
Date.civil(2007,5,21), Date.civil(2008,5,19)].each do |date|
|
||||
assert_equal 'Victoria Day', Holidays.on(date, :ca)[0][:name]
|
||||
end
|
||||
|
||||
{Date.civil(2007,1,1) => 'Año nuevo',
|
||||
Date.civil(2007,2,5) => 'Día de la Constitución',
|
||||
Date.civil(2007,5,1) => 'Día del Trabajo',
|
||||
Date.civil(2007,5,5) => 'Cinco de Mayo',
|
||||
Date.civil(2007,9,16) => 'Día de la Independencia',
|
||||
Date.civil(2007,11,1) => 'Todos los Santos',
|
||||
Date.civil(2007,11,2) => 'Los Fieles Difuntos',
|
||||
Date.civil(2007,11,19) => 'Día de la Revolución',
|
||||
Date.civil(2007,12,25) => 'Navidad'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :mx, :informal)[0][:name]
|
||||
end
|
||||
|
||||
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
||||
Date.civil(2008,1,21) => 'Martin Luther King, Jr. Day',
|
||||
Date.civil(2008,2,18) => 'Presidents\' Day',
|
||||
Date.civil(2008,5,26) => 'Memorial Day',
|
||||
Date.civil(2008,7,4) => 'Independence Day',
|
||||
Date.civil(2008,9,1) => 'Labor Day',
|
||||
Date.civil(2008,10,13) => 'Columbus Day',
|
||||
Date.civil(2008,11,11) => 'Veterans Day',
|
||||
Date.civil(2008,11,27) => 'Thanksgiving',
|
||||
Date.civil(2008,12,25) => 'Christmas Day'}.each do |date, name|
|
||||
assert_equal name, Holidays.on(date, :us)[0][:name]
|
||||
end
|
||||
end
|
||||
end
|
||||
# encoding: utf-8
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/ca.yaml, data/mx.yaml, data/us.yaml, data/north_america_informal.yaml
|
||||
class North_americaDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_north_america
|
||||
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
||||
Date.civil(2008,3,21) => 'Good Friday',
|
||||
Date.civil(2008,3,24) => 'Easter Monday',
|
||||
Date.civil(2008,5,19) => 'Victoria Day',
|
||||
Date.civil(2008,7,1) => 'Canada Day',
|
||||
Date.civil(2008,9,1) => 'Labour Day',
|
||||
Date.civil(2008,10,13) => 'Thanksgiving',
|
||||
Date.civil(2008,11,11) => 'Remembrance Day',
|
||||
Date.civil(2008,12,25) => 'Christmas Day',
|
||||
Date.civil(2008,12,26) => 'Boxing Day'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :ca, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Victoria Day
|
||||
[Date.civil(2004,5,24), Date.civil(2005,5,23), Date.civil(2006,5,22),
|
||||
Date.civil(2007,5,21), Date.civil(2008,5,19)].each do |date|
|
||||
assert_equal 'Victoria Day', Holidays.on(date, :ca)[0][:name]
|
||||
end
|
||||
|
||||
{Date.civil(2007,1,1) => 'Año nuevo',
|
||||
Date.civil(2007,2,5) => 'Día de la Constitución',
|
||||
Date.civil(2007,5,1) => 'Día del Trabajo',
|
||||
Date.civil(2007,5,5) => 'Cinco de Mayo',
|
||||
Date.civil(2007,9,16) => 'Día de la Independencia',
|
||||
Date.civil(2007,11,1) => 'Todos los Santos',
|
||||
Date.civil(2007,11,2) => 'Los Fieles Difuntos',
|
||||
Date.civil(2007,11,19) => 'Día de la Revolución',
|
||||
Date.civil(2007,12,25) => 'Navidad'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :mx, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
||||
Date.civil(2008,1,21) => 'Martin Luther King, Jr. Day',
|
||||
Date.civil(2008,2,18) => 'Presidents\' Day',
|
||||
Date.civil(2008,5,26) => 'Memorial Day',
|
||||
Date.civil(2008,7,4) => 'Independence Day',
|
||||
Date.civil(2008,9,1) => 'Labor Day',
|
||||
Date.civil(2008,10,13) => 'Columbus Day',
|
||||
Date.civil(2008,11,11) => 'Veterans Day',
|
||||
Date.civil(2008,11,27) => 'Thanksgiving',
|
||||
Date.civil(2008,12,25) => 'Christmas Day'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :us)[0] || {})[:name]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
# encoding: utf-8
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/nyse.yaml
|
||||
class NyseDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_nyse
|
||||
{Date.civil(2008,1,1) => 'New Year\'s Day',
|
||||
Date.civil(2008,1,21) => 'Martin Luther King, Jr. Day',
|
||||
Date.civil(2008,2,18) => 'Presidents\' Day',
|
||||
Date.civil(2008,3,21) => 'Good Friday',
|
||||
Date.civil(2008,5,26) => 'Memorial Day',
|
||||
Date.civil(2008,7,4) => 'Independence Day',
|
||||
Date.civil(2008,9,1) => 'Labor Day',
|
||||
Date.civil(2008,11,27) => 'Thanksgiving',
|
||||
Date.civil(2008,12,25) => 'Christmas Day'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :nyse)[0] || {})[:name]
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,22 @@
|
|||
# encoding: utf-8
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/nz.yaml
|
||||
class NzDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_nz
|
||||
{Date.civil(2007,1,1) => 'New Year\'s Day',
|
||||
Date.civil(2007,1,2) => 'Day after New Year\'s Day',
|
||||
Date.civil(2007,2,6) => 'Waitangi Day',
|
||||
Date.civil(2007,4,6) => 'Good Friday',
|
||||
Date.civil(2007,4,9) => 'Easter Monday',
|
||||
Date.civil(2007,4,25) => 'ANZAC Day',
|
||||
Date.civil(2007,12,25) => 'Christmas Day',
|
||||
Date.civil(2007,12,26) => 'Boxing Day'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :nz, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -0,0 +1,145 @@
|
|||
# encoding: utf-8
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/pl.yaml
|
||||
class PlDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_pl
|
||||
{Date.civil(2011,1,1) => 'Nowy Rok',
|
||||
Date.civil(2011,5,1) => 'Święto Państwowe (Święto Pracy)',
|
||||
Date.civil(2011,5,3) => 'Święto Narodowe Trzeciego Maja',
|
||||
Date.civil(2011,11,1) => 'Wszystkich Świętych',
|
||||
Date.civil(2011,11,11) => 'Narodowe Święto Niepodległości',
|
||||
Date.civil(2011,12,25) => 'pierwszy dzień Bożego Narodzenia',
|
||||
Date.civil(2011,12,26) => 'drugi dzień Bożego Narodzenia'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :pl)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# informal
|
||||
{Date.civil(2011,1,21) => 'Dzień Babci',
|
||||
Date.civil(2011,1,22) => 'Dzień Dziadka',
|
||||
Date.civil(2011,2,2) => 'Ofiarowanie Pańskie (Matki Boskiej Gromnicznej)',
|
||||
Date.civil(2011,2,14) => 'Dzień Zakochanych (Walentynki)',
|
||||
Date.civil(2010,3,8) => 'Dzień Kobiet',
|
||||
Date.civil(2011,3,10) => 'Dzień Mężczyzn',
|
||||
Date.civil(2011,4,1) => 'Prima Aprilis',
|
||||
Date.civil(2010,4,22) => 'Międzynarodowy Dzień Ziemi',
|
||||
Date.civil(2011,5,2) => 'Dzień Flagi Rzeczpospolitej Polskiej',
|
||||
Date.civil(2010,6,23) => 'Dzień Ojca',
|
||||
Date.civil(2011,9,30) => 'Dzień Chłopaka',
|
||||
Date.civil(2011,10,14) => 'Dzień Nauczyciela (Dzień Edukacji Narodowej)',
|
||||
Date.civil(2011,11,2) => 'Dzień Zaduszny',
|
||||
Date.civil(2011,11,29) => 'Andrzejki',
|
||||
Date.civil(2011,12,4) => 'Barbórka (Dzień Górnika, Naftowca i Gazownika)',
|
||||
Date.civil(2011,12,6) => 'Mikołajki',
|
||||
Date.civil(2011,12,24) => 'Wigilia Bożego Narodzenia',
|
||||
Date.civil(2011,12,31) => 'Sylwester'}.each do |date, name|
|
||||
assert_equal name, (Holidays.on(date, :pl, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# informal
|
||||
{Date.civil(2011,1,21) => 'Dzień Babci',
|
||||
Date.civil(2011,1,22) => 'Dzień Dziadka',
|
||||
Date.civil(2011,2,2) => 'Ofiarowanie Pańskie (Matki Boskiej Gromnicznej)',
|
||||
Date.civil(2011,2,14) => 'Dzień Zakochanych (Walentynki)',
|
||||
Date.civil(2010,3,8) => 'Dzień Kobiet',
|
||||
Date.civil(2011,3,10) => 'Dzień Mężczyzn',
|
||||
Date.civil(2011,4,1) => 'Prima Aprilis',
|
||||
Date.civil(2010,4,22) => 'Międzynarodowy Dzień Ziemi',
|
||||
Date.civil(2011,5,2) => 'Dzień Flagi Rzeczpospolitej Polskiej',
|
||||
Date.civil(2010,6,23) => 'Dzień Ojca',
|
||||
Date.civil(2011,9,30) => 'Dzień Chłopaka',
|
||||
Date.civil(2011,10,14) => 'Dzień Nauczyciela (Dzień Edukacji Narodowej)',
|
||||
Date.civil(2011,11,2) => 'Dzień Zaduszny',
|
||||
Date.civil(2011,11,29) => 'Andrzejki',
|
||||
Date.civil(2011,12,4) => 'Barbórka (Dzień Górnika, Naftowca i Gazownika)',
|
||||
Date.civil(2011,12,6) => 'Mikołajki',
|
||||
Date.civil(2011,12,24) => 'Wigilia Bożego Narodzenia',
|
||||
Date.civil(2011,12,31) => 'Sylwester'}.each do |date, name|
|
||||
assert_equal nil, (Holidays.on(date, :pl)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Objawienie Pańskie (święto Trzech Króli) -- formal since 2011
|
||||
[Date.civil(2008,1,6), Date.civil(2009,1,6), Date.civil(2010,1,6)].each do |date|
|
||||
assert_equal nil, (Holidays.on(date, :pl)[0] || {})[:name]
|
||||
end
|
||||
[Date.civil(2008,1,6), Date.civil(2009,1,6), Date.civil(2010,1,6)].each do |date|
|
||||
assert_equal 'Objawienie Pańskie (święto Trzech Króli)', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
|
||||
end
|
||||
[Date.civil(2011,1,6), Date.civil(2012,1,6), Date.civil(2013,1,6)].each do |date|
|
||||
assert_equal 'Objawienie Pańskie (święto Trzech Króli)', (Holidays.on(date, :pl)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Tłusty Czwartek
|
||||
[Date.civil(2008,1,31), Date.civil(2009,2,19), Date.civil(2010,2,11),
|
||||
Date.civil(2011,3,3), Date.civil(2012,2,16)].each do |date|
|
||||
assert_equal 'Tłusty Czwartek', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Ostatki
|
||||
[Date.civil(2008,2,5), Date.civil(2009,2,24), Date.civil(2010,2,16),
|
||||
Date.civil(2011,3,8), Date.civil(2012,2,21)].each do |date|
|
||||
assert_equal 'Ostatki', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Środa Popielcowa
|
||||
[Date.civil(2008,2,6), Date.civil(2009,2,25), Date.civil(2010,2,17),
|
||||
Date.civil(2011,3,9), Date.civil(2012,2,22)].each do |date|
|
||||
assert_equal 'Środa Popielcowa', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Niedziela Palmowa
|
||||
[Date.civil(2008,3,16), Date.civil(2009,4,5), Date.civil(2010,3,28),
|
||||
Date.civil(2011,4,17), Date.civil(2012,4,1)].each do |date|
|
||||
assert_equal 'Niedziela Palmowa', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Wielki Czwartek
|
||||
[Date.civil(2008,3,20), Date.civil(2009,4,9), Date.civil(2010,4,1),
|
||||
Date.civil(2011,4,21), Date.civil(2012,4,5)].each do |date|
|
||||
assert_equal 'Wielki Czwartek', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Wielki Piątek
|
||||
[Date.civil(2008,3,21), Date.civil(2009,4,10), Date.civil(2010,4,2),
|
||||
Date.civil(2011,4,22), Date.civil(2012,4,6)].each do |date|
|
||||
assert_equal 'Wielki Piątek', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Wielka Sobota
|
||||
[Date.civil(2008,3,22), Date.civil(2009,4,11), Date.civil(2010,4,3),
|
||||
Date.civil(2011,4,23), Date.civil(2012,4,7)].each do |date|
|
||||
assert_equal 'Wielka Sobota', (Holidays.on(date, :pl, :informal)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Niedziela Wielkanocna
|
||||
[Date.civil(2008,3,23), Date.civil(2009,4,12), Date.civil(2010,4,4),
|
||||
Date.civil(2011,4,24), Date.civil(2012,4,8)].each do |date|
|
||||
assert_equal 'Niedziela Wielkanocna', (Holidays.on(date, :pl)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Poniedziałek Wielkanocny (Lany Poniedziałek)
|
||||
[Date.civil(2008,3,24), Date.civil(2009,4,13), Date.civil(2010,4,5),
|
||||
Date.civil(2011,4,25), Date.civil(2012,4,9)].each do |date|
|
||||
assert_equal 'Poniedziałek Wielkanocny (Lany Poniedziałek)', (Holidays.on(date, :pl)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Zesłanie Ducha Świętego (Zielone Świątki)
|
||||
[Date.civil(2008,5,11), Date.civil(2009,5,31), Date.civil(2010,5,23),
|
||||
Date.civil(2011,6,12), Date.civil(2012,5,27)].each do |date|
|
||||
assert_equal 'Zesłanie Ducha Świętego (Zielone Świątki)', (Holidays.on(date, :pl)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Uroczystość Najświętszego Ciała i Krwi Pańskiej (Boże Ciało)
|
||||
[Date.civil(2008,5,22), Date.civil(2009,6,11), Date.civil(2010,6,3),
|
||||
Date.civil(2011,6,23), Date.civil(2012,6,7)].each do |date|
|
||||
assert_equal 'Uroczystość Najświętszego Ciała i Krwi Pańskiej (Boże Ciało)', (Holidays.on(date, :pl)[0] || {})[:name]
|
||||
end
|
||||
|
||||
# Wniebowzięcie Najświętszej Maryi Panny & Święto Wojska Polskiego
|
||||
assert_equal 'Wniebowzięcie Najświętszej Maryi Panny', (Holidays.on(Date.civil(2011,8,15), :pl)[0] || {})[:name]
|
||||
assert_equal 'Święto Wojska Polskiego', (Holidays.on(Date.civil(2011,8,15), :pl)[1] || {})[:name]
|
||||
end
|
||||
end
|
|
@ -1,32 +1,32 @@
|
|||
require File.dirname(__FILE__) + '/../test_helper'
|
||||
require 'holidays/pt'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/se.yaml
|
||||
class PtDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
def test_pt
|
||||
{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
|
||||
end
|
||||
end
|
||||
# encoding: utf-8
|
||||
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
||||
|
||||
# This file is generated by the Ruby Holiday gem.
|
||||
#
|
||||
# Definitions loaded: data/pt.yaml
|
||||
class PtDefinitionTests < Test::Unit::TestCase # :nodoc:
|
||||
|
||||
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,21) => 'Sexta-feira Santa',
|
||||
Date.civil(2008,3,23) => '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, :informal)[0] || {})[:name]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue