Compare commits

...

29 Commits

Author SHA1 Message Date
Denis Knauf 87a6702a28 Umlauts in at.yaml 2012-01-17 14:14:03 +01:00
Alex Dunae 51d6c095ad Regenerate gemspec for version 1.0.4 2011-10-19 12:02:59 -07:00
Alex Dunae d1af175150 Version bump 2011-10-19 12:02:41 -07:00
Alex Dunae 1e8b10e88a Add Liechtenstein holiday defs -- mercy vielmal: Bernhard Furtmueller 2011-10-18 16:18:05 -07:00
Alex Dunae 3f23f56c9a Define holidays in methods instead of constants 2011-09-14 11:47:14 -07:00
Alex Dunae 8f60480c8b Add rake to gemfile in test/dev group 2011-09-14 11:36:00 -07:00
Alex Dunae 16b76b19f2 Add rake to gemfile 2011-09-14 11:35:37 -07:00
Alex Dunae 9567872aeb Bundler/rdoc updates 2011-09-14 11:33:46 -07:00
Alex Dunae 88012e8f7e Regenerate gemspec with proper rdoc dependency 2011-09-14 11:10:57 -07:00
Alex Dunae d39f6edf67 Regenerate gemspec with proper rdoc dependency 2011-09-14 11:07:24 -07:00
Alex Dunae f08ffe5bcb Add Bundler and rdoc dev dependency 2011-09-14 11:05:35 -07:00
Alex Dunae c3c34bde1b Cleanup rakefile 2011-09-14 10:45:53 -07:00
Alex Dunae 9dea239b9e Cleanup rakefile 2011-09-14 10:45:31 -07:00
Alex Dunae 1052448108 Travis CI config 2011-09-14 10:39:23 -07:00
Alex Dunae 3e57241f89 Update definitions 2011-09-14 10:36:20 -07:00
Alex Dunae 945f9a45cd Fix United Nations definition file 2011-09-14 10:35:04 -07:00
Alex Dunae ff8f8162b9 Add Holidays.load_all method 2011-09-14 10:30:02 -07:00
Alex Dunae e863146e6f Merge pull request #12 from asaletnik/master
Polish Holidays
2011-09-13 15:34:41 -07:00
asaletnik 0abe91ffc4 Polish holidays 2011-09-12 23:48:32 +02:00
asaletnik 48639c7fc0 Polish holidays 2011-09-12 23:42:44 +02:00
Alex Dunae 05b8241dea Regenerate gemspec for version 1.0.3 2011-09-02 15:25:45 -07:00
Alex Dunae 46c39f82b3 Add Austrian holiday definitions -- thanks Vogel Siegried 2011-09-02 15:25:36 -07:00
Alex Dunae cd82b4d043 Version bump 2011-09-02 15:24:38 -07:00
Alex Dunae 2fd71e750a Add Austrian holiday definitions -- thanks Vogel Siegried 2011-09-02 15:23:04 -07:00
Alex Dunae ce5a7d09d2 Version bump 2011-05-13 14:17:53 -07:00
Alex Dunae ea96ff92ee Ruby 1.9 compat for orthodox_easter 2011-05-13 14:13:55 -07:00
Alex Dunae 1d838f0311 Move orthodox_easter method to main library 2011-05-13 13:58:57 -07:00
Alex Dunae 53590321d5 Merge pull request #9 from ddimitriadis/master
Greek holiday file (and updated data/index.yaml)
2011-05-13 13:44:09 -07:00
Dimitris Dimitriadis 1ea53be709 Added greek definitions and updated data/index.yaml to add greek to european holidays 2011-05-11 16:44:01 +03:00
56 changed files with 2142 additions and 532 deletions

3
.gitignore vendored
View File

@ -1,3 +1,6 @@
.DS_Store
*.gem
nbproject
doc/
rdoc/
Gemfile.lock

8
.travis.yml Normal file
View File

@ -0,0 +1,8 @@
notifications:
disabled: true
rvm:
- 1.8.7
- 1.9.2
- 1.9.3
- jruby
- ree

View File

@ -1,4 +1,13 @@
= 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)

8
Gemfile Normal file
View File

@ -0,0 +1,8 @@
source "http://rubygems.org"
gemspec
group :test, :development do
gem 'rake'
gem 'rdoc', '>= 2.4.2'
end

View File

@ -1,6 +1,6 @@
==== Ruby Holidays Gem License
Copyright (c) 2007-08 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

View File

@ -68,6 +68,6 @@ Lookup Canada Day in different regions.
* 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-10.
Started by Alex Dunae (dunae.ca, e-mail 'code' at the same domain), 2007-11.
Made on Vancouver Island.

68
data/at.yaml Normal file
View File

@ -0,0 +1,68 @@
# Austrian holiday definitions for the Ruby Holiday gem.
#
# Updated: 2011-08-31 by VGSG
# Sources:
# - http://de.wikipedia.org/wiki/Feiertage_in_%C3%96sterreich
# - http://www.timeanddate.com/calendar/index.html?country=8
# - http://www.germany.info/relaunch/welcome/travel/holidays.html
---
months:
0:
- name: Ostermontag
regions: [at]
function: easter(year)+1
- name: Christi Himmelfahrt
regions: [at]
function: easter(year)+39
- name: Pfingstmontag
regions: [at]
function: easter(year)+50
- name: Fronleichnam
regions: [at]
function: easter(year)+60
1:
- name: Neujahrstag
regions: [at]
mday: 1
- name: Heilige Drei Könige
regions: [at]
mday: 6
5:
- name: Staatsfeiertag
regions: [at]
mday: 1
8:
- name: Mariä Himmelfahrt
regions: [at]
mday: 15
10:
- name: Nationalfeiertag
regions: [at]
mday: 26
11:
- name: Allerheiligen
regions: [at]
mday: 1
12:
- name: Mariä Empfä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'

View File

@ -104,29 +104,33 @@ def parse_holiday_defs(module_name, files)
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

79
data/el.yaml Normal file
View File

@ -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

View File

@ -1,12 +1,14 @@
# 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']
@ -14,11 +16,13 @@ defs:
IE: ['ie.yaml']
IS: ['is.yaml']
IT: ['it.yaml']
LI: ['li.yaml']
MX: ['mx.yaml', 'north_america_informal.yaml']
NL: ['nl.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']
@ -27,5 +31,5 @@ defs:
ZA: ['za.yaml']
North_America: ['ca.yaml', 'mx.yaml', 'us.yaml', 'north_america_informal.yaml']
Scandinavia: ['dk.yaml', 'is.yaml', 'no.yaml', 'se.yaml', 'fi.yaml']
Europe: ['cz.yaml', 'dk.yaml', 'de.yaml', 'es.yaml', 'fr.yaml', 'gb.yaml', 'ie.yaml', 'is.yaml', 'it.yaml', 'nl.yaml', 'no.yaml', 'pt.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']

102
data/li.yaml Normal file
View File

@ -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

310
data/pl.yaml Normal file
View File

@ -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]

View File

@ -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
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

View File

@ -4,24 +4,27 @@
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{holidays}
s.version = "1.0.1"
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", "Rowan Crawford"]
s.date = %q{2011-04-29}
s.description = %q{A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!}
s.email = %q{code@dunae.ca}
s.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",
@ -29,6 +32,7 @@ Gem::Specification.new do |s|
"data/cz.yaml",
"data/de.yaml",
"data/dk.yaml",
"data/el.yaml",
"data/es.yaml",
"data/fi.yaml",
"data/fr.yaml",
@ -38,12 +42,14 @@ Gem::Specification.new do |s|
"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",
@ -53,12 +59,14 @@ Gem::Specification.new do |s|
"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",
@ -68,12 +76,14 @@ Gem::Specification.new do |s|
"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",
@ -82,12 +92,14 @@ Gem::Specification.new do |s|
"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",
@ -97,69 +109,80 @@ Gem::Specification.new do |s|
"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 = %q{https://github.com/alexdunae/holidays}
s.homepage = "https://github.com/alexdunae/holidays"
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.7}
s.summary = %q{A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!}
s.test_files = [
"test/defs/test_defs_au.rb",
"test/defs/test_defs_br.rb",
"test/defs/test_defs_ca.rb",
"test/defs/test_defs_cz.rb",
"test/defs/test_defs_de.rb",
"test/defs/test_defs_dk.rb",
"test/defs/test_defs_es.rb",
"test/defs/test_defs_europe.rb",
"test/defs/test_defs_fi.rb",
"test/defs/test_defs_fr.rb",
"test/defs/test_defs_gb.rb",
"test/defs/test_defs_ie.rb",
"test/defs/test_defs_is.rb",
"test/defs/test_defs_it.rb",
"test/defs/test_defs_jp.rb",
"test/defs/test_defs_mx.rb",
"test/defs/test_defs_nl.rb",
"test/defs/test_defs_no.rb",
"test/defs/test_defs_north_america.rb",
"test/defs/test_defs_nyse.rb",
"test/defs/test_defs_nz.rb",
"test/defs/test_defs_pt.rb",
"test/defs/test_defs_scandinavia.rb",
"test/defs/test_defs_se.rb",
"test/defs/test_defs_ups.rb",
"test/defs/test_defs_us.rb",
"test/defs/test_defs_za.rb",
"test/test_date.rb",
"test/test_helper.rb",
"test/test_holidays.rb",
"test/test_multiple_regions.rb"
]
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
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
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

View File

@ -22,6 +22,9 @@ require 'date'
# [<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)
@ -43,7 +46,7 @@ module Holidays
# Exception thrown when an unknown region is requested.
class UnknownRegionError < ArgumentError; end
VERSION = '1.0.1'
VERSION = '1.0.4'
@@regions = []
@@holidays_by_month = {}
@ -52,6 +55,7 @@ module Holidays
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.
#
@ -211,6 +215,33 @@ module Holidays
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.
@ -242,6 +273,19 @@ module Holidays
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]
@ -275,7 +319,7 @@ private
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 }

View File

@ -1,31 +1,34 @@
==== Regional definitions
The following definition files are included in this installation:
* holidays/au
* holidays/br
* holidays/ca
* holidays/cz
* holidays/de
* holidays/dk
* holidays/es
* holidays/europe
* holidays/fi
* holidays/fr
* holidays/gb
* holidays/ie
* holidays/is
* holidays/it
* holidays/jp
* holidays/mx
* holidays/nl
* holidays/no
* holidays/north_america
* holidays/nyse
* holidays/at
* holidays/nz
* holidays/pt
* holidays/nl
* holidays/dk
* holidays/cz
* holidays/scandinavia
* holidays/se
* holidays/no
* holidays/pt
* holidays/nyse
* holidays/it
* holidays/united_nations
* holidays/ups
* 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

41
lib/holidays/at.rb Normal file
View File

@ -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)

View File

@ -1,21 +1,24 @@
# 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: data/au.yaml
#
# 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/au'
#
# More definitions are available at http://code.dunae.ca/holidays.
# All the definitions are available at https://github.com/alexdunae/holidays
module AU # :nodoc:
DEFINED_REGIONS = [:au, :au_tas, :au_wa, :au_vic, :au_qld, :au_nt, :au_act, :au_nsw, :au_sa, :au_qld_brisbane]
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
HOLIDAYS_BY_MONTH = {
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:au]},
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]}],
@ -34,10 +37,11 @@ module Holidays
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)
Holidays.merge_defs(Holidays::AU.defined_regions, Holidays::AU.holidays_by_month)

View File

@ -1,21 +1,24 @@
# 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: data/br.yaml
#
# 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/br'
#
# More definitions are available at http://code.dunae.ca/holidays.
# All the definitions are available at https://github.com/alexdunae/holidays
module BR # :nodoc:
DEFINED_REGIONS = [:br]
def self.defined_regions
[:br]
end
HOLIDAYS_BY_MONTH = {
0 => [{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :type => :informal, :name => "Carnaval", :regions => [:br]},
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]}],
@ -27,10 +30,11 @@ module Holidays
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)
Holidays.merge_defs(Holidays::BR.defined_regions, Holidays::BR.holidays_by_month)

View File

@ -1,21 +1,24 @@
# 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: data/ca.yaml, data/north_america_informal.yaml
#
# 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/ca'
#
# More definitions are available at http://code.dunae.ca/holidays.
# All the definitions are available at https://github.com/alexdunae/holidays
module CA # :nodoc:
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]
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
HOLIDAYS_BY_MONTH = {
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:ca]},
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]}],
@ -48,7 +51,8 @@ module Holidays
{: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
@ -66,4 +70,4 @@ end
end
Holidays.merge_defs(Holidays::CA::DEFINED_REGIONS, Holidays::CA::HOLIDAYS_BY_MONTH)
Holidays.merge_defs(Holidays::CA.defined_regions, Holidays::CA.holidays_by_month)

View File

@ -1,21 +1,24 @@
# 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: data/cz.yaml
#
# 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/cz'
#
# More definitions are available at http://code.dunae.ca/holidays.
# All the definitions are available at https://github.com/alexdunae/holidays
module CZ # :nodoc:
DEFINED_REGIONS = [:cz]
def self.defined_regions
[:cz]
end
HOLIDAYS_BY_MONTH = {
0 => [{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Velikonoční pondělí", :regions => [:cz]}],
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]}],
@ -27,10 +30,11 @@ module Holidays
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)
Holidays.merge_defs(Holidays::CZ.defined_regions, Holidays::CZ.holidays_by_month)

View File

@ -1,21 +1,24 @@
# 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: data/de.yaml
#
# 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/de'
#
# More definitions are available at http://code.dunae.ca/holidays.
# All the definitions are available at https://github.com/alexdunae/holidays
module DE # :nodoc:
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]
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
HOLIDAYS_BY_MONTH = {
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Karfreitag", :regions => [:de]},
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]},
@ -30,7 +33,8 @@ module Holidays
{: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
@ -48,4 +52,4 @@ end
end
Holidays.merge_defs(Holidays::DE::DEFINED_REGIONS, Holidays::DE::HOLIDAYS_BY_MONTH)
Holidays.merge_defs(Holidays::DE.defined_regions, Holidays::DE.holidays_by_month)

View File

@ -1,21 +1,24 @@
# 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: data/dk.yaml
#
# 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/dk'
#
# More definitions are available at http://code.dunae.ca/holidays.
# All the definitions are available at https://github.com/alexdunae/holidays
module DK # :nodoc:
DEFINED_REGIONS = [:dk]
def self.defined_regions
[:dk]
end
HOLIDAYS_BY_MONTH = {
0 => [{:function => lambda { |year| Holidays.easter(year)-49 }, :function_id => "easter(year)-49", :type => :informal, :name => "Fastelavn", :regions => [:dk]},
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]},
@ -39,10 +42,11 @@ module Holidays
{: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)
Holidays.merge_defs(Holidays::DK.defined_regions, Holidays::DK.holidays_by_month)

42
lib/holidays/el.rb Normal file
View File

@ -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)

View File

@ -1,21 +1,24 @@
# 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: data/es.yaml
#
# 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/es'
#
# More definitions are available at http://code.dunae.ca/holidays.
# All the definitions are available at https://github.com/alexdunae/holidays
module ES # :nodoc:
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]
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
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]},
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]},
@ -44,10 +47,11 @@ module Holidays
{: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)
Holidays.merge_defs(Holidays::ES.defined_regions, Holidays::ES.holidays_by_month)

View File

@ -1,21 +1,28 @@
# 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: data/cz.yaml, 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/no.yaml, data/pt.yaml
# 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 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/europe'
#
# More definitions are available at http://code.dunae.ca/holidays.
# All the definitions are available at https://github.com/alexdunae/holidays
module Europe # :nodoc:
DEFINED_REGIONS = [:cz, :dk, :no, :de, :de_bw, :de_by, :de_he, :de_nw, :de_rp, :de_sl, :de_st, :de_bb, :de_mv, :de_sn, :de_th, :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, :pt]
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
HOLIDAYS_BY_MONTH = {
0 => [{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Velikonoční pondělí", :regions => [:cz]},
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]},
@ -26,11 +33,13 @@ module Holidays
{: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]},
{: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]},
{: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]},
@ -55,6 +64,9 @@ module Holidays
{: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]},
@ -65,14 +77,28 @@ module Holidays
{: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 => "Den obnovy samostatného českého státu", :regions => [:cz]},
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 => 1, :name => "Neujahrstag", :regions => [:de]},
{:mday => 6, :name => "Heilige Drei Könige", :regions => [:de_bw, :de_by, :de_st]},
{: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]},
@ -85,12 +111,19 @@ module Holidays
{: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 => "Svátek práce", :regions => [:cz]},
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]},
{: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]},
@ -107,28 +140,36 @@ module Holidays
{: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]}],
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]}],
10 => [{:mday => 28, :name => "Den vzniku samostatného československého státu", :regions => [:cz]},
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 => 17, :name => "Den boje za svobodu a demokracii", :regions => [:cz]},
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]},
{: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]},
{:mday => 1, :name => "Todos los Santos", :regions => [:es]},
{:mday => 1, :name => "Toussaint", :regions => [:fr]},
@ -136,16 +177,23 @@ module Holidays
{: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 => 24, :name => "Štědrý den", :regions => [:cz]},
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 => "1. Weihnachtstag", :regions => [:de]},
{:mday => 26, :name => "2. Weihnachtstag", :regions => [:de]},
{: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]},
@ -162,14 +210,38 @@ module Holidays
{: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]},
@ -178,6 +250,8 @@ module Holidays
{: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]},
@ -188,22 +262,23 @@ module Holidays
{: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]}],
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]}],
2 => [{:mday => 28, :name => "Día de Andalucía", :regions => [:es_an]},
{:mday => 18, :type => :informal, :name => "Konudagur", :regions => [:is]}],
3 => [{:mday => 1, :name => "Día de las Islas Baleares", :regions => [:es_ib]},
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 => 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
@ -230,7 +305,19 @@ def self.is_sumardagurinn_fyrsti(year)
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)
Holidays.merge_defs(Holidays::Europe.defined_regions, Holidays::Europe.holidays_by_month)

View File

@ -1,21 +1,24 @@
# 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: data/fi.yaml
#
# 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/fi'
#
# More definitions are available at http://code.dunae.ca/holidays.
# All the definitions are available at https://github.com/alexdunae/holidays
module FI # :nodoc:
DEFINED_REGIONS = [:fi]
def self.defined_regions
[:fi]
end
HOLIDAYS_BY_MONTH = {
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Pitkäperjantai", :regions => [:fi]},
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]},
@ -29,7 +32,8 @@ module Holidays
{: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 2026)
@ -51,4 +55,4 @@ end
end
Holidays.merge_defs(Holidays::FI::DEFINED_REGIONS, Holidays::FI::HOLIDAYS_BY_MONTH)
Holidays.merge_defs(Holidays::FI.defined_regions, Holidays::FI.holidays_by_month)

View File

@ -1,21 +1,24 @@
# 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: data/fr.yaml
#
# 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/fr'
#
# More definitions are available at http://code.dunae.ca/holidays.
# All the definitions are available at https://github.com/alexdunae/holidays
module FR # :nodoc:
DEFINED_REGIONS = [:fr]
def self.defined_regions
[:fr]
end
HOLIDAYS_BY_MONTH = {
0 => [{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pâques", :regions => [:fr]},
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]},
@ -28,10 +31,11 @@ module Holidays
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)
Holidays.merge_defs(Holidays::FR.defined_regions, Holidays::FR.holidays_by_month)

View File

@ -1,21 +1,24 @@
# 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: data/gb.yaml
#
# 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/gb'
#
# More definitions are available at http://code.dunae.ca/holidays.
# All the definitions are available at https://github.com/alexdunae/holidays
module GB # :nodoc:
DEFINED_REGIONS = [:gb, :gb_eng, :gb_wls, :gb_eaw, :gb_nir, :gb_sct, :gb_con, :je, :gb_jsy, :gg, :gb_gsy, :im, :gb_iom]
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
HOLIDAYS_BY_MONTH = {
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:gb]},
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]},
@ -32,10 +35,11 @@ module Holidays
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)
Holidays.merge_defs(Holidays::GB.defined_regions, Holidays::GB.holidays_by_month)

View File

@ -1,21 +1,24 @@
# 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: data/ie.yaml
#
# 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/ie'
#
# More definitions are available at http://code.dunae.ca/holidays.
# All the definitions are available at https://github.com/alexdunae/holidays
module IE # :nodoc:
DEFINED_REGIONS = [:ie]
def self.defined_regions
[:ie]
end
HOLIDAYS_BY_MONTH = {
0 => [{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Easter Monday", :regions => [:ie]}],
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]}],
@ -24,10 +27,11 @@ module Holidays
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)
Holidays.merge_defs(Holidays::IE.defined_regions, Holidays::IE.holidays_by_month)

View File

@ -1,21 +1,24 @@
# 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: data/is.yaml
#
# 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/is'
#
# More definitions are available at http://code.dunae.ca/holidays.
# All the definitions are available at https://github.com/alexdunae/holidays
module IS # :nodoc:
DEFINED_REGIONS = [:is]
def self.defined_regions
[:is]
end
HOLIDAYS_BY_MONTH = {
0 => [{:function => lambda { |year| Holidays.easter(year)-48 }, :function_id => "easter(year)-48", :name => "Bolludagur", :regions => [:is]},
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]},
@ -41,7 +44,8 @@ module Holidays
{: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)
@ -59,4 +63,4 @@ end
end
Holidays.merge_defs(Holidays::IS::DEFINED_REGIONS, Holidays::IS::HOLIDAYS_BY_MONTH)
Holidays.merge_defs(Holidays::IS.defined_regions, Holidays::IS.holidays_by_month)

View File

@ -1,21 +1,24 @@
# 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: data/it.yaml
#
# 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/it'
#
# More definitions are available at http://code.dunae.ca/holidays.
# All the definitions are available at https://github.com/alexdunae/holidays
module IT # :nodoc:
DEFINED_REGIONS = [:it]
def self.defined_regions
[:it]
end
HOLIDAYS_BY_MONTH = {
0 => [{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pasqua", :regions => [:it]},
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]}],
@ -27,10 +30,11 @@ module Holidays
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)
Holidays.merge_defs(Holidays::IT.defined_regions, Holidays::IT.holidays_by_month)

View File

@ -1,21 +1,24 @@
# 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: data/jp.yaml
#
# 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/jp'
#
# More definitions are available at http://code.dunae.ca/holidays.
# All the definitions are available at https://github.com/alexdunae/holidays
module JP # :nodoc:
DEFINED_REGIONS = [:jp]
def self.defined_regions
[:jp]
end
HOLIDAYS_BY_MONTH = {
1 => [{:mday => 1, :name => "元日", :regions => [:jp]},
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]}],
@ -43,7 +46,8 @@ module Holidays
{: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)
@ -106,4 +110,4 @@ end
end
Holidays.merge_defs(Holidays::JP::DEFINED_REGIONS, Holidays::JP::HOLIDAYS_BY_MONTH)
Holidays.merge_defs(Holidays::JP.defined_regions, Holidays::JP.holidays_by_month)

48
lib/holidays/li.rb Normal file
View File

@ -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)

View File

@ -1,21 +1,24 @@
# 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: data/mx.yaml, data/north_america_informal.yaml
#
# 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/mx'
#
# More definitions are available at http://code.dunae.ca/holidays.
# All the definitions are available at https://github.com/alexdunae/holidays
module MX # :nodoc:
DEFINED_REGIONS = [:mx, :mx_pue, :us, :ca]
def self.defined_regions
[:mx, :mx_pue, :us, :ca]
end
HOLIDAYS_BY_MONTH = {
1 => [{:mday => 1, :name => "Año nuevo", :regions => [:mx]},
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]},
@ -43,10 +46,11 @@ module Holidays
{: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)
Holidays.merge_defs(Holidays::MX.defined_regions, Holidays::MX.holidays_by_month)

View File

@ -1,21 +1,24 @@
# 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: data/nl.yaml
#
# 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/nl'
#
# More definitions are available at http://code.dunae.ca/holidays.
# All the definitions are available at https://github.com/alexdunae/holidays
module NL # :nodoc:
DEFINED_REGIONS = [:nl]
def self.defined_regions
[:nl]
end
HOLIDAYS_BY_MONTH = {
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Goede Vrijdag", :regions => [:nl]},
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]},
@ -28,10 +31,11 @@ module Holidays
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)
Holidays.merge_defs(Holidays::NL.defined_regions, Holidays::NL.holidays_by_month)

View File

@ -1,21 +1,24 @@
# 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: data/no.yaml
#
# 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/no'
#
# More definitions are available at http://code.dunae.ca/holidays.
# All the definitions are available at https://github.com/alexdunae/holidays
module NO # :nodoc:
DEFINED_REGIONS = [:no]
def self.defined_regions
[:no]
end
HOLIDAYS_BY_MONTH = {
0 => [{:function => lambda { |year| Holidays.easter(year)-49 }, :function_id => "easter(year)-49", :type => :informal, :name => "Fastelavn", :regions => [:no]},
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]},
@ -31,10 +34,11 @@ module Holidays
{: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)
Holidays.merge_defs(Holidays::NO.defined_regions, Holidays::NO.holidays_by_month)

View File

@ -1,21 +1,24 @@
# 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: 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
# To use the definitions in this file, load it right after you load the
# Holiday gem:
#
# require 'holidays'
# require 'holidays/north_america'
#
# More definitions are available at http://code.dunae.ca/holidays.
# All the definitions are available at https://github.com/alexdunae/holidays
module North_America # :nodoc:
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]
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
HOLIDAYS_BY_MONTH = {
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:ca]},
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]},
@ -81,7 +84,8 @@ module Holidays
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
@ -105,4 +109,4 @@ end
end
Holidays.merge_defs(Holidays::North_America::DEFINED_REGIONS, Holidays::North_America::HOLIDAYS_BY_MONTH)
Holidays.merge_defs(Holidays::North_America.defined_regions, Holidays::North_America.holidays_by_month)

View File

@ -1,21 +1,24 @@
# 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: data/nyse.yaml
#
# 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/nyse'
#
# More definitions are available at http://code.dunae.ca/holidays.
# All the definitions are available at https://github.com/alexdunae/holidays
module NYSE # :nodoc:
DEFINED_REGIONS = [:nyse]
def self.defined_regions
[:nyse]
end
HOLIDAYS_BY_MONTH = {
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:nyse]}],
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]}],
@ -24,10 +27,11 @@ module Holidays
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)
Holidays.merge_defs(Holidays::NYSE.defined_regions, Holidays::NYSE.holidays_by_month)

View File

@ -1,21 +1,24 @@
# 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: data/nz.yaml
#
# 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/nz'
#
# More definitions are available at http://code.dunae.ca/holidays.
# All the definitions are available at https://github.com/alexdunae/holidays
module NZ # :nodoc:
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]
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
HOLIDAYS_BY_MONTH = {
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:nz]},
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]},
@ -39,7 +42,8 @@ module Holidays
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)
@ -66,4 +70,4 @@ end
end
Holidays.merge_defs(Holidays::NZ::DEFINED_REGIONS, Holidays::NZ::HOLIDAYS_BY_MONTH)
Holidays.merge_defs(Holidays::NZ.defined_regions, Holidays::NZ.holidays_by_month)

80
lib/holidays/pl.rb Normal file
View File

@ -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)

View File

@ -1,21 +1,24 @@
# 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: data/pt.yaml
#
# 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/pt'
#
# More definitions are available at http://code.dunae.ca/holidays.
# All the definitions are available at https://github.com/alexdunae/holidays
module PT # :nodoc:
DEFINED_REGIONS = [:pt]
def self.defined_regions
[:pt]
end
HOLIDAYS_BY_MONTH = {
0 => [{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :type => :informal, :name => "Carnaval", :regions => [:pt]},
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]}],
@ -29,10 +32,11 @@ module Holidays
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)
Holidays.merge_defs(Holidays::PT.defined_regions, Holidays::PT.holidays_by_month)

View File

@ -1,21 +1,24 @@
# 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: data/dk.yaml, data/is.yaml, data/no.yaml, data/se.yaml, data/fi.yaml
#
# 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/scandinavia'
#
# More definitions are available at http://code.dunae.ca/holidays.
# All the definitions are available at https://github.com/alexdunae/holidays
module Scandinavia # :nodoc:
DEFINED_REGIONS = [:dk, :no, :is, :se, :fi]
def self.defined_regions
[:dk, :no, :is, :se, :fi]
end
HOLIDAYS_BY_MONTH = {
0 => [{:function => lambda { |year| Holidays.easter(year)-49 }, :function_id => "easter(year)-49", :type => :informal, :name => "Fastelavn", :regions => [:dk, :no]},
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]},
@ -101,7 +104,8 @@ module Holidays
{: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)
@ -151,4 +155,4 @@ end
end
Holidays.merge_defs(Holidays::Scandinavia::DEFINED_REGIONS, Holidays::Scandinavia::HOLIDAYS_BY_MONTH)
Holidays.merge_defs(Holidays::Scandinavia.defined_regions, Holidays::Scandinavia.holidays_by_month)

View File

@ -1,21 +1,24 @@
# 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: data/se.yaml
#
# 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/se'
#
# More definitions are available at http://code.dunae.ca/holidays.
# All the definitions are available at https://github.com/alexdunae/holidays
module SE # :nodoc:
DEFINED_REGIONS = [:se]
def self.defined_regions
[:se]
end
HOLIDAYS_BY_MONTH = {
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Långfredagen", :regions => [:se]},
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]},
@ -28,7 +31,8 @@ module Holidays
{: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 2026)
@ -50,4 +54,4 @@ end
end
Holidays.merge_defs(Holidays::SE::DEFINED_REGIONS, Holidays::SE::HOLIDAYS_BY_MONTH)
Holidays.merge_defs(Holidays::SE.defined_regions, Holidays::SE.holidays_by_month)

View File

@ -1,25 +1,85 @@
# 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: data/united_nations.yaml
#
# 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/united_nations'
#
# More definitions are available at http://code.dunae.ca/holidays.
# All the definitions are available at https://github.com/alexdunae/holidays
module United_Nations # :nodoc:
DEFINED_REGIONS = [:]
def self.defined_regions
[:united_nations]
end
HOLIDAYS_BY_MONTH = {
}
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)
Holidays.merge_defs(Holidays::United_Nations.defined_regions, Holidays::United_Nations.holidays_by_month)

View File

@ -1,21 +1,24 @@
# 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: data/ups.yaml
#
# 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/ups'
#
# More definitions are available at http://code.dunae.ca/holidays.
# All the definitions are available at https://github.com/alexdunae/holidays
module UPS # :nodoc:
DEFINED_REGIONS = [:ups]
def self.defined_regions
[:ups]
end
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]}],
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]}],
@ -23,10 +26,11 @@ module Holidays
{: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)
Holidays.merge_defs(Holidays::UPS.defined_regions, Holidays::UPS.holidays_by_month)

View File

@ -1,21 +1,24 @@
# 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: data/us.yaml, data/north_america_informal.yaml
#
# 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/us'
#
# More definitions are available at http://code.dunae.ca/holidays.
# All the definitions are available at https://github.com/alexdunae/holidays
module US # :nodoc:
DEFINED_REGIONS = [:us, :us_dc, :ca]
def self.defined_regions
[:us, :us_dc, :ca]
end
HOLIDAYS_BY_MONTH = {
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :type => :informal, :name => "Good Friday", :regions => [:us]}],
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]}],
@ -34,7 +37,8 @@ module Holidays
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
@ -46,4 +50,4 @@ end
end
Holidays.merge_defs(Holidays::US::DEFINED_REGIONS, Holidays::US::HOLIDAYS_BY_MONTH)
Holidays.merge_defs(Holidays::US.defined_regions, Holidays::US.holidays_by_month)

View File

@ -1,21 +1,24 @@
# 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: data/za.yaml
#
# 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/za'
#
# More definitions are available at http://code.dunae.ca/holidays.
# All the definitions are available at https://github.com/alexdunae/holidays
module ZA # :nodoc:
DEFINED_REGIONS = [:za]
def self.defined_regions
[:za]
end
HOLIDAYS_BY_MONTH = {
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:za]},
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]}],
@ -27,10 +30,11 @@ module Holidays
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)
Holidays.merge_defs(Holidays::ZA.defined_regions, Holidays::ZA.holidays_by_month)

View File

@ -1,13 +1,14 @@
$:.unshift File.expand_path('../lib', __FILE__)
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'rake/gempackagetask'
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"]
@ -30,7 +31,7 @@ end
task :doc => ["defs:manifest", :rdoc]
desc 'Generate documentation.'
Rake::RDocTask.new(:rdoc) do |rdoc|
RDoc::Task.new do |rdoc|
rdoc.rdoc_dir = 'doc'
rdoc.title = 'Ruby Holidays Gem'
rdoc.options << '--all' << '--inline-source' << '--line-numbers'
@ -98,7 +99,8 @@ begin
gemspec.email = "code@dunae.ca"
gemspec.homepage = "https://github.com/alexdunae/holidays"
gemspec.version = Holidays::VERSION
gemspec.authors = ["Alex Dunae", "Rowan Crawford"]
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"

24
test/defs/test_defs_at.rb Normal file
View File

@ -0,0 +1,24 @@
# encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#
# Definitions loaded: data/at.yaml
class AtDefinitionTests < Test::Unit::TestCase # :nodoc:
def test_at
{Date.civil(2009,1,1) => 'Neujahrstag',
Date.civil(2009,4,13) => 'Ostermontag',
Date.civil(2009,5,1) => 'Staatsfeiertag',
Date.civil(2009,5,21) => 'Christi Himmelfahrt',
Date.civil(2009,6,1) => 'Pfingstmontag',
Date.civil(2009,10,26) => 'Nationalfeiertag',
Date.civil(2009,12,25) => '1. Weihnachtstag',
Date.civil(2009,12,26) => '2. Weihnachtstag'}.each do |date, name|
assert_equal name, (Holidays.on(date, :at, :informal)[0] || {})[:name]
end
assert !Date.civil(2010,5,8).holiday?(:at), '2010-05-08 is not a holiday in Austria'
end
end

28
test/defs/test_defs_el.rb Normal file
View File

@ -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

View File

@ -3,10 +3,24 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#
# Definitions loaded: data/cz.yaml, 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/no.yaml, data/pt.yaml
# 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',
@ -84,6 +98,24 @@ assert_equal 'Buß- und Bettag', Date.civil(2006,11,22).holidays(:de_sn)[0][:nam
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',
@ -222,6 +254,31 @@ end
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',
@ -255,6 +312,141 @@ end
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',

35
test/defs/test_defs_li.rb Normal file
View File

@ -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

145
test/defs/test_defs_pl.rb Normal file
View File

@ -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

48
test/test_all_regions.rb Normal file
View File

@ -0,0 +1,48 @@
require File.expand_path(File.dirname(__FILE__)) + '/test_helper'
class MultipleRegionsTests < Test::Unit::TestCase
def test_definition_dir
assert File.directory?(Holidays::DEFINITION_PATH)
end
def test_getting_available_paths
defs = Holidays.available(true)
assert_equal def_count, defs.size
defs.each do |f|
assert f.kind_of?(String)
assert File.exists?(f)
end
end
def test_getting_available_symbols
defs = Holidays.available(false)
assert_equal def_count, defs.size
defs.each { |f| assert f.kind_of?(Symbol) }
# some spot checks
assert defs.include?(:ca)
assert defs.include?(:united_nations)
end
def test_loading_all
Holidays.load_all
holidays = Holidays.on(Date.civil(2011, 5, 1), :any)
# at least 15 now, but there could be more in the future
assert holidays.size > 15
# some spot checks
assert holidays.any? { |h| h[:name] == 'Staatsfeiertag' } # :at
assert holidays.any? { |h| h[:name] == 'Dia do Trabalho' } # :br
assert holidays.any? { |h| h[:name] == 'Vappu' } # :fi
end
private
def def_count
Dir.glob(Holidays::DEFINITION_PATH + '/*.rb').size
end
end

View File

@ -102,6 +102,14 @@ class HolidaysTests < Test::Unit::TestCase
assert_equal '2067-04-03', Holidays.easter(2067).to_s
assert_equal '2099-04-12', Holidays.easter(2099).to_s
end
def test_orthodox_easter
assert_equal '2000-04-30', Holidays.orthodox_easter(2000).to_s
assert_equal '2008-04-27', Holidays.orthodox_easter(2008).to_s
assert_equal '2009-04-19', Holidays.orthodox_easter(2009).to_s
assert_equal '2011-04-24', Holidays.orthodox_easter(2011).to_s
assert_equal '2020-04-19', Holidays.orthodox_easter(2020).to_s
end
def test_easter_lambda
[Date.civil(1800,4,11), Date.civil(1899,3,31), Date.civil(1900,4,13),