Compare commits

...

61 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
Alex Dunae 16e93ab5d8 Brazilian holidays 2011-04-29 14:42:17 -07:00
Alex Dunae 61d90c32d0 Add Brazilian holiday defs 2011-04-29 14:41:16 -07:00
Alex Dunae 334d9034cd English spelling 2010-12-31 14:31:20 -08:00
Alex Dunae aba033ab0e Merge branch 'master' of https://github.com/sugi/holidays into sugi-master 2010-12-31 14:25:45 -08:00
Alex Dunae 838f555fb9 Syntax doc typo and rename 2010-12-31 14:23:39 -08:00
Jesse Ikonen 61ce0bbbeb Added christmas eve to finnish holidays 2010-12-28 18:53:46 +02:00
Jesse Ikonen ff9096b210 Finnish holidays 2010-12-28 18:23:30 +02:00
Tatsuki Sugiura c3bf468593 Add a difinition for Japan. 2010-12-25 17:34:33 +09:00
Alex Dunae c7e7f0fe36 CA: Remembrance Day typo -- closes GH-4 2010-11-15 11:11:02 -08:00
Alex Dunae da7f4396d9 Update install instructions 2010-11-12 14:43:52 -08:00
Alex Dunae b94712703d Proper timezone handling without needing activesupport 2010-11-12 14:39:53 -08:00
Alex Dunae 912292b087 Check Ruby version before setting 2010-11-12 14:30:17 -08:00
Alex Dunae f7749920f8 Remove timezone when comparing DateTimes
Closes GH-1
2010-11-12 14:26:33 -08:00
Alex Dunae 962989c326 Gemspec and docs cleanup 2010-11-12 13:36:52 -08:00
Alex Dunae b7a288fdcd Merge remote branch 'wombleton/master' 2010-11-12 13:27:22 -08:00
Rowan Crawford 5b19ac8ee4 Sort holidays in ascending date so we can reason on a collection of holidays a bit better 2010-11-13 05:15:36 +08:00
Rowan Crawford 7901d65a43 Going to version 0.9.7 to fix issue with include :gb_ and so forth. 2010-11-13 05:15:35 +08:00
Alex Dunae 474e1b660c Test case for 2010-05-08 DE holiday -- closes GH-2 2010-11-12 12:57:16 -08:00
Alex Dunae 2b6d5c1b15 Fix encoding and relative paths for Ruby 1.9.2 -- closes GH-3 2010-11-12 12:45:12 -08:00
Alex Dunae f2f9e6ca1c Add missing Scandinavia and SE definitions 2010-11-12 12:44:09 -08:00
Rowan Crawford c33fa25828 Version bump to 0.0.0 2010-11-13 04:33:18 +08:00
Rowan Crawford fa6ad64f81 Update generate test_defs 2010-11-13 04:33:17 +08:00
Rowan Crawford 0aeaae378f Fixes north america/US crosslinking stuff 2010-11-13 04:33:16 +08:00
Rowan Crawford 642c53319f Update tests to give more useful information when they fail. 2010-11-13 04:32:19 +08:00
Rowan Crawford 608f677039 Handle not requiring the locale off the bat. 2010-11-13 04:32:18 +08:00
Rowan Crawford de3f744e7d A few holidays were still referring to .au 2010-11-13 04:32:17 +08:00
Rowan Crawford a8d5a60b0d add nz holidays 2010-11-13 04:30:59 +08:00
Rowan Crawford 629240e340 ignore netbeans stuff 2010-11-13 04:30:58 +08:00
Rowan Crawford 406b1dd28f Fix spelling mistake in errors 2010-11-13 04:30:57 +08:00
Alex Dunae 40f393d529 Merge remote branch 'dgrambow/master'
Conflicts:
	lib/holidays.rb
2010-11-12 12:26:48 -08:00
Dirk Grambow 0641484999 Removed unnecessary additions 2009-12-02 12:04:51 +01:00
Dirk Grambow 7ddbf8cf47 Fixed date tests 2009-12-02 11:34:56 +01:00
93 changed files with 3474 additions and 1023 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

@ -6,13 +6,9 @@ Extends Ruby's built-in Date class and supports custom holiday definition lists.
=== Installation
To install the gem from GitHub:
To install the gem from RubyGems:
gem sources -a http://gems.github.com
gem install alexdunae-holidays
Or, download the source <tt>.tgz</tt> file from http://rubyforge.org/holidays and
extract it somewhere in your include path.
gem install holidays
=== Examples
@ -68,10 +64,10 @@ Lookup Canada Day in different regions.
=== Credits and code
* Project page: http://code.dunae.ca/holidays
* Source: http://github.com/alexdunae/holidays
* Docs: http://code.dunae.ca/holidays/doc
* Source: https://github.com/alexdunae/holidays
* Docs: http://rdoc.info/github/alexdunae/holidays/master/frames
* Contributors: https://github.com/alexdunae/holidays/contributors
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.

View File

@ -1 +0,0 @@
0.9.9

View File

@ -11,7 +11,7 @@ Holidays are grouped by month from 1 through 12. Each entry within a month can
===== Dates defined by a fixed date (e.g. January 1st)
[<tt>wday</tt>] Integer representing day of the month (1 through 31).
[<tt>mday</tt>] Integer representing day of the month (1 through 31).
For example, the following holiday is on the first of January and available in the <tt>ca</tt>, <tt>us</tt> and <tt>au</tt> regions.

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'

74
data/br.yaml Normal file
View File

@ -0,0 +1,74 @@
# Brazilian holiday definitions for the Ruby Holiday gem.
# Provided by Rogério Carrasqueira
#
# Updated: 2008-11-28.
# Sources:
# - http://pt.wikipedia.org/wiki/Feriados_no_Brasil
---
months:
0:
- name: Carnaval # same as Shrove Tuesday
regions: [br]
function: easter(year)-47
type: informal
- name: Sexta-feira Santa
regions: [br]
function: easter(year)-2
- name: Páscoa
regions: [br]
function: easter(year)
- name: Corpus Christ
regions: [br]
function: easter(year)+60
1:
- name: Dia da Confraternização Universal
regions: [br]
mday: 1
4:
- name: Dia de Tiradentes
regions: [br]
mday: 21
5:
- name: Dia do Trabalho
regions: [br]
mday: 1
9:
- name: Proclamação da Independência
regions: [br]
mday: 7
10:
- name: Dia de Nossa Senhora Aparecida
regions: [br]
mday: 12
11:
- name: Dia de Finados
regions: [br]
mday: 2
- name: Proclamação da República
regions: [br]
mday: 15
12:
- name: Natal
regions: [br]
mday: 25
tests: |
{Date.civil(2008,1,1) => 'Dia da Confraternização Universal',
Date.civil(2005,2,8) => 'Carnaval',
Date.civil(2006,2,28) => 'Carnaval',
Date.civil(2007,2,20) => 'Carnaval',
Date.civil(2008,2,5) => 'Carnaval',
Date.civil(2008,3,21) => 'Sexta-feira Santa',
Date.civil(2008,3,23) => 'Páscoa',
Date.civil(2008,4,21) => 'Dia de Tiradentes',
Date.civil(2008,5,1) => 'Dia do Trabalho',
Date.civil(2005,5,26) => 'Corpus Christ',
Date.civil(2007,6,7) => 'Corpus Christ',
Date.civil(2008,5,22) => 'Corpus Christ',
Date.civil(2008,9,7) => 'Proclamação da Independência',
Date.civil(2008,10,12) => 'Dia de Nossa Senhora Aparecida',
Date.civil(2008,11,2) => 'Dia de Finados',
Date.civil(2008,11,15) => 'Proclamação da República',
Date.civil(2008,12,25) => 'Natal'}.each do |date, name|
assert_equal name, (Holidays.on(date, :br, :informal)[0] || {})[:name]
end

View File

@ -52,7 +52,7 @@ def parse_holiday_defs(module_name, files)
end
if def_file['tests']
puts " - importing testings..."
puts " - importing tests..."
test_strs << def_file['tests']
end
end
@ -102,38 +102,43 @@ def parse_holiday_defs(module_name, files)
# Build the module file
module_src =<<-EOM
# coding: utf-8
# encoding: utf-8
module Holidays
# This file is generated by the Ruby Holiday gem.
# This file is generated by the Ruby Holidays gem.
#
# Definitions loaded: #{files.join(', ')}
#
# To use the definitions in this file, load them right after you load the
# To use the definitions in this file, load it right after you load the
# Holiday gem:
#
# require 'holidays'
# require 'holidays/#{module_name.downcase}'
#
# More definitions are available at http://code.dunae.ca/holidays.
# All the definitions are available at https://github.com/alexdunae/holidays
module #{module_name} # :nodoc:
DEFINED_REGIONS = [:#{regions.flatten.uniq.join(', :')}]
def self.defined_regions
[:#{regions.flatten.uniq.join(', :')}]
end
HOLIDAYS_BY_MONTH = {
#{month_strs.join(",\n")}
}
def self.holidays_by_month
{
#{month_strs.join(",\n")}
}
end
end
#{method_str}
end
Holidays.merge_defs(Holidays::#{module_name}::DEFINED_REGIONS, Holidays::#{module_name}::HOLIDAYS_BY_MONTH)
Holidays.merge_defs(Holidays::#{module_name}.defined_regions, Holidays::#{module_name}.holidays_by_month)
EOM
# Build the test file
unless test_strs.empty?
test_src =<<-EndOfTests
require File.dirname(__FILE__) + '/../test_helper'
# encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#

View File

@ -98,7 +98,7 @@ months:
regions: [ca]
wday: 1
11:
- name: Rememberance Day
- name: Remembrance Day
regions: [ca]
mday: 11
12:
@ -128,7 +128,7 @@ tests: |
Date.civil(2008,7,1) => 'Canada Day',
Date.civil(2008,9,1) => 'Labour Day',
Date.civil(2008,10,13) => 'Thanksgiving',
Date.civil(2008,11,11) => 'Rememberance Day',
Date.civil(2008,11,11) => 'Remembrance Day',
Date.civil(2008,12,25) => 'Christmas Day',
Date.civil(2008,12,26) => 'Boxing Day'}.each do |date, name|
assert_equal name, (Holidays.on(date, :ca, :informal)[0] || {})[:name]

View File

@ -103,6 +103,8 @@ tests: |
[:de_bw, :de_by, :de_nw, :de_rp, :de_sl, :de_].each do |r|
assert_equal 'Allerheiligen', Date.civil(2009,11,1).holidays(r)[0][:name]
end
assert !Date.civil(2010,5,8).holiday?(:de), '2010-05-08 is not a holiday in Germany'
# Repentance Day
assert_equal 'Buß- und Bettag', Date.civil(2004,11,17).holidays(:de_sn)[0][:name]

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

95
data/fi.yaml Normal file
View File

@ -0,0 +1,95 @@
# Finnish holiday definitions for the Ruby Holiday gem.
#
# Updated: 2010-12-28.
# Sources:
# - http://en.wikipedia.org/wiki/Public_holidays_in_Finland
---
months:
0:
- name: Pitkäperjantai
regions: [fi]
function: easter(year)-2
- name: Pääsiäispäivä
regions: [fi]
function: easter(year)
- name: 2. Pääsiäispäivä
regions: [fi]
function: easter(year)+1
- name: Helatorstai # Ascension Day
regions: [fi]
function: easter(year)+39
- name: Helluntaipäivä # Whitsunday
regions: [fi]
function: easter(year)+49
- name: Pyhäinpäivä # All Saint's Day
regions: [fi]
function: fi_pyhainpaiva(year)
1:
- name: Uudenvuodenpäivä
regions: [fi]
mday: 1
- name: Loppiainen
regions: [fi]
mday: 6
5:
- name: Vappu
regions: [fi]
mday: 1
6:
- name: Juhannuspäivä
regions: [fi]
function: fi_juhannuspaiva(year)
12:
- name: Itsenäisyyspäivä
regions: [fi]
mday: 6
- name: Jouluaatto
regions: [fi]
mday: 24
- name: Joulupäivä
regions: [fi]
mday: 25
- name: Tapaninpäivä
regions: [fi]
mday: 26
methods:
fi_juhannuspaiva: |
# Finland: Mid-summer (Saturday between June 2026)
def self.fi_juhannuspaiva(year)
date = Date.civil(year,6,20)
date += (6 - date.wday)
date
end
fi_pyhainpaiva: |
# Finland: All Saint's Day (Saturday between Oct 31 and Nov 6)
def self.fi_pyhainpaiva(year)
date = Date.civil(year,10,31)
date += (6 - date.wday)
date
end
tests: |
{Date.civil(2008,1,1) => 'Uudenvuodenpäivä',
Date.civil(2008,1,6) => 'Loppiainen',
Date.civil(2008,3,21) => 'Pitkäperjantai',
Date.civil(2008,3,23) => 'Pääsiäispäivä',
Date.civil(2008,3,24) => '2. Pääsiäispäivä',
Date.civil(2008,5,1) => 'Vappu',
Date.civil(2008,5,1) => 'Helatorstai',
Date.civil(2008,5,11) => 'Helluntaipäivä',
Date.civil(2005,6,25) => 'Juhannuspäivä',
Date.civil(2006,6,24) => 'Juhannuspäivä',
Date.civil(2007,6,23) => 'Juhannuspäivä',
Date.civil(2008,6,21) => 'Juhannuspäivä',
Date.civil(2005,11,5) => 'Pyhäinpäivä',
Date.civil(2006,11,4) => 'Pyhäinpäivä',
Date.civil(2007,11,3) => 'Pyhäinpäivä',
Date.civil(2008,11,1) => 'Pyhäinpäivä',
Date.civil(2008,12,6) => 'Itsenäisyyspäivä',
Date.civil(2008,12,24) => 'Jouluaatto',
Date.civil(2008,12,25) => 'Joulupäivä',
Date.civil(2008,12,26) => 'Tapaninpäivä'}.each do |date, name|
assert_equal name, (Holidays.on(date, :fi, :informal)[0] || {})[:name]
end

View File

@ -1,26 +1,35 @@
# Definition build list
---
defs:
AT: ['at.yaml']
AU: ['au.yaml']
BR: ['br.yaml']
CA: ['ca.yaml', 'north_america_informal.yaml']
CZ: ['cz.yaml']
DK: ['dk.yaml']
DE: ['de.yaml']
EL: ['el.yaml']
ES: ['es.yaml']
FI: ['fi.yaml']
FR: ['fr.yaml']
GB: ['gb.yaml']
IE: ['ie.yaml']
IS: ['is.yaml']
IT: ['it.yaml']
LI: ['li.yaml']
MX: ['mx.yaml', 'north_america_informal.yaml']
NL: ['nl.yaml']
"NO": ['no.yaml']
NYSE: ['nyse.yaml']
NZ: ['nz.yaml']
PL: ['pl.yaml']
PT: ['pt.yaml']
SE: ['se.yaml']
US: ['us.yaml', 'north_america_informal.yaml']
United_Nations: ['united_nations.yaml']
UPS: ['ups.yaml']
ZA: ['za.yaml']
North_America: ['ca.yaml', 'mx.yaml', 'us.yaml', 'north_america_informal.yaml']
Europe: ['cz.yaml', 'dk.yaml', 'de.yaml', 'es.yaml', 'fr.yaml', 'gb.yaml', 'ie.yaml', 'is.yaml', 'it.yaml', 'nl.yaml', 'no.yaml', 'pt.yaml']
Scandinavia: ['dk.yaml', 'is.yaml', 'no.yaml', 'se.yaml', 'fi.yaml']
Europe: ['at.yaml', 'cz.yaml', 'dk.yaml', 'de.yaml', 'el.yaml', 'es.yaml', 'fr.yaml', 'gb.yaml', 'ie.yaml', 'is.yaml', 'it.yaml', 'li.yaml', 'nl.yaml', 'no.yaml', 'pl.yaml', 'pt.yaml']
JP: ['jp.yaml']

202
data/jp.yaml Normal file
View File

@ -0,0 +1,202 @@
# Japanese holiday definitions for Ruby Holiday gem.
# Reference: http://www.h3.dion.ne.jp/~sakatsu/holiday_topic.htm
#
# This definition can calculate current Japanese holidays,
# don't compat with past changes of Japan Holiday Act.
#
# CHANGES:
# 2010-12-25: Initial version by Tatsuki Sugiura <sugi@nemui.org>
#
---
months:
1:
- name: 元日
regions: [jp]
mday: 1
- name: 成人の日
regions: [jp]
wday: 1
week: 2
2:
- name: 建国記念日
regions: [jp]
mday: 11
- name: 振替休日
regions: [jp]
function: jp_substitute_holiday(year, 2, 11)
3:
- name: 春分の日
regions: [jp]
function: jp_vernal_equinox_day(year)
- name: 振替休日
regions: [jp]
function: jp_substitute_holiday(Holidays.jp_vernal_equinox_day(year))
4:
- name: 昭和の日
regions: [jp]
mday: 29
- name: 振替休日
regions: [jp]
function: jp_substitute_holiday(year, 4, 29)
5:
- name: 憲法記念日
regions: [jp]
mday: 3
- name: みどりの日
regions: [jp]
mday: 4
- name: こどもの日
regions: [jp]
mday: 5
- name: 振替休日
regions: [jp]
function: jp_substitute_holiday(year, 5, 3)
- name: 振替休日
regions: [jp]
function: jp_substitute_holiday(year, 5, 5)
7:
- name: 海の日
regions: [jp]
wday: 1
week: 3
- name: 振替休日
regions: [jp]
function: jp_substitute_holiday(year, 7, Date.calculate_mday(year, 7, 3, 1))
9:
- name: 敬老の日
regions: [jp]
wday: 1
week: 3
- name: 振替休日
regions: [jp]
function: jp_substitute_holiday(year, 9, Date.calculate_mday(year, 9, 3, 1))
- name: 国民の休日
regions: [jp]
function: jp_citizons_holiday(year)
- name: 秋分の日
regions: [jp]
function: jp_national_culture_day(year)
- name: 振替休日
regions: [jp]
function: jp_substitute_holiday(Holidays.jp_national_culture_day(year))
10:
- name: 体育の日
regions: [jp]
wday: 1
week: 2
- name: 振替休日
regions: [jp]
function: jp_substitute_holiday(year, 10, Date.calculate_mday(year, 10, 2, 1))
11:
- name: 文化の日
regions: [jp]
mday: 3
- name: 振替休日
regions: [jp]
function: jp_substitute_holiday(year, 11, 3)
- name: 勤労感謝の日
regions: [jp]
mday: 23
- name: 振替休日
regions: [jp]
function: jp_substitute_holiday(year, 11, 23)
12:
- name: 天皇誕生日
regions: [jp]
mday: 23
- name: 振替休日
regions: [jp]
function: jp_substitute_holiday(year, 12, 23)
methods:
jp_vernal_equinox_day: |
def self.jp_vernal_equinox_day(year)
day =
case year
when 1851..1899
19.8277
when 1900..1979
20.8357
when 1980..2099
20.8431
when 2100..2150
21.8510
else
raise IndexError.new("Out of range")
end
day += 0.242194 * (year - 1980) - ((year - 1980)/4).floor
day = day.floor
Date.civil(year, 3, day)
end
jp_national_culture_day: |
def self.jp_national_culture_day(year)
day =
case year
when 1851..1899
22.2588
when 1900..1979
23.2588
when 1980..2099
23.2488
when 2100..2150
24.2488
else
raise IndexError.new("Out of range")
end
day += 0.242194 * (year - 1980) - ((year - 1980)/4).floor
day = day.floor
Date.civil(year, 9, day)
end
jp_citizons_holiday: |
def self.jp_citizons_holiday(year)
year < 2003 and return nil
ncd = Holidays.jp_national_culture_day(year)
if ncd.wday == 3
ncd - 1
else
nil
end
end
jp_substitute_holiday: |
def self.jp_substitute_holiday(*date)
date = date[0].kind_of?(Date) ? date.first : Date.civil(*date)
date.wday == 0 ? date+1 : nil
end
tests: |
{Date.civil(2008,1,1) => '元日',
Date.civil(2010,1,11) => '成人の日',
Date.civil(2008,2,11) => '建国記念日',
Date.civil(2008,4,29) => '昭和の日',
Date.civil(2008,5,3) => '憲法記念日',
Date.civil(2008,5,5) => 'こどもの日',
Date.civil(2010,7,19) => '海の日',
Date.civil(2010,9,20) => '敬老の日',
Date.civil(2010,10,11) => '体育の日',
Date.civil(2008,11,3) => '文化の日',
Date.civil(2008,11,23) => '勤労感謝の日',
Date.civil(2008,12,23) => '天皇誕生日',
Date.civil(2010,3,22) => '振替休日',
Date.civil(2008,11,24) => '振替休日',
}.each do |date, name|
assert_equal name, (Holidays.on(date, :jp, :informal)[0] || {})[:name]
end
# vernal equinox day
[Date.civil(2004,3,20), Date.civil(2005,3,20), Date.civil(2006,3,21),
Date.civil(2007,3,21), Date.civil(2008,3,20), Date.civil(2009,3,20),
Date.civil(2010,3,21)].each do |date|
assert_equal '春分の日', Holidays.on(date, :jp)[0][:name]
end
# national culture day
[Date.civil(2004,9,23), Date.civil(2005,9,23), Date.civil(2006,9,23),
Date.civil(2007,9,23), Date.civil(2008,9,23), Date.civil(2009,9,23),
Date.civil(2010,9,23), Date.civil(2011,9,23), Date.civil(2012,9,22),
Date.civil(2013,9,23)].each do |date|
assert_equal '秋分の日', Holidays.on(date, :jp)[0][:name]
end
# citizens holiday
[Date.civil(2032,9,21), Date.civil(2049,9,21), Date.civil(2009,9,22),
Date.civil(2015,9,22), Date.civil(2026,9,22)].each do |date|
assert_equal '国民の休日', Holidays.on(date, :jp)[0][:name]
end

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

@ -1,16 +1,188 @@
# Auto-generated gemspec
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in rakefile.rb, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = "holidays"
s.version = "1.0.0"
s.date = "2010-03-04"
s.summary = "A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!"
s.email = "code@dunae.ca"
s.homepage = "http://code.dunae.ca/holidays"
s.name = "holidays"
s.version = "1.0.4"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Alex Dunae"]
s.date = "2011-10-19"
s.description = "A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!"
s.has_rdoc = true
s.author = "Alex Dunae"
s.extra_rdoc_files = ['README.rdoc', 'data/SYNTAX', 'lib/holidays/MANIFEST', 'REFERENCES', 'CHANGELOG', 'LICENSE']
s.rdoc_options << '--all' << '--inline-source' << '--line-numbers' << '--charset' << 'utf-8'
s.test_files = Dir.glob("{test}/**/*")
s.files = Dir.glob("{data,lib,test}/**/*")
s.email = "code@dunae.ca"
s.extra_rdoc_files = [
"LICENSE",
"README.rdoc"
]
s.files = [
".travis.yml",
"CHANGELOG",
"Gemfile",
"LICENSE",
"README.rdoc",
"REFERENCES",
"data/SYNTAX.rdoc",
"data/at.yaml",
"data/au.yaml",
"data/br.yaml",
"data/build_defs.rb",
"data/ca.yaml",
"data/cz.yaml",
"data/de.yaml",
"data/dk.yaml",
"data/el.yaml",
"data/es.yaml",
"data/fi.yaml",
"data/fr.yaml",
"data/gb.yaml",
"data/ie.yaml",
"data/index.yaml",
"data/is.yaml",
"data/it.yaml",
"data/jp.yaml",
"data/li.yaml",
"data/mx.yaml",
"data/nl.yaml",
"data/no.yaml",
"data/north_america_informal.yaml",
"data/nyse.yaml",
"data/nz.yaml",
"data/pl.yaml",
"data/pt.yaml",
"data/se.yaml",
"data/united_nations.yaml",
"data/ups.yaml",
"data/us.yaml",
"data/za.yaml",
"holidays.gemspec",
"lib/holidays.rb",
"lib/holidays/MANIFEST",
"lib/holidays/at.rb",
"lib/holidays/au.rb",
"lib/holidays/br.rb",
"lib/holidays/ca.rb",
"lib/holidays/cz.rb",
"lib/holidays/de.rb",
"lib/holidays/dk.rb",
"lib/holidays/el.rb",
"lib/holidays/es.rb",
"lib/holidays/europe.rb",
"lib/holidays/fi.rb",
"lib/holidays/fr.rb",
"lib/holidays/gb.rb",
"lib/holidays/ie.rb",
"lib/holidays/is.rb",
"lib/holidays/it.rb",
"lib/holidays/jp.rb",
"lib/holidays/li.rb",
"lib/holidays/mx.rb",
"lib/holidays/nl.rb",
"lib/holidays/no.rb",
"lib/holidays/north_america.rb",
"lib/holidays/nyse.rb",
"lib/holidays/nz.rb",
"lib/holidays/pl.rb",
"lib/holidays/pt.rb",
"lib/holidays/scandinavia.rb",
"lib/holidays/se.rb",
"lib/holidays/united_nations.rb",
"lib/holidays/ups.rb",
"lib/holidays/us.rb",
"lib/holidays/za.rb",
"rakefile.rb",
"test/defs/test_defs_at.rb",
"test/defs/test_defs_au.rb",
"test/defs/test_defs_br.rb",
"test/defs/test_defs_ca.rb",
"test/defs/test_defs_cz.rb",
"test/defs/test_defs_de.rb",
"test/defs/test_defs_dk.rb",
"test/defs/test_defs_el.rb",
"test/defs/test_defs_es.rb",
"test/defs/test_defs_europe.rb",
"test/defs/test_defs_fi.rb",
"test/defs/test_defs_fr.rb",
"test/defs/test_defs_gb.rb",
"test/defs/test_defs_ie.rb",
"test/defs/test_defs_is.rb",
"test/defs/test_defs_it.rb",
"test/defs/test_defs_jp.rb",
"test/defs/test_defs_li.rb",
"test/defs/test_defs_mx.rb",
"test/defs/test_defs_nl.rb",
"test/defs/test_defs_no.rb",
"test/defs/test_defs_north_america.rb",
"test/defs/test_defs_nyse.rb",
"test/defs/test_defs_nz.rb",
"test/defs/test_defs_pl.rb",
"test/defs/test_defs_pt.rb",
"test/defs/test_defs_scandinavia.rb",
"test/defs/test_defs_se.rb",
"test/defs/test_defs_ups.rb",
"test/defs/test_defs_us.rb",
"test/defs/test_defs_za.rb",
"test/test_all_regions.rb",
"test/test_date.rb",
"test/test_helper.rb",
"test/test_holidays.rb",
"test/test_multiple_regions.rb"
]
s.homepage = "https://github.com/alexdunae/holidays"
s.require_paths = ["lib"]
s.rubygems_version = "1.8.10"
s.summary = "A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!"
if s.respond_to? :specification_version then
s.specification_version = 3
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<holidays>, [">= 0"])
s.add_development_dependency(%q<rdoc>, [">= 2.4.2"])
s.add_development_dependency(%q<rake>, [">= 0"])
s.add_development_dependency(%q<rdoc>, [">= 2.4.2"])
s.add_development_dependency(%q<rdoc>, [">= 2.4.2"])
s.add_development_dependency(%q<rake>, [">= 0"])
s.add_development_dependency(%q<rdoc>, [">= 2.4.2"])
s.add_development_dependency(%q<rdoc>, [">= 2.4.2"])
s.add_development_dependency(%q<rake>, [">= 0"])
s.add_development_dependency(%q<rdoc>, [">= 2.4.2"])
s.add_development_dependency(%q<rdoc>, [">= 2.4.2"])
s.add_development_dependency(%q<rake>, [">= 0"])
s.add_development_dependency(%q<rdoc>, [">= 2.4.2"])
s.add_development_dependency(%q<rdoc>, [">= 2.4.2"])
else
s.add_dependency(%q<holidays>, [">= 0"])
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
s.add_dependency(%q<rake>, [">= 0"])
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
s.add_dependency(%q<rake>, [">= 0"])
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
s.add_dependency(%q<rake>, [">= 0"])
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
s.add_dependency(%q<rake>, [">= 0"])
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
end
else
s.add_dependency(%q<holidays>, [">= 0"])
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
s.add_dependency(%q<rake>, [">= 0"])
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
s.add_dependency(%q<rake>, [">= 0"])
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
s.add_dependency(%q<rake>, [">= 0"])
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
s.add_dependency(%q<rake>, [">= 0"])
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
s.add_dependency(%q<rdoc>, [">= 2.4.2"])
end
end

View File

@ -1,4 +1,4 @@
# coding: utf-8
# encoding: utf-8
$:.unshift File.dirname(__FILE__)
require 'digest/md5'
@ -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 = '0.9.2'
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.
#
@ -83,8 +87,23 @@ module Holidays
# => [{:name => 'Canada Day', :regions => [:ca]...}
# {:name => 'Independence Day'', :regions => [:us], ...}]
def self.between(start_date, end_date, *options)
start_date = start_date.to_date if start_date.respond_to?(:to_date)
end_date = end_date.to_date if end_date.respond_to?(:to_date)
# remove the timezone
start_date = start_date.new_offset(0) if start_date.respond_to?(:new_offset)
end_date = end_date.new_offset(0) if end_date.respond_to?(:new_offset)
# get simple dates
if start_date.respond_to?(:to_date)
start_date = start_date.to_date
else
start_date = Date.civil(start_date.year, start_date.mon, start_date.mday)
end
if end_date.respond_to?(:to_date)
end_date = end_date.to_date
else
end_date = Date.civil(end_date.year, end_date.mon, end_date.mday)
end
regions, observed, informal = parse_options(options)
holidays = []
@ -196,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.
@ -227,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]
@ -260,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 }
@ -398,7 +457,7 @@ class Date
# :first, :second, :third, :fourth or :fifth
if week > 0
return ((week - 1) * 7) + 1 + ((7 + wday - Date.civil(year, month,(week-1)*7 + 1).wday) % 7)
return ((week - 1) * 7) + 1 + ((wday - Date.civil(year, month,(week-1)*7 + 1).wday) % 7)
end
days = MONTH_LENGTHS[month-1]

View File

@ -1,28 +1,34 @@
==== Regional definitions
The following definition files are included in this installation:
* holidays/nyse
* holidays/no
* holidays/es
* holidays/ie
* holidays/united_nations
* holidays/au
* holidays/mx
* holidays/za
* holidays/scandinavia
* holidays/ca
* holidays/us
* holidays/at
* holidays/nz
* holidays/nl
* holidays/it
* holidays/de
* holidays/dk
* holidays/cz
* holidays/nz
* holidays/ups
* holidays/scandinavia
* holidays/no
* holidays/pt
* holidays/europe
* holidays/se
* holidays/north_america
* holidays/fr
* holidays/gb
* holidays/nyse
* holidays/it
* holidays/united_nations
* holidays/au
* holidays/us
* holidays/ie
* holidays/za
* holidays/is
* holidays/north_america
* holidays/es
* holidays/fi
* holidays/el
* holidays/europe
* holidays/de
* holidays/gb
* holidays/ups
* holidays/jp
* holidays/fr
* holidays/se
* holidays/ca
* holidays/br
* holidays/pl

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,43 +1,47 @@
# coding: utf-8
# 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_qld, :au_nt, :au, :au_tas, :au_wa, :au_act, :au_nsw, :au_sa, :au_vic, :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 = {
5 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_qld]},
{:wday => 1, :week => 1, :name => "May Day", :regions => [:au_nt]}],
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:au]},
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]}],
6 => [{:wday => 1, :week => 1, :name => "Foundation Day", :regions => [:au_wa]},
{:wday => 1, :week => 2, :name => "Queen's Birthday", :regions => [:au_act, :au_nsw, :au_sa, :au_tas, :au_nt, :au_qld, :au_vic]},
{:mday => 6, :type => :informal, :name => "Queensland Day", :regions => [:au_qld]}],
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:au]},
{:mday => 26, :name => "Australia Day", :regions => [:au]}],
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:au]},
{:mday => 26, :name => "Boxing Day", :regions => [:au]}],
8 => [{:wday => 3, :week => -3, :name => "Ekka", :regions => [:au_qld_brisbane]}],
3 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_wa]},
{:wday => 1, :week => 2, :name => "Eight Hours Day", :regions => [:au_tas]},
{:wday => 1, :week => 2, :name => "Labour Day", :regions => [:au_vic]}],
4 => [{:mday => 25, :name => "ANZAC Day", :regions => [:au]}],
10 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_act, :au_nsw, :au_sa]}]
}
5 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_qld]},
{:wday => 1, :week => 1, :name => "May Day", :regions => [:au_nt]}],
6 => [{:wday => 1, :week => 1, :name => "Foundation Day", :regions => [:au_wa]},
{:wday => 1, :week => 2, :name => "Queen's Birthday", :regions => [:au_act, :au_nsw, :au_sa, :au_tas, :au_nt, :au_qld, :au_vic]},
{:mday => 6, :type => :informal, :name => "Queensland Day", :regions => [:au_qld]}],
8 => [{:wday => 3, :week => -3, :name => "Ekka", :regions => [:au_qld_brisbane]}],
10 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:au_act, :au_nsw, :au_sa]}],
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:au]},
{:mday => 26, :name => "Boxing Day", :regions => [:au]}]
}
end
end
end
Holidays.merge_defs(Holidays::AU::DEFINED_REGIONS, Holidays::AU::HOLIDAYS_BY_MONTH)
Holidays.merge_defs(Holidays::AU.defined_regions, Holidays::AU.holidays_by_month)

40
lib/holidays/br.rb Normal file
View File

@ -0,0 +1,40 @@
# encoding: utf-8
module Holidays
# This file is generated by the Ruby Holidays gem.
#
# Definitions loaded: data/br.yaml
#
# To use the definitions in this file, load it right after you load the
# Holiday gem:
#
# require 'holidays'
# require 'holidays/br'
#
# All the definitions are available at https://github.com/alexdunae/holidays
module BR # :nodoc:
def self.defined_regions
[:br]
end
def self.holidays_by_month
{
0 => [{:function => lambda { |year| Holidays.easter(year)-47 }, :function_id => "easter(year)-47", :type => :informal, :name => "Carnaval", :regions => [:br]},
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Sexta-feira Santa", :regions => [:br]},
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Páscoa", :regions => [:br]},
{:function => lambda { |year| Holidays.easter(year)+60 }, :function_id => "easter(year)+60", :name => "Corpus Christ", :regions => [:br]}],
1 => [{:mday => 1, :name => "Dia da Confraternização Universal", :regions => [:br]}],
4 => [{:mday => 21, :name => "Dia de Tiradentes", :regions => [:br]}],
5 => [{:mday => 1, :name => "Dia do Trabalho", :regions => [:br]}],
9 => [{:mday => 7, :name => "Proclamação da Independência", :regions => [:br]}],
10 => [{:mday => 12, :name => "Dia de Nossa Senhora Aparecida", :regions => [:br]}],
11 => [{:mday => 2, :name => "Dia de Finados", :regions => [:br]},
{:mday => 15, :name => "Proclamação da República", :regions => [:br]}],
12 => [{:mday => 25, :name => "Natal", :regions => [:br]}]
}
end
end
end
Holidays.merge_defs(Holidays::BR.defined_regions, Holidays::BR.holidays_by_month)

View File

@ -1,54 +1,58 @@
# coding: utf-8
# 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_nf, :ca_nt, :ca_nu, :ca_ab, :ca_on, :ca_sk, :ca_mb, :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 = {
5 => [{:function => lambda { |year| Holidays.ca_victoria_day(year) }, :function_id => "ca_victoria_day(year)", :name => "Victoria Day", :regions => [:ca]},
{:function => lambda { |year| Holidays.ca_victoria_day(year) }, :function_id => "ca_victoria_day(year)", :name => "National Patriotes Day", :regions => [:ca_qc]},
{:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:ca]},
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]}],
11 => [{:mday => 11, :name => "Rememberance Day", :regions => [:ca]}],
6 => [{:mday => 24, :name => "Discovery Day", :regions => [:ca_nf]},
{:mday => 24, :name => "Fête Nationale", :regions => [:ca_qc]},
{:mday => 21, :name => "National Aboriginal Day", :regions => [:ca_nt]}],
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:ca]},
{:mday => 2, :name => "New Year's", :regions => [:ca_qc]}],
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:ca]},
{:mday => 26, :name => "Boxing Day", :regions => [:ca]}],
7 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Canada Day", :regions => [:ca]},
{:mday => 12, :name => "Orangemen's Day", :regions => [:ca_nf]},
{:mday => 9, :name => "Nunavut Day", :regions => [:ca_nu]}],
2 => [{:wday => 1, :week => 3, :name => "Family Day", :regions => [:ca_ab, :ca_on, :ca_sk]},
{:wday => 1, :week => 3, :name => "Louis Riel Day", :regions => [:ca_mb]},
{:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
{:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
3 => [{:mday => 23, :name => "St. George's Day", :regions => [:ca_nf]},
{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
5 => [{:function => lambda { |year| Holidays.ca_victoria_day(year) }, :function_id => "ca_victoria_day(year)", :name => "Victoria Day", :regions => [:ca]},
{:function => lambda { |year| Holidays.ca_victoria_day(year) }, :function_id => "ca_victoria_day(year)", :name => "National Patriotes Day", :regions => [:ca_qc]},
{:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
6 => [{:mday => 24, :name => "Discovery Day", :regions => [:ca_nf]},
{:mday => 24, :name => "Fête Nationale", :regions => [:ca_qc]},
{:mday => 21, :name => "National Aboriginal Day", :regions => [:ca_nt]}],
7 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Canada Day", :regions => [:ca]},
{:mday => 12, :name => "Orangemen's Day", :regions => [:ca_nf]},
{:mday => 9, :name => "Nunavut Day", :regions => [:ca_nu]}],
8 => [{:wday => 1, :week => 1, :name => "BC Day", :regions => [:ca_bc]},
{:wday => 1, :week => 1, :name => "Saskatchewan Day", :regions => [:ca_sk]},
{:wday => 1, :week => 1, :name => "Heritage Day", :regions => [:ca_ab]},
{:wday => 1, :week => 1, :name => "Natal Day", :regions => [:ca_ns]},
{:wday => 1, :week => 1, :name => "Civic Holiday", :regions => [:ca_on]},
{:wday => 1, :week => 3, :name => "Discovery Day", :regions => [:ca_yk]}],
3 => [{:mday => 23, :name => "St. George's Day", :regions => [:ca_nf]},
{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
9 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:ca]}],
4 => [{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
{:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}],
10 => [{:wday => 1, :week => 2, :name => "Thanksgiving", :regions => [:ca]},
{:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}]
}
{:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}],
11 => [{:mday => 11, :name => "Remembrance Day", :regions => [:ca]}],
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:ca]},
{:mday => 26, :name => "Boxing Day", :regions => [:ca]}],
4 => [{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
{:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}]
}
end
end
# Monday on or before May 24
@ -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,36 +1,40 @@
# coding: utf-8
# 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 = {
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]}],
0 => [{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Velikonoční pondělí", :regions => [:cz]}],
11 => [{:mday => 17, :name => "Den boje za svobodu a demokracii", :regions => [:cz]}],
1 => [{:mday => 1, :name => "Den obnovy samostatného českého státu", :regions => [:cz]}],
12 => [{:mday => 24, :name => "Štědrý den", :regions => [:cz]},
{:mday => 25, :name => "1. svátek vánoční", :regions => [:cz]},
{:mday => 26, :name => "2. svátek vánoční", :regions => [:cz]}],
7 => [{:mday => 5, :name => "Den slovanských věrozvěstů Cyrila a Metoděje", :regions => [:cz]},
{:mday => 6, :name => "Den upálení mistra Jana Husa", :regions => [:cz]}],
9 => [{:mday => 28, :name => "Den české státnosti", :regions => [:cz]}],
10 => [{:mday => 28, :name => "Den vzniku samostatného československého státu", :regions => [:cz]}]
}
10 => [{:mday => 28, :name => "Den vzniku samostatného československého státu", :regions => [:cz]}],
11 => [{:mday => 17, :name => "Den boje za svobodu a demokracii", :regions => [:cz]}],
12 => [{:mday => 24, :name => "Štědrý den", :regions => [:cz]},
{:mday => 25, :name => "1. svátek vánoční", :regions => [:cz]},
{:mday => 26, :name => "2. svátek vánoční", :regions => [:cz]}]
}
end
end
end
Holidays.merge_defs(Holidays::CZ::DEFINED_REGIONS, Holidays::CZ::HOLIDAYS_BY_MONTH)
Holidays.merge_defs(Holidays::CZ.defined_regions, Holidays::CZ.holidays_by_month)

View File

@ -1,36 +1,40 @@
# coding: utf-8
# 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_nw, :de_rp, :de_sl, :de_sn, :de_he, :de_st, :de_bb, :de_mv, :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 = {
5 => [{:mday => 1, :name => "Tag der Arbeit", :regions => [:de]}],
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]},
{: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]}],
11 => [{:mday => 1, :name => "Allerheiligen", :regions => [:de_bw, :de_by, :de_nw, :de_rp, :de_sl]},
{:function => lambda { |year| Holidays.de_buss_und_bettag(year) }, :function_id => "de_buss_und_bettag(year)", :name => "Buß- und Bettag", :regions => [:de_sn]}],
1 => [{:mday => 1, :name => "Neujahrstag", :regions => [:de]},
{:mday => 6, :name => "Heilige Drei Könige", :regions => [:de_bw, :de_by, :de_st]}],
12 => [{:mday => 25, :name => "1. Weihnachtstag", :regions => [:de]},
{:mday => 26, :name => "2. Weihnachtstag", :regions => [:de]}],
5 => [{:mday => 1, :name => "Tag der Arbeit", :regions => [:de]}],
8 => [{:mday => 15, :name => "Mariä Himmelfahrt", :regions => [:de_by, :de_sl]}],
10 => [{:mday => 3, :name => "Tag der Deutschen Einheit", :regions => [:de]},
{:mday => 31, :name => "Reformationstag", :regions => [:de_bb, :de_mv, :de_sn, :de_st, :de_th]}]
}
{:mday => 31, :name => "Reformationstag", :regions => [:de_bb, :de_mv, :de_sn, :de_st, :de_th]}],
11 => [{:mday => 1, :name => "Allerheiligen", :regions => [:de_bw, :de_by, :de_nw, :de_rp, :de_sl]},
{:function => lambda { |year| Holidays.de_buss_und_bettag(year) }, :function_id => "de_buss_und_bettag(year)", :name => "Buß- und Bettag", :regions => [:de_sn]}],
12 => [{:mday => 25, :name => "1. Weihnachtstag", :regions => [:de]},
{:mday => 26, :name => "2. Weihnachtstag", :regions => [:de]}]
}
end
end
# Germany: Wednesday before November 23
@ -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,23 +1,24 @@
# coding: utf-8
# 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 = {
5 => [{:mday => 1, :name => "Arbejdernes kampdag", :regions => [:dk]},
{:mday => 5, :type => :informal, :name => "Danmarks befrielse", :regions => [:dk]}],
0 => [{:function => lambda { |year| Holidays.easter(year)-49 }, :function_id => "easter(year)-49", :type => :informal, :name => "Fastelavn", :regions => [:dk]},
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]},
@ -27,22 +28,25 @@ module Holidays
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi Himmelfartsdag", :regions => [:dk]},
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pinsedag", :regions => [:dk]},
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "2. Pinsedag", :regions => [:dk]}],
11 => [{:mday => 10, :type => :informal, :name => "Mortensaften", :regions => [:dk]}],
1 => [{:mday => 1, :name => "Nytårsdag", :regions => [:dk]}],
4 => [{:mday => 1, :type => :informal, :name => "1. april", :regions => [:dk]},
{:mday => 9, :type => :informal, :name => "Danmarks besættelse", :regions => [:dk]},
{:mday => 16, :type => :informal, :name => "Dronningens fødselsdag", :regions => [:dk]}],
5 => [{:mday => 1, :name => "Arbejdernes kampdag", :regions => [:dk]},
{:mday => 5, :type => :informal, :name => "Danmarks befrielse", :regions => [:dk]}],
6 => [{:mday => 5, :name => "Grundlovsdag", :regions => [:dk]},
{:mday => 15, :type => :informal, :name => "Valdemarsdag og Genforeningsdag", :regions => [:dk]},
{:mday => 23, :type => :informal, :name => "Sankt Hans aften", :regions => [:dk]}],
1 => [{:mday => 1, :name => "Nytårsdag", :regions => [:dk]}],
11 => [{:mday => 10, :type => :informal, :name => "Mortensaften", :regions => [:dk]}],
12 => [{:mday => 13, :type => :informal, :name => "Sankt Lucia", :regions => [:dk]},
{:mday => 24, :name => "Juleaftensdag", :regions => [:dk]},
{:mday => 25, :name => "1. juledag", :regions => [:dk]},
{:mday => 26, :name => "2. juledag", :regions => [:dk]}],
4 => [{:mday => 1, :type => :informal, :name => "1. april", :regions => [:dk]},
{:mday => 9, :type => :informal, :name => "Danmarks besættelse", :regions => [:dk]},
{:mday => 16, :type => :informal, :name => "Dronningens fødselsdag", :regions => [:dk]}]
}
{:mday => 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,53 +1,57 @@
# coding: utf-8
# 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, :es_m, :es_cn, :es_cm, :es_pv, :es_ct, :es_na, :es_v, :es_vc, :es_mu, :es_lo, :es_ib, :es_ga, :es_an, :es_ce, :es_o, :es_ex, :es_ar, :es_cl]
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 = {
def self.holidays_by_month
{
0 => [{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Jueves Santo", :regions => [:es_pv, :es_ct, :es_na, :es_v, :es_vc]},
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Viernes Santo", :regions => [:es]},
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Lunes de Pascua", :regions => [:es_pv, :es_ct, :es_na, :es_v, :es_vc]}],
1 => [{:mday => 1, :name => "Año Nuevo", :regions => [:es]},
{:mday => 6, :name => "Día de Reyes", :regions => [:es]}],
2 => [{:mday => 28, :name => "Día de Andalucía", :regions => [:es_an]}],
3 => [{:mday => 1, :name => "Día de las Islas Baleares", :regions => [:es_ib]},
{:mday => 19, :name => "San José", :regions => [:es_v, :es_vc, :es_cm, :es_mu, :es_m]}],
4 => [{:mday => 23, :name => "San Jorge", :regions => [:es_ar, :es_cl]},
{:mday => 23, :name => "Día de Aragón", :regions => [:es_ar]}],
5 => [{:mday => 1, :name => "Día del Trabajador", :regions => [:es]},
{:mday => 2, :name => "Fiesta de la Comunidad", :regions => [:es_m]},
{:mday => 30, :name => "Día de las Canarias", :regions => [:es_cn]},
{:mday => 31, :name => "Día de la Región Castilla-La Mancha", :regions => [:es_cm]}],
0 => [{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Jueves Santo", :regions => [:es_pv, :es_ct, :es_na, :es_v, :es_vc]},
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Viernes Santo", :regions => [:es]},
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Lunes de Pascua", :regions => [:es_pv, :es_ct, :es_na, :es_v, :es_vc]}],
11 => [{:mday => 1, :name => "Todos los Santos", :regions => [:es]}],
6 => [{:mday => 9, :name => "Día de la Región de Murcia", :regions => [:es_mu]},
{:mday => 9, :name => "Día de La Rioja", :regions => [:es_lo]}],
1 => [{:mday => 1, :name => "Año Nuevo", :regions => [:es]},
{:mday => 6, :name => "Día de Reyes", :regions => [:es]}],
12 => [{:mday => 6, :name => "Día de la Constitución", :regions => [:es]},
{:mday => 8, :name => "Inmaculada Concepción", :regions => [:es]},
{:mday => 25, :name => "Navidad del Señor", :regions => [:es]},
{:mday => 26, :name => "San Esteban", :regions => [:es_ib, :es_ct]}],
7 => [{:mday => 23, :name => "Santiago Apostol", :regions => [:es_ga]}],
2 => [{:mday => 28, :name => "Día de Andalucía", :regions => [:es_an]}],
8 => [{:mday => 15, :name => "Asunción", :regions => [:es]}],
3 => [{:mday => 1, :name => "Día de las Islas Baleares", :regions => [:es_ib]},
{:mday => 19, :name => "San José", :regions => [:es_v, :es_vc, :es_cm, :es_mu, :es_m]}],
9 => [{:mday => 2, :name => "Día de Ceuta", :regions => [:es_ce]},
{:mday => 8, :name => "Día de Asturias", :regions => [:es_o]},
{:mday => 8, :name => "Día de Extremadura", :regions => [:es_ex]},
{:mday => 11, :name => "Fiesta Nacional de Cataluña", :regions => [:es_ct]}],
4 => [{:mday => 23, :name => "San Jorge", :regions => [:es_ar, :es_cl]},
{:mday => 23, :name => "Día de Aragón", :regions => [:es_ar]}],
10 => [{:mday => 9, :name => "Día de Valencia", :regions => [:es_vc, :es_v]},
{:mday => 12, :name => "Día de la Hispanidad", :regions => [:es]}]
}
{:mday => 12, :name => "Día de la Hispanidad", :regions => [:es]}],
11 => [{:mday => 1, :name => "Todos los Santos", :regions => [:es]}],
12 => [{:mday => 6, :name => "Día de la Constitución", :regions => [:es]},
{:mday => 8, :name => "Inmaculada Concepción", :regions => [:es]},
{:mday => 25, :name => "Navidad del Señor", :regions => [:es]},
{:mday => 26, :name => "San Esteban", :regions => [:es_ib, :es_ct]}]
}
end
end
end
Holidays.merge_defs(Holidays::ES::DEFINED_REGIONS, Holidays::ES::HOLIDAYS_BY_MONTH)
Holidays.merge_defs(Holidays::ES.defined_regions, Holidays::ES.holidays_by_month)

View File

@ -1,43 +1,28 @@
# coding: utf-8
# 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_nw, :de_rp, :de_sl, :de_sn, :de_he, :de_st, :de_bb, :de_mv, :de_th, :es, :es_m, :es_cn, :es_cm, :es_pv, :es_ct, :es_na, :es_v, :es_vc, :es_mu, :es_lo, :es_ib, :es_ga, :es_an, :es_ce, :es_o, :es_ex, :es_ar, :es_cl, :fr, :gb, :ie, :je, :gb_jsy, :gg, :gb_gsy, :gb_eng, :gb_wls, :gb_eaw, :gb_nir, :gb_sct, :im, :gb_iom, :gb_con, :is, :it, :nl, :pt]
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 = {
5 => [{: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 => "Día del Trabajador", :regions => [:es]},
{:mday => 2, :name => "Fiesta de la Comunidad", :regions => [:es_m]},
{:mday => 30, :name => "Día de las Canarias", :regions => [:es_cn]},
{:mday => 31, :name => "Día de la Región Castilla-La Mancha", :regions => [:es_cm]},
{:mday => 1, :name => "Fête du travail", :regions => [:fr]},
{:mday => 8, :name => "Victoire 1945", :regions => [:fr]},
{:wday => 1, :week => 1, :name => "May Day", :regions => [:gb, :ie]},
{:mday => 9, :name => "Liberation Day", :regions => [:je, :gb_jsy, :gg, :gb_gsy]},
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb]},
{:mday => 1, :name => "Verkalýðsdagurinn", :regions => [:is]},
{:mday => 13, :name => "Mæðradagurinn", :regions => [:is]},
{:mday => 1, :name => "Festa dei Lavoratori", :regions => [:it]},
{:mday => 4, :name => "Dodenherdenking", :regions => [:nl]},
{:mday => 5, :name => "Bevrijdingsdag", :regions => [:nl]},
{:mday => 1, :name => "1. mai", :regions => [:no]},
{:mday => 17, :name => "17. mai", :regions => [:no]},
{:mday => 1, :name => "Dia do Trabalhador", :regions => [:pt]}],
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]},
@ -48,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]},
@ -77,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]},
@ -87,35 +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]}],
11 => [{: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]},
{:mday => 11, :name => "Armistice 1918", :regions => [:fr]},
{:mday => 5, :type => :informal, :name => "Guy Fawkes Day", :regions => [:gb]},
{:mday => 16, :name => "Dagur íslenskrar tungu", :regions => [:is]},
{:mday => 1, :name => "Ognissanti", :regions => [:it]},
{:mday => 1, :name => "Todos os Santos", :regions => [:pt]}],
6 => [{:mday => 5, :name => "Grundlovsdag", :regions => [:dk]},
{:mday => 15, :type => :informal, :name => "Valdemarsdag og Genforeningsdag", :regions => [:dk]},
{:mday => 23, :type => :informal, :name => "Sankt Hans aften", :regions => [:dk]},
{:mday => 9, :name => "Día de la Región de Murcia", :regions => [:es_mu]},
{:mday => 9, :name => "Día de La Rioja", :regions => [:es_lo]},
{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:ie]},
{:mday => 3, :type => :informal, :name => "Sjómannadagurinn", :regions => [:is]},
{:mday => 17, :name => "Lýðveldisdagurinn", :regions => [:is]},
{:mday => 2, :name => "Festa della Repubblica", :regions => [:it]},
{:mday => 10, :name => "Dia de Portugal", :regions => [:pt]}],
1 => [{:mday => 1, :name => "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]},
@ -128,16 +111,89 @@ 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]}],
12 => [{:mday => 24, :name => "Štědrý den", :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, :li]},
{:mday => 1, :name => "Πρωτομαγιά", :regions => [:el]},
{:mday => 1, :name => "Día del Trabajador", :regions => [:es]},
{:mday => 2, :name => "Fiesta de la Comunidad", :regions => [:es_m]},
{:mday => 30, :name => "Día de las Canarias", :regions => [:es_cn]},
{:mday => 31, :name => "Día de la Región Castilla-La Mancha", :regions => [:es_cm]},
{:mday => 1, :name => "Fête du travail", :regions => [:fr]},
{:mday => 8, :name => "Victoire 1945", :regions => [:fr]},
{:wday => 1, :week => 1, :name => "May Day", :regions => [:gb, :ie]},
{:mday => 9, :name => "Liberation Day", :regions => [:je, :gb_jsy, :gg, :gb_gsy]},
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb]},
{:mday => 1, :name => "Verkalýðsdagurinn", :regions => [:is]},
{:mday => 13, :name => "Mæðradagurinn", :regions => [:is]},
{:mday => 1, :name => "Festa dei Lavoratori", :regions => [:it]},
{:mday => 4, :name => "Dodenherdenking", :regions => [:nl]},
{:mday => 5, :name => "Bevrijdingsdag", :regions => [:nl]},
{:mday => 1, :name => "1. mai", :regions => [:no]},
{:mday => 17, :name => "17. mai", :regions => [:no]},
{:mday => 1, :name => "Święto Państwowe (Święto Pracy)", :regions => [:pl]},
{:mday => 2, :type => :informal, :name => "Dzień Flagi Rzeczpospolitej Polskiej", :regions => [:pl]},
{:mday => 3, :name => "Święto Narodowe Trzeciego Maja", :regions => [:pl]},
{:mday => 1, :name => "Dia do Trabalhador", :regions => [:pt]}],
8 => [{:mday => 15, :name => "Mariä Himmelfahrt", :regions => [:at]},
{:mday => 15, :name => "Mariä Himmelfahrt", :regions => [:de_by, :de_sl]},
{:mday => 15, :name => "Κοίμηση της Θεοτόκου", :regions => [:el]},
{:mday => 15, :name => "Asunción", :regions => [:es]},
{:mday => 15, :name => "Assomption", :regions => [:fr]},
{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:gb_sct, :ie]},
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir]},
{:wday => 1, :week => 1, :name => "Frídagur verslunarmanna", :regions => [:is]},
{:mday => 15, :name => "Assunzione", :regions => [:it]},
{:mday => 15, :name => "Staatsfeiertag", :regions => [:li]},
{:mday => 15, :name => "Wniebowzięcie Najświętszej Maryi Panny", :regions => [:pl]},
{:mday => 15, :name => "Święto Wojska Polskiego", :regions => [:pl]},
{:mday => 15, :name => "Assunção de Nossa Senhora", :regions => [:pt]}],
10 => [{:mday => 26, :name => "Nationalfeiertag", :regions => [:at]},
{:mday => 28, :name => "Den vzniku samostatného československého státu", :regions => [:cz]},
{:mday => 3, :name => "Tag der Deutschen Einheit", :regions => [:de]},
{:mday => 31, :name => "Reformationstag", :regions => [:de_bb, :de_mv, :de_sn, :de_st, :de_th]},
{:mday => 28, :name => "Επέτειος του Όχι", :regions => [:el]},
{:mday => 9, :name => "Día de Valencia", :regions => [:es_vc, :es_v]},
{:mday => 12, :name => "Día de la Hispanidad", :regions => [:es]},
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:ie]},
{:mday => 14, :type => :informal, :name => "Dzień Nauczyciela (Dzień Edukacji Narodowej)", :regions => [:pl]},
{:mday => 5, :name => "Implantação da República", :regions => [:pt]}],
11 => [{:mday => 1, :name => "Allerheiligen", :regions => [:at, :de_bw, :de_by, :de_nw, :de_rp, :de_sl, :li]},
{:mday => 17, :name => "Den boje za svobodu a demokracii", :regions => [:cz]},
{:mday => 10, :type => :informal, :name => "Mortensaften", :regions => [:dk]},
{:function => lambda { |year| Holidays.de_buss_und_bettag(year) }, :function_id => "de_buss_und_bettag(year)", :name => "Buß- und Bettag", :regions => [:de_sn]},
{:mday => 1, :name => "Todos los Santos", :regions => [:es]},
{:mday => 1, :name => "Toussaint", :regions => [:fr]},
{:mday => 11, :name => "Armistice 1918", :regions => [:fr]},
{:mday => 5, :type => :informal, :name => "Guy Fawkes Day", :regions => [:gb]},
{:mday => 16, :name => "Dagur íslenskrar tungu", :regions => [:is]},
{:mday => 1, :name => "Ognissanti", :regions => [:it]},
{:mday => 1, :name => "Wszystkich Świętych", :regions => [:pl]},
{:mday => 2, :type => :informal, :name => "Dzień Zaduszny", :regions => [:pl]},
{:mday => 11, :name => "Narodowe Święto Niepodległości", :regions => [:pl]},
{:mday => 29, :type => :informal, :name => "Andrzejki", :regions => [:pl]},
{:mday => 1, :name => "Todos os Santos", :regions => [:pt]}],
12 => [{:mday => 8, :name => "Mariä Empfängnis", :regions => [:at]},
{:mday => 25, :name => "1. Weihnachtstag", :regions => [:at, :de]},
{:mday => 26, :name => "2. Weihnachtstag", :regions => [:at, :de]},
{:mday => 24, :name => "Štědrý den", :regions => [:cz]},
{:mday => 25, :name => "1. svátek vánoční", :regions => [:cz]},
{:mday => 26, :name => "2. svátek vánoční", :regions => [:cz]},
{:mday => 13, :type => :informal, :name => "Sankt Lucia", :regions => [:dk]},
{:mday => 24, :name => "Juleaftensdag", :regions => [:dk]},
{:mday => 25, :name => "1. juledag", :regions => [:dk, :no]},
{:mday => 26, :name => "2. juledag", :regions => [:dk, :no]},
{:mday => 25, :name => "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]},
@ -154,11 +210,22 @@ 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]}],
@ -168,25 +235,13 @@ module Holidays
{:mday => 14, :name => "Fête nationale", :regions => [:fr]},
{:mday => 5, :name => "Tynwald Day", :regions => [:im, :gb_iom]},
{:mday => 12, :name => "Battle of the Boyne", :regions => [:gb_nir]}],
2 => [{:mday => 28, :name => "Día de Andalucía", :regions => [:es_an]},
{:mday => 18, :type => :informal, :name => "Konudagur", :regions => [:is]}],
8 => [{:mday => 15, :name => "Mariä Himmelfahrt", :regions => [:de_by, :de_sl]},
{:mday => 15, :name => "Asunción", :regions => [:es]},
{:mday => 15, :name => "Assomption", :regions => [:fr]},
{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:gb_sct, :ie]},
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir]},
{:wday => 1, :week => 1, :name => "Frídagur verslunarmanna", :regions => [:is]},
{:mday => 15, :name => "Assunzione", :regions => [:it]},
{:mday => 15, :name => "Assunção de Nossa Senhora", :regions => [:pt]}],
3 => [{:mday => 1, :name => "Día de las Islas Baleares", :regions => [:es_ib]},
{:mday => 19, :name => "San José", :regions => [:es_v, :es_vc, :es_cm, :es_mu, :es_m]},
{:mday => 5, :name => "St. Piran's Day", :regions => [:gb_con]},
{:mday => 17, :name => "St. Patrick's Day", :regions => [:gb_nir, :ie]}],
9 => [{:mday => 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 => 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]},
@ -195,29 +250,37 @@ 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]}],
10 => [{: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 => 9, :name => "Día de Valencia", :regions => [:es_vc, :es_v]},
{:mday => 12, :name => "Día de la Hispanidad", :regions => [:es]},
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:ie]},
{:mday => 5, :name => "Implantação da República", :regions => [:pt]}]
}
6 => [{:mday => 5, :name => "Grundlovsdag", :regions => [:dk]},
{:mday => 15, :type => :informal, :name => "Valdemarsdag og Genforeningsdag", :regions => [:dk]},
{:mday => 23, :type => :informal, :name => "Sankt Hans aften", :regions => [:dk]},
{:mday => 9, :name => "Día de la Región de Murcia", :regions => [:es_mu]},
{:mday => 9, :name => "Día de La Rioja", :regions => [:es_lo]},
{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:ie]},
{:mday => 3, :type => :informal, :name => "Sjómannadagurinn", :regions => [:is]},
{:mday => 17, :name => "Lýðveldisdagurinn", :regions => [:is]},
{:mday => 2, :name => "Festa della Repubblica", :regions => [:it]},
{:mday => 23, :type => :informal, :name => "Dzień Ojca", :regions => [:pl]},
{:mday => 10, :name => "Dia de Portugal", :regions => [:pt]}],
3 => [{:mday => 25, :name => "Επέτειος της Επανάστασης του 1821", :regions => [:el]},
{:mday => 1, :name => "Día de las Islas Baleares", :regions => [:es_ib]},
{:mday => 19, :name => "San José", :regions => [:es_v, :es_vc, :es_cm, :es_mu, :es_m]},
{:mday => 5, :name => "St. Piran's Day", :regions => [:gb_con]},
{:mday => 17, :name => "St. Patrick's Day", :regions => [:gb_nir, :ie]},
{:mday => 19, :name => "St. Josef", :regions => [:li]},
{:mday => 8, :type => :informal, :name => "Dzień Kobiet", :regions => [:pl]},
{:mday => 10, :type => :informal, :name => "Dzień Mężczyzn", :regions => [:pl]}],
2 => [{:mday => 28, :name => "Día de Andalucía", :regions => [:es_an]},
{:mday => 18, :type => :informal, :name => "Konudagur", :regions => [:is]},
{:mday => 2, :name => "Maria Lichtmess", :regions => [:li]},
{:mday => 2, :type => :informal, :name => "Ofiarowanie Pańskie (Matki Boskiej Gromnicznej)", :regions => [:pl]},
{:mday => 14, :type => :informal, :name => "Dzień Zakochanych (Walentynki)", :regions => [:pl]}]
}
end
end
# Iceland: first day of summer (Thursday after 18 April)
def self.is_sumardagurinn_fyrsti(year)
date = Date.civil(year,4,18)
if date.wday < 4
date += (4 - date.wday)
else date
date += (11 - date.wday)
end
date
end
# Germany: Wednesday before November 23
def self.de_buss_und_bettag(year)
date = Date.civil(year,11,23)
@ -230,7 +293,31 @@ def self.de_buss_und_bettag(year)
end
# Iceland: first day of summer (Thursday after 18 April)
def self.is_sumardagurinn_fyrsti(year)
date = Date.civil(year,4,18)
if date.wday < 4
date += (4 - date.wday)
else date
date += (11 - date.wday)
end
date
end
# Poland: January 6 is holiday since 2011
def self.pl_trzech_kroli(year)
year >= 2011 ? 6 : nil
end
# Poland: January 6 wasn't holiday before 2011
def self.pl_trzech_kroli_informal(year)
year < 2011 ? 6 : nil
end
end
Holidays.merge_defs(Holidays::Europe::DEFINED_REGIONS, Holidays::Europe::HOLIDAYS_BY_MONTH)
Holidays.merge_defs(Holidays::Europe.defined_regions, Holidays::Europe.holidays_by_month)

58
lib/holidays/fi.rb Normal file
View File

@ -0,0 +1,58 @@
# encoding: utf-8
module Holidays
# This file is generated by the Ruby Holidays gem.
#
# Definitions loaded: data/fi.yaml
#
# To use the definitions in this file, load it right after you load the
# Holiday gem:
#
# require 'holidays'
# require 'holidays/fi'
#
# All the definitions are available at https://github.com/alexdunae/holidays
module FI # :nodoc:
def self.defined_regions
[:fi]
end
def self.holidays_by_month
{
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Pitkäperjantai", :regions => [:fi]},
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pääsiäispäivä", :regions => [:fi]},
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "2. Pääsiäispäivä", :regions => [:fi]},
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Helatorstai", :regions => [:fi]},
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Helluntaipäivä", :regions => [:fi]},
{:function => lambda { |year| Holidays.fi_pyhainpaiva(year) }, :function_id => "fi_pyhainpaiva(year)", :name => "Pyhäinpäivä", :regions => [:fi]}],
1 => [{:mday => 1, :name => "Uudenvuodenpäivä", :regions => [:fi]},
{:mday => 6, :name => "Loppiainen", :regions => [:fi]}],
5 => [{:mday => 1, :name => "Vappu", :regions => [:fi]}],
6 => [{:function => lambda { |year| Holidays.fi_juhannuspaiva(year) }, :function_id => "fi_juhannuspaiva(year)", :name => "Juhannuspäivä", :regions => [:fi]}],
12 => [{:mday => 6, :name => "Itsenäisyyspäivä", :regions => [:fi]},
{:mday => 24, :name => "Jouluaatto", :regions => [:fi]},
{:mday => 25, :name => "Joulupäivä", :regions => [:fi]},
{:mday => 26, :name => "Tapaninpäivä", :regions => [:fi]}]
}
end
end
# Finland: Mid-summer (Saturday between June 2026)
def self.fi_juhannuspaiva(year)
date = Date.civil(year,6,20)
date += (6 - date.wday)
date
end
# Finland: All Saint's Day (Saturday between Oct 31 and Nov 6)
def self.fi_pyhainpaiva(year)
date = Date.civil(year,10,31)
date += (6 - date.wday)
date
end
end
Holidays.merge_defs(Holidays::FI.defined_regions, Holidays::FI.holidays_by_month)

View File

@ -1,37 +1,41 @@
# coding: utf-8
# 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 = {
5 => [{:mday => 1, :name => "Fête du travail", :regions => [:fr]},
{:mday => 8, :name => "Victoire 1945", :regions => [:fr]}],
0 => [{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pâques", :regions => [:fr]},
def self.holidays_by_month
{
0 => [{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pâques", :regions => [:fr]},
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Lundi de Pâques", :regions => [:fr]},
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Ascension", :regions => [:fr]},
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pentecôte", :regions => [:fr]},
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Lundi de Pentecôte", :regions => [:fr]}],
1 => [{:mday => 1, :name => "Jour de l'an", :regions => [:fr]}],
5 => [{:mday => 1, :name => "Fête du travail", :regions => [:fr]},
{:mday => 8, :name => "Victoire 1945", :regions => [:fr]}],
7 => [{:mday => 14, :name => "Fête nationale", :regions => [:fr]}],
8 => [{:mday => 15, :name => "Assomption", :regions => [:fr]}],
11 => [{:mday => 1, :name => "Toussaint", :regions => [:fr]},
{:mday => 11, :name => "Armistice 1918", :regions => [:fr]}],
1 => [{:mday => 1, :name => "Jour de l'an", :regions => [:fr]}],
12 => [{:mday => 25, :name => "Nöel", :regions => [:fr]}],
7 => [{:mday => 14, :name => "Fête nationale", :regions => [:fr]}],
8 => [{:mday => 15, :name => "Assomption", :regions => [:fr]}]
}
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,41 +1,45 @@
# coding: utf-8
# 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, :je, :gb_jsy, :gg, :gb_gsy, :gb_eng, :gb_wls, :gb_eaw, :gb_nir, :gb_sct, :im, :gb_iom, :gb_con]
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 = {
def self.holidays_by_month
{
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:gb]},
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Easter Sunday", :regions => [:gb]},
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Easter Monday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir]}],
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:gb]},
{:mday => 2, :name => "New Year's", :regions => [:gb_sct]}],
3 => [{:mday => 5, :name => "St. Piran's Day", :regions => [:gb_con]},
{:mday => 17, :name => "St. Patrick's Day", :regions => [:gb_nir]}],
5 => [{:wday => 1, :week => 1, :name => "May Day", :regions => [:gb]},
{:mday => 9, :name => "Liberation Day", :regions => [:je, :gb_jsy, :gg, :gb_gsy]},
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb]}],
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:gb]},
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Easter Sunday", :regions => [:gb]},
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Easter Monday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir]}],
11 => [{:mday => 5, :type => :informal, :name => "Guy Fawkes Day", :regions => [:gb]}],
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:gb]},
{:mday => 2, :name => "New Year's", :regions => [:gb_sct]}],
12 => [{:mday => 25, :observed => lambda { |date| Holidays.to_monday_if_weekend(date) }, :observed_id => "to_monday_if_weekend", :name => "Christmas Day", :regions => [:gb]},
{:mday => 26, :observed => lambda { |date| Holidays.to_weekday_if_boxing_weekend(date) }, :observed_id => "to_weekday_if_boxing_weekend", :name => "Boxing Day", :regions => [:gb]}],
7 => [{:mday => 5, :name => "Tynwald Day", :regions => [:im, :gb_iom]},
{:mday => 12, :name => "Battle of the Boyne", :regions => [:gb_nir]}],
8 => [{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:gb_sct]},
{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb_eng, :gb_wls, :gb_eaw, :gb_nir]}],
3 => [{:mday => 5, :name => "St. Piran's Day", :regions => [:gb_con]},
{:mday => 17, :name => "St. Patrick's Day", :regions => [:gb_nir]}]
}
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,33 +1,37 @@
# coding: utf-8
# 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 = {
5 => [{:wday => 1, :week => 1, :name => "May Day", :regions => [:ie]}],
0 => [{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Easter Monday", :regions => [:ie]}],
6 => [{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:ie]}],
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]}],
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:ie]},
{:mday => 26, :name => "St. Stephen's Day", :regions => [:ie]}],
8 => [{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:ie]}],
3 => [{:mday => 17, :name => "St. Patrick's Day", :regions => [:ie]}],
10 => [{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:ie]}]
}
5 => [{:wday => 1, :week => 1, :name => "May Day", :regions => [:ie]}],
6 => [{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:ie]}],
8 => [{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:ie]}],
10 => [{:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:ie]}],
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:ie]},
{:mday => 26, :name => "St. Stephen's Day", :regions => [:ie]}]
}
end
end
end
Holidays.merge_defs(Holidays::IE::DEFINED_REGIONS, Holidays::IE::HOLIDAYS_BY_MONTH)
Holidays.merge_defs(Holidays::IE.defined_regions, Holidays::IE.holidays_by_month)

View File

@ -1,23 +1,24 @@
# coding: utf-8
# 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 = {
5 => [{:mday => 1, :name => "Verkalýðsdagurinn", :regions => [:is]},
{:mday => 13, :name => "Mæðradagurinn", :regions => [:is]}],
0 => [{:function => lambda { |year| Holidays.easter(year)-48 }, :function_id => "easter(year)-48", :name => "Bolludagur", :regions => [:is]},
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]},
@ -28,20 +29,23 @@ module Holidays
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Uppstigningardagur", :regions => [:is]},
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Hvítasunnudagur", :regions => [:is]},
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Annar í hvítasunnu", :regions => [:is]}],
11 => [{:mday => 16, :name => "Dagur íslenskrar tungu", :regions => [:is]}],
6 => [{:mday => 3, :type => :informal, :name => "Sjómannadagurinn", :regions => [:is]},
{:mday => 17, :name => "Lýðveldisdagurinn", :regions => [:is]}],
1 => [{:mday => 1, :name => "Nýársdagur", :regions => [:is]},
{:mday => 6, :name => "Þrettándinn", :regions => [:is]},
{:mday => 19, :type => :informal, :name => "Bóndadagur", :regions => [:is]}],
2 => [{:mday => 18, :type => :informal, :name => "Konudagur", :regions => [:is]}],
4 => [{:function => lambda { |year| Holidays.is_sumardagurinn_fyrsti(year) }, :function_id => "is_sumardagurinn_fyrsti(year)", :name => "Sumardagurinn fyrsti", :regions => [:is]}],
5 => [{:mday => 1, :name => "Verkalýðsdagurinn", :regions => [:is]},
{:mday => 13, :name => "Mæðradagurinn", :regions => [:is]}],
6 => [{:mday => 3, :type => :informal, :name => "Sjómannadagurinn", :regions => [:is]},
{:mday => 17, :name => "Lýðveldisdagurinn", :regions => [:is]}],
8 => [{:wday => 1, :week => 1, :name => "Frídagur verslunarmanna", :regions => [:is]}],
11 => [{:mday => 16, :name => "Dagur íslenskrar tungu", :regions => [:is]}],
12 => [{:mday => 24, :name => "Jól", :regions => [:is]},
{:mday => 25, :name => "Jól", :regions => [:is]},
{:mday => 26, :name => "Jól", :regions => [:is]},
{:mday => 31, :name => "Gamlárskvöld", :regions => [:is]}],
2 => [{:mday => 18, :type => :informal, :name => "Konudagur", :regions => [:is]}],
8 => [{:wday => 1, :week => 1, :name => "Frídagur verslunarmanna", :regions => [:is]}],
4 => [{:function => lambda { |year| Holidays.is_sumardagurinn_fyrsti(year) }, :function_id => "is_sumardagurinn_fyrsti(year)", :name => "Sumardagurinn fyrsti", :regions => [:is]}]
}
{: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,36 +1,40 @@
# coding: utf-8
# 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 = {
5 => [{:mday => 1, :name => "Festa dei Lavoratori", :regions => [:it]}],
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]}],
11 => [{:mday => 1, :name => "Ognissanti", :regions => [:it]}],
6 => [{:mday => 2, :name => "Festa della Repubblica", :regions => [:it]}],
1 => [{:mday => 1, :name => "Capodanno", :regions => [:it]},
{:mday => 6, :name => "Epifania", :regions => [:it]}],
4 => [{:mday => 25, :name => "Festa della Liberazione", :regions => [:it]}],
5 => [{:mday => 1, :name => "Festa dei Lavoratori", :regions => [:it]}],
6 => [{:mday => 2, :name => "Festa della Repubblica", :regions => [:it]}],
8 => [{:mday => 15, :name => "Assunzione", :regions => [:it]}],
11 => [{:mday => 1, :name => "Ognissanti", :regions => [:it]}],
12 => [{:mday => 8, :name => "Immacolata Concezione", :regions => [:it]},
{:mday => 25, :name => "Natale", :regions => [:it]},
{:mday => 26, :name => "Santo Stefano", :regions => [:it]}],
8 => [{:mday => 15, :name => "Assunzione", :regions => [:it]}],
4 => [{:mday => 25, :name => "Festa della Liberazione", :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)

113
lib/holidays/jp.rb Normal file
View File

@ -0,0 +1,113 @@
# encoding: utf-8
module Holidays
# This file is generated by the Ruby Holidays gem.
#
# Definitions loaded: data/jp.yaml
#
# To use the definitions in this file, load it right after you load the
# Holiday gem:
#
# require 'holidays'
# require 'holidays/jp'
#
# All the definitions are available at https://github.com/alexdunae/holidays
module JP # :nodoc:
def self.defined_regions
[:jp]
end
def self.holidays_by_month
{
1 => [{:mday => 1, :name => "元日", :regions => [:jp]},
{:wday => 1, :week => 2, :name => "成人の日", :regions => [:jp]}],
2 => [{:mday => 11, :name => "建国記念日", :regions => [:jp]},
{:function => lambda { |year| Holidays.jp_substitute_holiday(year, 2, 11) }, :function_id => "jp_substitute_holiday(year, 2, 11)", :name => "振替休日", :regions => [:jp]}],
3 => [{:function => lambda { |year| Holidays.jp_vernal_equinox_day(year) }, :function_id => "jp_vernal_equinox_day(year)", :name => "春分の日", :regions => [:jp]},
{:function => lambda { |year| Holidays.jp_substitute_holiday(Holidays.jp_vernal_equinox_day(year)) }, :function_id => "jp_substitute_holiday(Holidays.jp_vernal_equinox_day(year))", :name => "振替休日", :regions => [:jp]}],
4 => [{:mday => 29, :name => "昭和の日", :regions => [:jp]},
{:function => lambda { |year| Holidays.jp_substitute_holiday(year, 4, 29) }, :function_id => "jp_substitute_holiday(year, 4, 29)", :name => "振替休日", :regions => [:jp]}],
5 => [{:mday => 3, :name => "憲法記念日", :regions => [:jp]},
{:mday => 4, :name => "みどりの日", :regions => [:jp]},
{:mday => 5, :name => "こどもの日", :regions => [:jp]},
{:function => lambda { |year| Holidays.jp_substitute_holiday(year, 5, 3) }, :function_id => "jp_substitute_holiday(year, 5, 3)", :name => "振替休日", :regions => [:jp]},
{:function => lambda { |year| Holidays.jp_substitute_holiday(year, 5, 5) }, :function_id => "jp_substitute_holiday(year, 5, 5)", :name => "振替休日", :regions => [:jp]}],
7 => [{:wday => 1, :week => 3, :name => "海の日", :regions => [:jp]},
{:function => lambda { |year| Holidays.jp_substitute_holiday(year, 7, Date.calculate_mday(year, 7, 3, 1)) }, :function_id => "jp_substitute_holiday(year, 7, Date.calculate_mday(year, 7, 3, 1))", :name => "振替休日", :regions => [:jp]}],
9 => [{:wday => 1, :week => 3, :name => "敬老の日", :regions => [:jp]},
{:function => lambda { |year| Holidays.jp_substitute_holiday(year, 9, Date.calculate_mday(year, 9, 3, 1)) }, :function_id => "jp_substitute_holiday(year, 9, Date.calculate_mday(year, 9, 3, 1))", :name => "振替休日", :regions => [:jp]},
{:function => lambda { |year| Holidays.jp_citizons_holiday(year) }, :function_id => "jp_citizons_holiday(year)", :name => "国民の休日", :regions => [:jp]},
{:function => lambda { |year| Holidays.jp_national_culture_day(year) }, :function_id => "jp_national_culture_day(year)", :name => "秋分の日", :regions => [:jp]},
{:function => lambda { |year| Holidays.jp_substitute_holiday(Holidays.jp_national_culture_day(year)) }, :function_id => "jp_substitute_holiday(Holidays.jp_national_culture_day(year))", :name => "振替休日", :regions => [:jp]}],
10 => [{:wday => 1, :week => 2, :name => "体育の日", :regions => [:jp]},
{:function => lambda { |year| Holidays.jp_substitute_holiday(year, 10, Date.calculate_mday(year, 10, 2, 1)) }, :function_id => "jp_substitute_holiday(year, 10, Date.calculate_mday(year, 10, 2, 1))", :name => "振替休日", :regions => [:jp]}],
11 => [{:mday => 3, :name => "文化の日", :regions => [:jp]},
{:function => lambda { |year| Holidays.jp_substitute_holiday(year, 11, 3) }, :function_id => "jp_substitute_holiday(year, 11, 3)", :name => "振替休日", :regions => [:jp]},
{:mday => 23, :name => "勤労感謝の日", :regions => [:jp]},
{:function => lambda { |year| Holidays.jp_substitute_holiday(year, 11, 23) }, :function_id => "jp_substitute_holiday(year, 11, 23)", :name => "振替休日", :regions => [:jp]}],
12 => [{:mday => 23, :name => "天皇誕生日", :regions => [:jp]},
{:function => lambda { |year| Holidays.jp_substitute_holiday(year, 12, 23) }, :function_id => "jp_substitute_holiday(year, 12, 23)", :name => "振替休日", :regions => [:jp]}]
}
end
end
def self.jp_vernal_equinox_day(year)
day =
case year
when 1851..1899
19.8277
when 1900..1979
20.8357
when 1980..2099
20.8431
when 2100..2150
21.8510
else
raise IndexError.new("Out of range")
end
day += 0.242194 * (year - 1980) - ((year - 1980)/4).floor
day = day.floor
Date.civil(year, 3, day)
end
def self.jp_national_culture_day(year)
day =
case year
when 1851..1899
22.2588
when 1900..1979
23.2588
when 1980..2099
23.2488
when 2100..2150
24.2488
else
raise IndexError.new("Out of range")
end
day += 0.242194 * (year - 1980) - ((year - 1980)/4).floor
day = day.floor
Date.civil(year, 9, day)
end
def self.jp_citizons_holiday(year)
year < 2003 and return nil
ncd = Holidays.jp_national_culture_day(year)
if ncd.wday == 3
ncd - 1
else
nil
end
end
def self.jp_substitute_holiday(*date)
date = date[0].kind_of?(Date) ? date.first : Date.civil(*date)
date.wday == 0 ? date+1 : nil
end
end
Holidays.merge_defs(Holidays::JP.defined_regions, Holidays::JP.holidays_by_month)

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,52 +1,56 @@
# coding: utf-8
# 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 = {
def self.holidays_by_month
{
1 => [{:mday => 1, :name => "Año nuevo", :regions => [:mx]},
{:mday => 6, :name => "Dia de los Santos Reyes", :regions => [:mx]}],
2 => [{:wday => 1, :week => 1, :name => "Día de la Constitución", :regions => [:mx]},
{:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
{:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
3 => [{:wday => 1, :week => 3, :name => "Natalicio de Benito Juárez", :regions => [:mx]},
{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
4 => [{:mday => 30, :type => :informal, :name => "Día del Niño", :regions => [:mx]},
{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
{:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}],
5 => [{:mday => 1, :name => "Día del Trabajo", :regions => [:mx]},
{:mday => 5, :type => :informal, :name => "Cinco de Mayo", :regions => [:mx]},
{:mday => 5, :name => "La Batalla de Puebla", :regions => [:mx_pue]},
{:mday => 10, :type => :informal, :name => "Día de la Madre", :regions => [:mx]},
{:mday => 15, :type => :informal, :name => "Día del Maestro", :regions => [:mx]},
{:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
6 => [{:wday => 0, :week => 3, :type => :informal, :name => "Día del Padre", :regions => [:mx]}],
9 => [{:mday => 15, :name => "Grito de Dolores", :regions => [:mx]},
{:mday => 16, :name => "Día de la Independencia", :regions => [:mx]}],
10 => [{:mday => 12, :type => :informal, :name => "Día de la Raza", :regions => [:mx]},
{:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}],
11 => [{:mday => 1, :type => :informal, :name => "Todos los Santos", :regions => [:mx]},
{:mday => 2, :type => :informal, :name => "Los Fieles Difuntos", :regions => [:mx]},
{:wday => 1, :week => 3, :name => "Día de la Revolución", :regions => [:mx]}],
6 => [{:wday => 0, :week => 3, :type => :informal, :name => "Día del Padre", :regions => [:mx]}],
1 => [{:mday => 1, :name => "Año nuevo", :regions => [:mx]},
{:mday => 6, :name => "Dia de los Santos Reyes", :regions => [:mx]}],
12 => [{:mday => 12, :type => :informal, :name => "Día de la Virgen de Guadalupe", :regions => [:mx]},
{:mday => 24, :type => :informal, :name => "Nochebuena", :regions => [:mx]},
{:mday => 25, :name => "Navidad", :regions => [:mx]},
{:mday => 28, :name => "Los Santos Inocentes", :regions => [:mx]}],
2 => [{:wday => 1, :week => 1, :name => "Día de la Constitución", :regions => [:mx]},
{:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
{:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
3 => [{:wday => 1, :week => 3, :name => "Natalicio de Benito Juárez", :regions => [:mx]},
{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
9 => [{:mday => 15, :name => "Grito de Dolores", :regions => [:mx]},
{:mday => 16, :name => "Día de la Independencia", :regions => [:mx]}],
4 => [{:mday => 30, :type => :informal, :name => "Día del Niño", :regions => [:mx]},
{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
{:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}],
10 => [{:mday => 12, :type => :informal, :name => "Día de la Raza", :regions => [:mx]},
{:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}]
}
{: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,37 +1,41 @@
# coding: utf-8
# 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 = {
5 => [{:mday => 4, :name => "Dodenherdenking", :regions => [:nl]},
{:mday => 5, :name => "Bevrijdingsdag", :regions => [:nl]}],
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Goede Vrijdag", :regions => [:nl]},
def self.holidays_by_month
{
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Goede Vrijdag", :regions => [:nl]},
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pasen", :regions => [:nl]},
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Pasen", :regions => [:nl]},
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Hemelvaartsdag", :regions => [:nl]},
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pinksteren", :regions => [:nl]},
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pinksteren", :regions => [:nl]}],
1 => [{:mday => 1, :name => "Nieuwjaar", :regions => [:nl]}],
4 => [{:mday => 30, :name => "Koninginnedag", :regions => [:nl]}],
5 => [{:mday => 4, :name => "Dodenherdenking", :regions => [:nl]},
{:mday => 5, :name => "Bevrijdingsdag", :regions => [:nl]}],
12 => [{:mday => 5, :type => :informal, :name => "Sinterklaas", :regions => [:nl]},
{:mday => 25, :name => "Kerstmis", :regions => [:nl]},
{:mday => 26, :name => "Kerstmis", :regions => [:nl]}],
4 => [{:mday => 30, :name => "Koninginnedag", :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,23 +1,24 @@
# coding: utf-8
# 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 = {
5 => [{:mday => 1, :name => "1. mai", :regions => [:no]},
{:mday => 17, :name => "17. mai", :regions => [:no]}],
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]},
@ -27,14 +28,17 @@ module Holidays
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "1. pinsedag", :regions => [:no]},
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "2. pinsedag", :regions => [:no]}],
1 => [{:mday => 1, :name => "Nyttårsdag", :regions => [:no]}],
5 => [{:mday => 1, :name => "1. mai", :regions => [:no]},
{:mday => 17, :name => "17. mai", :regions => [:no]}],
12 => [{:mday => 24, :type => :informal, :name => "Julaften", :regions => [:no]},
{:mday => 25, :name => "1. juledag", :regions => [:no]},
{:mday => 26, :name => "2. juledag", :regions => [:no]},
{:mday => 31, :type => :informal, :name => "Nyttårsaften", :regions => [:no]}]
}
}
end
end
end
Holidays.merge_defs(Holidays::NO::DEFINED_REGIONS, Holidays::NO::HOLIDAYS_BY_MONTH)
Holidays.merge_defs(Holidays::NO.defined_regions, Holidays::NO.holidays_by_month)

View File

@ -1,20 +1,42 @@
# coding: utf-8
# 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_nf, :ca_nt, :ca_nu, :ca_ab, :ca_on, :ca_sk, :ca_mb, :ca_bc, :ca_ns, :ca_yk, :mx, :mx_pue, :us, :us_dc]
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 = {
def self.holidays_by_month
{
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:ca]},
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :type => :informal, :name => "Easter Monday", :regions => [:ca]},
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :type => :informal, :name => "Good Friday", :regions => [:us]}],
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:ca]},
{:mday => 2, :name => "New Year's", :regions => [:ca_qc]},
{:mday => 1, :name => "Año nuevo", :regions => [:mx]},
{:mday => 6, :name => "Dia de los Santos Reyes", :regions => [:mx]},
{:mday => 1, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "New Year's Day", :regions => [:us]},
{:wday => 1, :week => 3, :name => "Martin Luther King, Jr. Day", :regions => [:us]},
{:function => lambda { |year| Holidays.us_inauguration_day(year) }, :function_id => "us_inauguration_day(year)", :name => "Inauguration Day", :regions => [:us_dc]}],
2 => [{:wday => 1, :week => 3, :name => "Family Day", :regions => [:ca_ab, :ca_on, :ca_sk]},
{:wday => 1, :week => 3, :name => "Louis Riel Day", :regions => [:ca_mb]},
{:wday => 1, :week => 1, :name => "Día de la Constitución", :regions => [:mx]},
{:wday => 1, :week => 3, :name => "Presidents' Day", :regions => [:us]},
{:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
{:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
3 => [{:mday => 23, :name => "St. George's Day", :regions => [:ca_nf]},
{:wday => 1, :week => 3, :name => "Natalicio de Benito Juárez", :regions => [:mx]},
{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
5 => [{:function => lambda { |year| Holidays.ca_victoria_day(year) }, :function_id => "ca_victoria_day(year)", :name => "Victoria Day", :regions => [:ca]},
{:function => lambda { |year| Holidays.ca_victoria_day(year) }, :function_id => "ca_victoria_day(year)", :name => "National Patriotes Day", :regions => [:ca_qc]},
{:mday => 1, :name => "Día del Trabajo", :regions => [:mx]},
@ -24,26 +46,34 @@ module Holidays
{:mday => 15, :type => :informal, :name => "Día del Maestro", :regions => [:mx]},
{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:us]},
{:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:ca]},
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :type => :informal, :name => "Easter Monday", :regions => [:ca]},
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :type => :informal, :name => "Good Friday", :regions => [:us]}],
11 => [{:mday => 11, :name => "Rememberance Day", :regions => [:ca]},
6 => [{:mday => 24, :name => "Discovery Day", :regions => [:ca_nf]},
{:mday => 24, :name => "Fête Nationale", :regions => [:ca_qc]},
{:mday => 21, :name => "National Aboriginal Day", :regions => [:ca_nt]},
{:wday => 0, :week => 3, :type => :informal, :name => "Día del Padre", :regions => [:mx]}],
7 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Canada Day", :regions => [:ca]},
{:mday => 12, :name => "Orangemen's Day", :regions => [:ca_nf]},
{:mday => 9, :name => "Nunavut Day", :regions => [:ca_nu]},
{:mday => 4, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Independence Day", :regions => [:us]}],
8 => [{:wday => 1, :week => 1, :name => "BC Day", :regions => [:ca_bc]},
{:wday => 1, :week => 1, :name => "Saskatchewan Day", :regions => [:ca_sk]},
{:wday => 1, :week => 1, :name => "Heritage Day", :regions => [:ca_ab]},
{:wday => 1, :week => 1, :name => "Natal Day", :regions => [:ca_ns]},
{:wday => 1, :week => 1, :name => "Civic Holiday", :regions => [:ca_on]},
{:wday => 1, :week => 3, :name => "Discovery Day", :regions => [:ca_yk]}],
9 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:ca]},
{:mday => 15, :name => "Grito de Dolores", :regions => [:mx]},
{:mday => 16, :name => "Día de la Independencia", :regions => [:mx]},
{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:us]}],
10 => [{:wday => 1, :week => 2, :name => "Thanksgiving", :regions => [:ca]},
{:mday => 12, :type => :informal, :name => "Día de la Raza", :regions => [:mx]},
{:wday => 1, :week => 2, :name => "Columbus Day", :regions => [:us]},
{:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}],
11 => [{:mday => 11, :name => "Remembrance Day", :regions => [:ca]},
{:mday => 1, :type => :informal, :name => "Todos los Santos", :regions => [:mx]},
{:mday => 2, :type => :informal, :name => "Los Fieles Difuntos", :regions => [:mx]},
{:wday => 1, :week => 3, :name => "Día de la Revolución", :regions => [:mx]},
{:mday => 11, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Veterans Day", :regions => [:us]},
{:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:us]}],
6 => [{:mday => 24, :name => "Discovery Day", :regions => [:ca_nf]},
{:mday => 24, :name => "Fête Nationale", :regions => [:ca_qc]},
{:mday => 21, :name => "National Aboriginal Day", :regions => [:ca_nt]},
{:wday => 0, :week => 3, :type => :informal, :name => "Día del Padre", :regions => [:mx]}],
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:ca]},
{:mday => 2, :name => "New Year's", :regions => [:ca_qc]},
{:mday => 1, :name => "Año nuevo", :regions => [:mx]},
{:mday => 6, :name => "Dia de los Santos Reyes", :regions => [:mx]},
{:mday => 1, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "New Year's Day", :regions => [:us]},
{:wday => 1, :week => 3, :name => "Martin Luther King, Jr. Day", :regions => [:us]},
{:function => lambda { |year| Holidays.us_inauguration_day(year) }, :function_id => "us_inauguration_day(year)", :name => "Inauguration Day", :regions => [:us_dc]}],
12 => [{:mday => 25, :name => "Christmas Day", :regions => [:ca]},
{:mday => 26, :name => "Boxing Day", :regions => [:ca]},
{:mday => 12, :type => :informal, :name => "Día de la Virgen de Guadalupe", :regions => [:mx]},
@ -51,37 +81,11 @@ module Holidays
{:mday => 25, :name => "Navidad", :regions => [:mx]},
{:mday => 28, :name => "Los Santos Inocentes", :regions => [:mx]},
{:mday => 25, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Christmas Day", :regions => [:us]}],
7 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Canada Day", :regions => [:ca]},
{:mday => 12, :name => "Orangemen's Day", :regions => [:ca_nf]},
{:mday => 9, :name => "Nunavut Day", :regions => [:ca_nu]},
{:mday => 4, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Independence Day", :regions => [:us]}],
2 => [{:wday => 1, :week => 3, :name => "Family Day", :regions => [:ca_ab, :ca_on, :ca_sk]},
{:wday => 1, :week => 3, :name => "Louis Riel Day", :regions => [:ca_mb]},
{:wday => 1, :week => 1, :name => "Día de la Constitución", :regions => [:mx]},
{:wday => 1, :week => 3, :name => "Presidents' Day", :regions => [:us]},
{:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
{:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
8 => [{:wday => 1, :week => 1, :name => "BC Day", :regions => [:ca_bc]},
{:wday => 1, :week => 1, :name => "Saskatchewan Day", :regions => [:ca_sk]},
{:wday => 1, :week => 1, :name => "Heritage Day", :regions => [:ca_ab]},
{:wday => 1, :week => 1, :name => "Natal Day", :regions => [:ca_ns]},
{:wday => 1, :week => 1, :name => "Civic Holiday", :regions => [:ca_on]},
{:wday => 1, :week => 3, :name => "Discovery Day", :regions => [:ca_yk]}],
3 => [{:mday => 23, :name => "St. George's Day", :regions => [:ca_nf]},
{:wday => 1, :week => 3, :name => "Natalicio de Benito Juárez", :regions => [:mx]},
{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
9 => [{:wday => 1, :week => 1, :name => "Labour Day", :regions => [:ca]},
{:mday => 15, :name => "Grito de Dolores", :regions => [:mx]},
{:mday => 16, :name => "Día de la Independencia", :regions => [:mx]},
{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:us]}],
4 => [{:mday => 30, :type => :informal, :name => "Día del Niño", :regions => [:mx]},
{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
{:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}],
10 => [{:wday => 1, :week => 2, :name => "Thanksgiving", :regions => [:ca]},
{:mday => 12, :type => :informal, :name => "Día de la Raza", :regions => [:mx]},
{:wday => 1, :week => 2, :name => "Columbus Day", :regions => [:us]},
{:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}]
}
{: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,33 +1,37 @@
# coding: utf-8
# 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 = {
5 => [{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:nyse]}],
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:nyse]}],
11 => [{:wday => 4, :week => 4, :name => "Thanksgiving", :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]}],
12 => [{:mday => 25, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Christmas Day", :regions => [:nyse]}],
7 => [{:mday => 4, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Independence Day", :regions => [:nyse]}],
2 => [{:wday => 1, :week => 3, :name => "Presidents' Day", :regions => [:nyse]}],
9 => [{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:nyse]}]
}
5 => [{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:nyse]}],
7 => [{:mday => 4, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Independence Day", :regions => [:nyse]}],
9 => [{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:nyse]}],
11 => [{:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:nyse]}],
12 => [{:mday => 25, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Christmas Day", :regions => [:nyse]}]
}
end
end
end
Holidays.merge_defs(Holidays::NYSE::DEFINED_REGIONS, Holidays::NYSE::HOLIDAYS_BY_MONTH)
Holidays.merge_defs(Holidays::NYSE.defined_regions, Holidays::NYSE.holidays_by_month)

View File

@ -1,45 +1,49 @@
# coding: utf-8
# 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_ca, :nz_ch, :nz, :nz_wl, :nz_sl, :nz_we, :nz_ak, :nz_nl, :nz_ot, :nz_sc, :nz_hb, :nz_mb]
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]}],
11 => [{:wday => 5, :week => 2, :name => "Canterbury Anniversary Day", :regions => [:nz_ca]},
{:mday => 30, :observed => lambda { |date| Holidays.closest_monday(date) }, :observed_id => "closest_monday", :name => "Chatham Island Anniversary Day", :regions => [:nz_ch]}],
6 => [{:wday => 1, :week => 1, :name => "Queen's Birthday", :regions => [:nz]}],
1 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_weekend(date) }, :observed_id => "to_monday_if_weekend", :name => "New Year's Day", :regions => [:nz]},
{:mday => 2, :observed => lambda { |date| Holidays.to_weekday_if_boxing_weekend(date) }, :observed_id => "to_weekday_if_boxing_weekend", :name => "Day after New Year's Day", :regions => [:nz]},
{:mday => 17, :name => "Southland Anniversary Day", :regions => [:nz_sl]},
{:mday => 22, :observed => lambda { |date| Holidays.closest_monday(date) }, :observed_id => "closest_monday", :name => "Wellington Anniversary Day", :regions => [:nz_we]},
{:mday => 29, :observed => lambda { |date| Holidays.closest_monday(date) }, :observed_id => "closest_monday", :name => "Auckland Anniversary Day", :regions => [:nz_ak]},
{:mday => 29, :observed => lambda { |date| Holidays.closest_monday(date) }, :observed_id => "closest_monday", :name => "Northland Anniversary Day", :regions => [:nz_nl]}],
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]}],
2 => [{:mday => 1, :observed => lambda { |date| Holidays.closest_monday(date) }, :observed_id => "closest_monday", :name => "Nelson Anniversary Day", :regions => [:nz_ak]},
{:mday => 6, :name => "Waitangi Day", :regions => [:nz]}],
3 => [{:mday => 23, :observed => lambda { |date| Holidays.closest_monday(date) }, :observed_id => "closest_monday", :name => "Otago Anniversary Day", :regions => [:nz_ot]},
{:wday => 1, :week => 2, :name => "Taranaki Anniversary Day", :regions => [:nz_ak]}],
9 => [{:wday => 1, :week => 4, :name => "Dominion Day", :regions => [:nz_sc]}],
4 => [{:mday => 25, :name => "ANZAC Day", :regions => [:nz]}],
6 => [{:wday => 1, :week => 1, :name => "Queen's Birthday", :regions => [:nz]}],
9 => [{:wday => 1, :week => 4, :name => "Dominion Day", :regions => [:nz_sc]}],
10 => [{:wday => 1, :week => 1, :observed => lambda { |date| Holidays.previous_friday(date) }, :observed_id => "previous_friday", :name => "Hawke's bay Anniversary Day", :regions => [:nz_hb]},
{:wday => 1, :week => 4, :name => "Labour Day", :regions => [:nz]},
{:wday => 1, :week => 4, :observed => lambda { |date| Holidays.next_week(date) }, :observed_id => "next_week", :name => "Marlborough Anniversary Day", :regions => [:nz_mb]}]
}
{:wday => 1, :week => 4, :observed => lambda { |date| Holidays.next_week(date) }, :observed_id => "next_week", :name => "Marlborough Anniversary Day", :regions => [:nz_mb]}],
11 => [{:wday => 5, :week => 2, :name => "Canterbury Anniversary Day", :regions => [:nz_ca]},
{:mday => 30, :observed => lambda { |date| Holidays.closest_monday(date) }, :observed_id => "closest_monday", :name => "Chatham Island Anniversary Day", :regions => [:nz_ch]}],
12 => [{:mday => 1, :observed => lambda { |date| Holidays.closest_monday(date) }, :observed_id => "closest_monday", :name => "Westland Anniversary Day", :regions => [:nz_wl]},
{:mday => 25, :observed => lambda { |date| Holidays.to_monday_if_weekend(date) }, :observed_id => "to_monday_if_weekend", :name => "Christmas Day", :regions => [:nz]},
{:mday => 26, :observed => lambda { |date| Holidays.to_weekday_if_boxing_weekend(date) }, :observed_id => "to_weekday_if_boxing_weekend", :name => "Boxing Day", :regions => [:nz]}]
}
end
end
def self.closest_monday(date)
@ -54,16 +58,16 @@ def self.closest_monday(date)
end
def self.next_week(date)
date + 7
end
def self.previous_friday(date)
date - 3
end
def self.next_week(date)
date + 7
end
end
Holidays.merge_defs(Holidays::NZ::DEFINED_REGIONS, Holidays::NZ::HOLIDAYS_BY_MONTH)
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,38 +1,42 @@
# coding: utf-8
# 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 = {
5 => [{:mday => 1, :name => "Dia do Trabalhador", :regions => [:pt]}],
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]}],
11 => [{:mday => 1, :name => "Todos os Santos", :regions => [:pt]}],
6 => [{:mday => 10, :name => "Dia de Portugal", :regions => [:pt]}],
1 => [{:mday => 1, :name => "Ano Novo", :regions => [:pt]}],
4 => [{:mday => 25, :name => "Dia da Liberdade", :regions => [:pt]}],
5 => [{:mday => 1, :name => "Dia do Trabalhador", :regions => [:pt]}],
6 => [{:mday => 10, :name => "Dia de Portugal", :regions => [:pt]}],
8 => [{:mday => 15, :name => "Assunção de Nossa Senhora", :regions => [:pt]}],
10 => [{:mday => 5, :name => "Implantação da República", :regions => [:pt]}],
11 => [{:mday => 1, :name => "Todos os Santos", :regions => [:pt]}],
12 => [{:mday => 1, :name => "Restauração da Independência", :regions => [:pt]},
{:mday => 8, :name => "Imaculada Conceição", :regions => [:pt]},
{:mday => 25, :name => "Natal", :regions => [:pt]}],
8 => [{:mday => 15, :name => "Assunção de Nossa Senhora", :regions => [:pt]}],
4 => [{:mday => 25, :name => "Dia da Liberdade", :regions => [:pt]}],
10 => [{:mday => 5, :name => "Implantação da República", :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,33 +1,31 @@
# coding: utf-8
# 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/se.yaml
# 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.
module SCANDINAVIA # :nodoc:
DEFINED_REGIONS = [:dk, :is, :se]
# All the definitions are available at https://github.com/alexdunae/holidays
module Scandinavia # :nodoc:
def self.defined_regions
[:dk, :no, :is, :se, :fi]
end
HOLIDAYS_BY_MONTH = {
5 => [{:mday => 1, :name => "Arbejdernes kampdag", :regions => [:dk]},
{:mday => 5, :type => :informal, :name => "Danmarks befrielse", :regions => [:dk]},
{:mday => 1, :name => "Verkalýðsdagurinn", :regions => [:is]},
{:mday => 13, :name => "Mæðradagurinn", :regions => [:is]},
{:mday => 1, :name => "Första maj", :regions => [:se]}],
0 => [{:function => lambda { |year| Holidays.easter(year)-49 }, :function_id => "easter(year)-49", :type => :informal, :name => "Fastelavn", :regions => [:dk]},
{:function => lambda { |year| Holidays.easter(year)-7 }, :function_id => "easter(year)-7", :name => "Palmesøndag", :regions => [:dk]},
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]},
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Langfredag", :regions => [:dk, :no]},
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Påskedag", :regions => [:dk]},
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "2. påskedag", :regions => [:dk]},
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "2. påskedag", :regions => [:dk, :no]},
{:function => lambda { |year| Holidays.easter(year)+26 }, :function_id => "easter(year)+26", :name => "Store Bededag", :regions => [:dk]},
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi Himmelfartsdag", :regions => [:dk]},
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi Himmelfartsdag", :regions => [:dk, :no]},
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pinsedag", :regions => [:dk]},
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "2. Pinsedag", :regions => [:dk]},
{:function => lambda { |year| Holidays.easter(year)-48 }, :function_id => "easter(year)-48", :name => "Bolludagur", :regions => [:is]},
@ -41,44 +39,73 @@ module Holidays
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Uppstigningardagur", :regions => [:is]},
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Hvítasunnudagur", :regions => [:is]},
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Annar í hvítasunnu", :regions => [:is]},
{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Skjærtorsdag", :regions => [:no]},
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "1. påskedag", :regions => [:no]},
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "1. pinsedag", :regions => [:no]},
{:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "2. pinsedag", :regions => [:no]},
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Långfredagen", :regions => [:se]},
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Påskdagen", :regions => [:se]},
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Annandag påsk", :regions => [:se]},
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi himmelsfärdsdag", :regions => [:se]},
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pingstdagen", :regions => [:se]},
{:function => lambda { |year| Holidays.se_alla_helgons_dag(year) }, :function_id => "se_alla_helgons_dag(year)", :name => "Alla helgons dag", :regions => [:se]}],
11 => [{:mday => 10, :type => :informal, :name => "Mortensaften", :regions => [:dk]},
{:mday => 16, :name => "Dagur íslenskrar tungu", :regions => [:is]}],
{:function => lambda { |year| Holidays.se_alla_helgons_dag(year) }, :function_id => "se_alla_helgons_dag(year)", :name => "Alla helgons dag", :regions => [:se]},
{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Pitkäperjantai", :regions => [:fi]},
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pääsiäispäivä", :regions => [:fi]},
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "2. Pääsiäispäivä", :regions => [:fi]},
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Helatorstai", :regions => [:fi]},
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Helluntaipäivä", :regions => [:fi]},
{:function => lambda { |year| Holidays.fi_pyhainpaiva(year) }, :function_id => "fi_pyhainpaiva(year)", :name => "Pyhäinpäivä", :regions => [:fi]}],
1 => [{:mday => 1, :name => "Nytårsdag", :regions => [:dk]},
{:mday => 1, :name => "Nýársdagur", :regions => [:is]},
{:mday => 6, :name => "Þrettándinn", :regions => [:is]},
{:mday => 19, :type => :informal, :name => "Bóndadagur", :regions => [:is]},
{:mday => 1, :name => "Nyttårsdag", :regions => [:no]},
{:mday => 1, :name => "Nyårsdagen", :regions => [:se]},
{:mday => 6, :name => "Trettondedag jul", :regions => [:se]},
{:mday => 1, :name => "Uudenvuodenpäivä", :regions => [:fi]},
{:mday => 6, :name => "Loppiainen", :regions => [:fi]}],
4 => [{:mday => 1, :type => :informal, :name => "1. april", :regions => [:dk]},
{:mday => 9, :type => :informal, :name => "Danmarks besættelse", :regions => [:dk]},
{:mday => 16, :type => :informal, :name => "Dronningens fødselsdag", :regions => [:dk]},
{:function => lambda { |year| Holidays.is_sumardagurinn_fyrsti(year) }, :function_id => "is_sumardagurinn_fyrsti(year)", :name => "Sumardagurinn fyrsti", :regions => [:is]}],
5 => [{:mday => 1, :name => "Arbejdernes kampdag", :regions => [:dk]},
{:mday => 5, :type => :informal, :name => "Danmarks befrielse", :regions => [:dk]},
{:mday => 1, :name => "Verkalýðsdagurinn", :regions => [:is]},
{:mday => 13, :name => "Mæðradagurinn", :regions => [:is]},
{:mday => 1, :name => "1. mai", :regions => [:no]},
{:mday => 17, :name => "17. mai", :regions => [:no]},
{:mday => 1, :name => "Första maj", :regions => [:se]},
{:mday => 1, :name => "Vappu", :regions => [:fi]}],
6 => [{:mday => 5, :name => "Grundlovsdag", :regions => [:dk]},
{:mday => 15, :type => :informal, :name => "Valdemarsdag og Genforeningsdag", :regions => [:dk]},
{:mday => 23, :type => :informal, :name => "Sankt Hans aften", :regions => [:dk]},
{:mday => 3, :type => :informal, :name => "Sjómannadagurinn", :regions => [:is]},
{:mday => 17, :name => "Lýðveldisdagurinn", :regions => [:is]},
{:mday => 6, :name => "Nationaldagen", :regions => [:se]},
{:function => lambda { |year| Holidays.se_midsommardagen(year) }, :function_id => "se_midsommardagen(year)", :name => "Midsommardagen", :regions => [:se]}],
1 => [{:mday => 1, :name => "Nytårsdag", :regions => [:dk]},
{:mday => 1, :name => "Nýársdagur", :regions => [:is]},
{:mday => 6, :name => "Þrettándinn", :regions => [:is]},
{:mday => 19, :type => :informal, :name => "Bóndadagur", :regions => [:is]},
{:mday => 1, :name => "Nyårsdagen", :regions => [:se]},
{:mday => 6, :name => "Trettondedag jul", :regions => [:se]}],
{:function => lambda { |year| Holidays.se_midsommardagen(year) }, :function_id => "se_midsommardagen(year)", :name => "Midsommardagen", :regions => [:se]},
{:function => lambda { |year| Holidays.fi_juhannuspaiva(year) }, :function_id => "fi_juhannuspaiva(year)", :name => "Juhannuspäivä", :regions => [:fi]}],
11 => [{:mday => 10, :type => :informal, :name => "Mortensaften", :regions => [:dk]},
{:mday => 16, :name => "Dagur íslenskrar tungu", :regions => [:is]}],
12 => [{:mday => 13, :type => :informal, :name => "Sankt Lucia", :regions => [:dk]},
{:mday => 24, :name => "Juleaftensdag", :regions => [:dk]},
{:mday => 25, :name => "1. juledag", :regions => [:dk]},
{:mday => 26, :name => "2. juledag", :regions => [:dk]},
{:mday => 25, :name => "1. juledag", :regions => [:dk, :no]},
{:mday => 26, :name => "2. juledag", :regions => [:dk, :no]},
{:mday => 24, :name => "Jól", :regions => [:is]},
{:mday => 25, :name => "Jól", :regions => [:is]},
{:mday => 26, :name => "Jól", :regions => [:is]},
{:mday => 31, :name => "Gamlárskvöld", :regions => [:is]},
{:mday => 24, :type => :informal, :name => "Julaften", :regions => [:no]},
{:mday => 31, :type => :informal, :name => "Nyttårsaften", :regions => [:no]},
{:mday => 25, :name => "Juldagen", :regions => [:se]},
{:mday => 26, :name => "Annandag jul", :regions => [:se]}],
{:mday => 26, :name => "Annandag jul", :regions => [:se]},
{:mday => 6, :name => "Itsenäisyyspäivä", :regions => [:fi]},
{:mday => 24, :name => "Jouluaatto", :regions => [:fi]},
{:mday => 25, :name => "Joulupäivä", :regions => [:fi]},
{:mday => 26, :name => "Tapaninpäivä", :regions => [:fi]}],
2 => [{:mday => 18, :type => :informal, :name => "Konudagur", :regions => [:is]}],
8 => [{:wday => 1, :week => 1, :name => "Frídagur verslunarmanna", :regions => [:is]}],
4 => [{:mday => 1, :type => :informal, :name => "1. april", :regions => [:dk]},
{:mday => 9, :type => :informal, :name => "Danmarks besættelse", :regions => [:dk]},
{:mday => 16, :type => :informal, :name => "Dronningens fødselsdag", :regions => [:dk]},
{:function => lambda { |year| Holidays.is_sumardagurinn_fyrsti(year) }, :function_id => "is_sumardagurinn_fyrsti(year)", :name => "Sumardagurinn fyrsti", :regions => [:is]}]
}
8 => [{:wday => 1, :week => 1, :name => "Frídagur verslunarmanna", :regions => [:is]}]
}
end
end
# Iceland: first day of summer (Thursday after 18 April)
@ -93,14 +120,6 @@ def self.is_sumardagurinn_fyrsti(year)
end
# Sweden: All Saint's Day (Saturday between Oct 31 and Nov 6)
def self.se_alla_helgons_dag(year)
date = Date.civil(year,10,31)
date += (6 - date.wday)
date
end
# Sweden: Mid-summer (Saturday between June 2026)
def self.se_midsommardagen(year)
date = Date.civil(year,6,20)
@ -109,7 +128,31 @@ def self.se_midsommardagen(year)
end
# Sweden: All Saint's Day (Saturday between Oct 31 and Nov 6)
def self.se_alla_helgons_dag(year)
date = Date.civil(year,10,31)
date += (6 - date.wday)
date
end
# Finland: Mid-summer (Saturday between June 2026)
def self.fi_juhannuspaiva(year)
date = Date.civil(year,6,20)
date += (6 - date.wday)
date
end
# Finland: All Saint's Day (Saturday between Oct 31 and Nov 6)
def self.fi_pyhainpaiva(year)
date = Date.civil(year,10,31)
date += (6 - date.wday)
date
end
end
Holidays.merge_defs(Holidays::SCANDINAVIA::DEFINED_REGIONS, Holidays::SCANDINAVIA::HOLIDAYS_BY_MONTH)
Holidays.merge_defs(Holidays::Scandinavia.defined_regions, Holidays::Scandinavia.holidays_by_month)

View File

@ -1,44 +1,40 @@
# coding: utf-8
# 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 = {
5 => [{:mday => 1, :name => "Första maj", :regions => [:se]}],
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Långfredagen", :regions => [:se]},
def self.holidays_by_month
{
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Långfredagen", :regions => [:se]},
{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Påskdagen", :regions => [:se]},
{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Annandag påsk", :regions => [:se]},
{:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Kristi himmelsfärdsdag", :regions => [:se]},
{:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pingstdagen", :regions => [:se]},
{:function => lambda { |year| Holidays.se_alla_helgons_dag(year) }, :function_id => "se_alla_helgons_dag(year)", :name => "Alla helgons dag", :regions => [:se]}],
6 => [{:mday => 6, :name => "Nationaldagen", :regions => [:se]},
{:function => lambda { |year| Holidays.se_midsommardagen(year) }, :function_id => "se_midsommardagen(year)", :name => "Midsommardagen", :regions => [:se]}],
1 => [{:mday => 1, :name => "Nyårsdagen", :regions => [:se]},
{:mday => 6, :name => "Trettondedag jul", :regions => [:se]}],
5 => [{:mday => 1, :name => "Första maj", :regions => [:se]}],
6 => [{:mday => 6, :name => "Nationaldagen", :regions => [:se]},
{:function => lambda { |year| Holidays.se_midsommardagen(year) }, :function_id => "se_midsommardagen(year)", :name => "Midsommardagen", :regions => [:se]}],
12 => [{:mday => 25, :name => "Juldagen", :regions => [:se]},
{:mday => 26, :name => "Annandag jul", :regions => [:se]}]
}
}
end
end
# Sweden: All Saint's Day (Saturday between Oct 31 and Nov 6)
def self.se_alla_helgons_dag(year)
date = Date.civil(year,10,31)
date += (6 - date.wday)
date
end
# Sweden: Mid-summer (Saturday between June 2026)
def self.se_midsommardagen(year)
date = Date.civil(year,6,20)
@ -47,7 +43,15 @@ def self.se_midsommardagen(year)
end
# Sweden: All Saint's Day (Saturday between Oct 31 and Nov 6)
def self.se_alla_helgons_dag(year)
date = Date.civil(year,10,31)
date += (6 - date.wday)
date
end
end
Holidays.merge_defs(Holidays::SE::DEFINED_REGIONS, Holidays::SE::HOLIDAYS_BY_MONTH)
Holidays.merge_defs(Holidays::SE.defined_regions, Holidays::SE.holidays_by_month)

View File

@ -1,25 +1,85 @@
# coding: utf-8
# 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,32 +1,36 @@
# coding: utf-8
# 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 = {
def self.holidays_by_month
{
1 => [{:mday => 1, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "New Year's Day", :regions => [:ups]}],
5 => [{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:ups]}],
7 => [{:mday => 4, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Independence Day", :regions => [:ups]}],
9 => [{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:ups]}],
11 => [{:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:ups]},
{:wday => 5, :week => 4, :name => "Day After Thanksgiving", :regions => [:ups]}],
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]}],
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]}],
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]}]
}
{: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,40 +1,44 @@
# coding: utf-8
# 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 = {
5 => [{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:us]},
{:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :type => :informal, :name => "Good Friday", :regions => [:us]}],
11 => [{:mday => 11, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Veterans Day", :regions => [:us]},
{:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:us]}],
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]}],
12 => [{:mday => 25, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Christmas Day", :regions => [:us]}],
7 => [{:mday => 4, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Independence Day", :regions => [:us]}],
2 => [{:wday => 1, :week => 3, :name => "Presidents' Day", :regions => [:us]},
{:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
{:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
3 => [{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
5 => [{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:us]},
{:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}],
7 => [{:mday => 4, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Independence Day", :regions => [:us]}],
9 => [{:wday => 1, :week => 1, :name => "Labor Day", :regions => [:us]}],
4 => [{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
{:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}],
10 => [{:wday => 1, :week => 2, :name => "Columbus Day", :regions => [:us]},
{:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}]
}
{:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}],
11 => [{:mday => 11, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Veterans Day", :regions => [:us]},
{:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:us]}],
12 => [{:mday => 25, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Christmas Day", :regions => [:us]}],
3 => [{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
4 => [{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
{:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}]
}
end
end
# January 20, every fourth year, following Presidential election
@ -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,36 +1,40 @@
# coding: utf-8
# 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 = {
5 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Workers Day", :regions => [:za]}],
0 => [{:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:za]},
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]}],
6 => [{:mday => 16, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Youth Day", :regions => [:za]}],
1 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "New Year's Day", :regions => [:za]}],
3 => [{:mday => 21, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Human Rights Day", :regions => [:za]}],
4 => [{:mday => 27, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Freedom Day", :regions => [:za]}],
5 => [{:mday => 1, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Workers Day", :regions => [:za]}],
6 => [{:mday => 16, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Youth Day", :regions => [:za]}],
8 => [{:mday => 9, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "National Women's Day", :regions => [:za]}],
9 => [{:mday => 24, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Heritage Day", :regions => [:za]}],
12 => [{:mday => 16, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Day of Reconciliation", :regions => [:za]},
{:mday => 25, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Christmas Day", :regions => [:za]},
{:mday => 26, :observed => lambda { |date| Holidays.to_weekday_if_boxing_weekend(date) }, :observed_id => "to_weekday_if_boxing_weekend", :name => "Day of Goodwill", :regions => [:za]}],
8 => [{:mday => 9, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "National Women's Day", :regions => [:za]}],
3 => [{:mday => 21, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Human Rights Day", :regions => [:za]}],
9 => [{:mday => 24, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Heritage Day", :regions => [:za]}],
4 => [{:mday => 27, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Freedom Day", :regions => [:za]}]
}
{: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,11 +1,13 @@
$:.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 'lib/holidays'
require 'data/build_defs'
require 'holidays'
require File.expand_path('data/build_defs')
task :default => :test
desc 'Run all tests'
task :test => ["test:lib", "test:defs"]
@ -29,13 +31,13 @@ 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'
rdoc.options << '--charset' << 'utf-8'
rdoc.rdoc_files.include('README.rdoc')
rdoc.rdoc_files.include('data/SYNTAX')
rdoc.rdoc_files.include('data/SYNTAX.rdoc')
rdoc.rdoc_files.include('lib/holidays/MANIFEST')
rdoc.rdoc_files.include('REFERENCES')
rdoc.rdoc_files.include('CHANGELOG')
@ -91,12 +93,14 @@ end
begin
require 'jeweler'
Jeweler::Tasks.new do |gemspec|
gemspec.name = "wombleton-holidays"
gemspec.name = "holidays"
gemspec.summary = "A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!"
gemspec.description = "A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!"
gemspec.email = "wombleton@gmail.com"
gemspec.homepage = "http://github.com/wombleton/holidays"
gemspec.authors = ["Alex Dunae", "Rowan Crawford"]
gemspec.email = "code@dunae.ca"
gemspec.homepage = "https://github.com/alexdunae/holidays"
gemspec.version = Holidays::VERSION
gemspec.authors = ["Alex Dunae"]
gemspec.add_development_dependency 'rdoc', '>= 2.4.2'
end
rescue LoadError
puts "Jeweler not available. Install it with: gem install jeweler"

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

View File

@ -1,4 +1,5 @@
require File.dirname(__FILE__) + '/../test_helper'
# encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#

31
test/defs/test_defs_br.rb Normal file
View File

@ -0,0 +1,31 @@
# encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#
# Definitions loaded: data/br.yaml
class BrDefinitionTests < Test::Unit::TestCase # :nodoc:
def test_br
{Date.civil(2008,1,1) => 'Dia da Confraternização Universal',
Date.civil(2005,2,8) => 'Carnaval',
Date.civil(2006,2,28) => 'Carnaval',
Date.civil(2007,2,20) => 'Carnaval',
Date.civil(2008,2,5) => 'Carnaval',
Date.civil(2008,3,21) => 'Sexta-feira Santa',
Date.civil(2008,3,23) => 'Páscoa',
Date.civil(2008,4,21) => 'Dia de Tiradentes',
Date.civil(2008,5,1) => 'Dia do Trabalho',
Date.civil(2005,5,26) => 'Corpus Christ',
Date.civil(2007,6,7) => 'Corpus Christ',
Date.civil(2008,5,22) => 'Corpus Christ',
Date.civil(2008,9,7) => 'Proclamação da Independência',
Date.civil(2008,10,12) => 'Dia de Nossa Senhora Aparecida',
Date.civil(2008,11,2) => 'Dia de Finados',
Date.civil(2008,11,15) => 'Proclamação da República',
Date.civil(2008,12,25) => 'Natal'}.each do |date, name|
assert_equal name, (Holidays.on(date, :br, :informal)[0] || {})[:name]
end
end
end

View File

@ -1,4 +1,5 @@
require File.dirname(__FILE__) + '/../test_helper'
# encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#
@ -13,7 +14,7 @@ class CaDefinitionTests < Test::Unit::TestCase # :nodoc:
Date.civil(2008,7,1) => 'Canada Day',
Date.civil(2008,9,1) => 'Labour Day',
Date.civil(2008,10,13) => 'Thanksgiving',
Date.civil(2008,11,11) => 'Rememberance Day',
Date.civil(2008,11,11) => 'Remembrance Day',
Date.civil(2008,12,25) => 'Christmas Day',
Date.civil(2008,12,26) => 'Boxing Day'}.each do |date, name|
assert_equal name, (Holidays.on(date, :ca, :informal)[0] || {})[:name]

View File

@ -1,4 +1,5 @@
require File.dirname(__FILE__) + '/../test_helper'
# encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#

View File

@ -1,4 +1,5 @@
require File.dirname(__FILE__) + '/../test_helper'
# encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#
@ -38,6 +39,8 @@ end
assert_equal 'Allerheiligen', Date.civil(2009,11,1).holidays(r)[0][:name]
end
assert !Date.civil(2010,5,8).holiday?(:de), '2010-05-08 is not a holiday in Germany'
# Repentance Day
assert_equal 'Buß- und Bettag', Date.civil(2004,11,17).holidays(:de_sn)[0][:name]
assert_equal 'Buß- und Bettag', Date.civil(2005,11,16).holidays(:de_sn)[0][:name]

View File

@ -1,4 +1,5 @@
require File.dirname(__FILE__) + '/../test_helper'
# encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#

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

@ -1,4 +1,5 @@
require File.dirname(__FILE__) + '/../test_helper'
# encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#

View File

@ -1,11 +1,26 @@
require File.dirname(__FILE__) + '/../test_helper'
# encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#
# Definitions loaded: data/cz.yaml, 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',
@ -74,6 +89,8 @@ end
assert_equal 'Allerheiligen', Date.civil(2009,11,1).holidays(r)[0][:name]
end
assert !Date.civil(2010,5,8).holiday?(:de), '2010-05-08 is not a holiday in Germany'
# Repentance Day
assert_equal 'Buß- und Bettag', Date.civil(2004,11,17).holidays(:de_sn)[0][:name]
assert_equal 'Buß- und Bettag', Date.civil(2005,11,16).holidays(:de_sn)[0][:name]
@ -81,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',
@ -219,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',
@ -252,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',

33
test/defs/test_defs_fi.rb Normal file
View File

@ -0,0 +1,33 @@
# encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#
# Definitions loaded: data/fi.yaml
class FiDefinitionTests < Test::Unit::TestCase # :nodoc:
def test_fi
{Date.civil(2008,1,1) => 'Uudenvuodenpäivä',
Date.civil(2008,1,6) => 'Loppiainen',
Date.civil(2008,3,21) => 'Pitkäperjantai',
Date.civil(2008,3,23) => 'Pääsiäispäivä',
Date.civil(2008,3,24) => '2. Pääsiäispäivä',
Date.civil(2008,5,1) => 'Vappu',
Date.civil(2008,5,1) => 'Helatorstai',
Date.civil(2008,5,11) => 'Helluntaipäivä',
Date.civil(2005,6,25) => 'Juhannuspäivä',
Date.civil(2006,6,24) => 'Juhannuspäivä',
Date.civil(2007,6,23) => 'Juhannuspäivä',
Date.civil(2008,6,21) => 'Juhannuspäivä',
Date.civil(2005,11,5) => 'Pyhäinpäivä',
Date.civil(2006,11,4) => 'Pyhäinpäivä',
Date.civil(2007,11,3) => 'Pyhäinpäivä',
Date.civil(2008,11,1) => 'Pyhäinpäivä',
Date.civil(2008,12,6) => 'Itsenäisyyspäivä',
Date.civil(2008,12,24) => 'Jouluaatto',
Date.civil(2008,12,25) => 'Joulupäivä',
Date.civil(2008,12,26) => 'Tapaninpäivä'}.each do |date, name|
assert_equal name, (Holidays.on(date, :fi, :informal)[0] || {})[:name]
end
end
end

View File

@ -1,4 +1,5 @@
require File.dirname(__FILE__) + '/../test_helper'
# encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#

View File

@ -1,4 +1,5 @@
require File.dirname(__FILE__) + '/../test_helper'
# encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#

View File

@ -1,4 +1,5 @@
require File.dirname(__FILE__) + '/../test_helper'
# encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#

View File

@ -1,4 +1,5 @@
require File.dirname(__FILE__) + '/../test_helper'
# encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#

View File

@ -1,4 +1,5 @@
require File.dirname(__FILE__) + '/../test_helper'
# encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#

50
test/defs/test_defs_jp.rb Normal file
View File

@ -0,0 +1,50 @@
# encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#
# Definitions loaded: data/jp.yaml
class JpDefinitionTests < Test::Unit::TestCase # :nodoc:
def test_jp
{Date.civil(2008,1,1) => '元日',
Date.civil(2010,1,11) => '成人の日',
Date.civil(2008,2,11) => '建国記念日',
Date.civil(2008,4,29) => '昭和の日',
Date.civil(2008,5,3) => '憲法記念日',
Date.civil(2008,5,5) => 'こどもの日',
Date.civil(2010,7,19) => '海の日',
Date.civil(2010,9,20) => '敬老の日',
Date.civil(2010,10,11) => '体育の日',
Date.civil(2008,11,3) => '文化の日',
Date.civil(2008,11,23) => '勤労感謝の日',
Date.civil(2008,12,23) => '天皇誕生日',
Date.civil(2010,3,22) => '振替休日',
Date.civil(2008,11,24) => '振替休日',
}.each do |date, name|
assert_equal name, (Holidays.on(date, :jp, :informal)[0] || {})[:name]
end
# vernal equinox day
[Date.civil(2004,3,20), Date.civil(2005,3,20), Date.civil(2006,3,21),
Date.civil(2007,3,21), Date.civil(2008,3,20), Date.civil(2009,3,20),
Date.civil(2010,3,21)].each do |date|
assert_equal '春分の日', Holidays.on(date, :jp)[0][:name]
end
# national culture day
[Date.civil(2004,9,23), Date.civil(2005,9,23), Date.civil(2006,9,23),
Date.civil(2007,9,23), Date.civil(2008,9,23), Date.civil(2009,9,23),
Date.civil(2010,9,23), Date.civil(2011,9,23), Date.civil(2012,9,22),
Date.civil(2013,9,23)].each do |date|
assert_equal '秋分の日', Holidays.on(date, :jp)[0][:name]
end
# citizens holiday
[Date.civil(2032,9,21), Date.civil(2049,9,21), Date.civil(2009,9,22),
Date.civil(2015,9,22), Date.civil(2026,9,22)].each do |date|
assert_equal '国民の休日', Holidays.on(date, :jp)[0][:name]
end
end
end

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

View File

@ -1,4 +1,5 @@
require File.dirname(__FILE__) + '/../test_helper'
# encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#

View File

@ -1,4 +1,5 @@
require File.dirname(__FILE__) + '/../test_helper'
# encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#

View File

@ -1,4 +1,5 @@
require File.dirname(__FILE__) + '/../test_helper'
# encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#

View File

@ -1,4 +1,5 @@
require File.dirname(__FILE__) + '/../test_helper'
# encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#
@ -13,7 +14,7 @@ class North_americaDefinitionTests < Test::Unit::TestCase # :nodoc:
Date.civil(2008,7,1) => 'Canada Day',
Date.civil(2008,9,1) => 'Labour Day',
Date.civil(2008,10,13) => 'Thanksgiving',
Date.civil(2008,11,11) => 'Rememberance Day',
Date.civil(2008,11,11) => 'Remembrance Day',
Date.civil(2008,12,25) => 'Christmas Day',
Date.civil(2008,12,26) => 'Boxing Day'}.each do |date, name|
assert_equal name, (Holidays.on(date, :ca, :informal)[0] || {})[:name]

View File

@ -1,4 +1,5 @@
require File.dirname(__FILE__) + '/../test_helper'
# encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#

View File

@ -1,4 +1,5 @@
require File.dirname(__FILE__) + '/../test_helper'
# encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#

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

View File

@ -1,4 +1,5 @@
require File.dirname(__FILE__) + '/../test_helper'
# encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#

View File

@ -1,9 +1,9 @@
require File.dirname(__FILE__) + '/../test_helper'
require 'holidays/scandinavia'
# encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#
# Definitions loaded: data/dk.yaml, data/is.yaml, data/se.yaml
# Definitions loaded: data/dk.yaml, data/is.yaml, data/no.yaml, data/se.yaml, data/fi.yaml
class ScandinaviaDefinitionTests < Test::Unit::TestCase # :nodoc:
def test_scandinavia
@ -50,6 +50,25 @@ end
assert_equal name, (Holidays.on(date, :is, :informal)[0] || {})[:name]
end
{Date.civil(2010,1,1) => 'Nyttårsdag',
Date.civil(2010,5,1) => '1. mai',
Date.civil(2010,5,17) => '17. mai',
Date.civil(2010,12,24) => 'Julaften',
Date.civil(2010,12,25) => '1. juledag',
Date.civil(2010,12,26) => '2. juledag',
Date.civil(2010,12,31) => 'Nyttårsaften',
Date.civil(2010,2,14) => 'Fastelavn',
Date.civil(2010,3,28) => 'Palmesøndag',
Date.civil(2010,4,1) => 'Skjærtorsdag',
Date.civil(2010,4,2) => 'Langfredag',
Date.civil(2010,4,4) => '1. påskedag',
Date.civil(2010,4,5) => '2. påskedag',
Date.civil(2010,5,13) => 'Kristi Himmelfartsdag',
Date.civil(2010,5,23) => '1. pinsedag',
Date.civil(2010,5,24) => '2. pinsedag'}.each do |date, name|
assert_equal name, (Holidays.on(date, :no, :informal)[0] || {})[:name]
end
{Date.civil(2008,1,1) => 'Nyårsdagen',
Date.civil(2008,1,6) => 'Trettondedag jul',
Date.civil(2008,3,21) => 'Långfredagen',
@ -71,5 +90,28 @@ end
Date.civil(2008,12,26) => 'Annandag jul'}.each do |date, name|
assert_equal name, (Holidays.on(date, :se, :informal)[0] || {})[:name]
end
{Date.civil(2008,1,1) => 'Uudenvuodenpäivä',
Date.civil(2008,1,6) => 'Loppiainen',
Date.civil(2008,3,21) => 'Pitkäperjantai',
Date.civil(2008,3,23) => 'Pääsiäispäivä',
Date.civil(2008,3,24) => '2. Pääsiäispäivä',
Date.civil(2008,5,1) => 'Vappu',
Date.civil(2008,5,1) => 'Helatorstai',
Date.civil(2008,5,11) => 'Helluntaipäivä',
Date.civil(2005,6,25) => 'Juhannuspäivä',
Date.civil(2006,6,24) => 'Juhannuspäivä',
Date.civil(2007,6,23) => 'Juhannuspäivä',
Date.civil(2008,6,21) => 'Juhannuspäivä',
Date.civil(2005,11,5) => 'Pyhäinpäivä',
Date.civil(2006,11,4) => 'Pyhäinpäivä',
Date.civil(2007,11,3) => 'Pyhäinpäivä',
Date.civil(2008,11,1) => 'Pyhäinpäivä',
Date.civil(2008,12,6) => 'Itsenäisyyspäivä',
Date.civil(2008,12,24) => 'Jouluaatto',
Date.civil(2008,12,25) => 'Joulupäivä',
Date.civil(2008,12,26) => 'Tapaninpäivä'}.each do |date, name|
assert_equal name, (Holidays.on(date, :fi, :informal)[0] || {})[:name]
end
end
end

View File

@ -1,5 +1,5 @@
require File.dirname(__FILE__) + '/../test_helper'
require 'holidays/se'
# encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#

View File

@ -1,4 +1,5 @@
require File.dirname(__FILE__) + '/../test_helper'
# encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#

View File

@ -1,4 +1,5 @@
require File.dirname(__FILE__) + '/../test_helper'
# encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#

View File

@ -1,4 +1,5 @@
require File.dirname(__FILE__) + '/../test_helper'
# encoding: utf-8
require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#

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

@ -1,4 +1,4 @@
require File.dirname(__FILE__) + '/test_helper'
require File.expand_path(File.dirname(__FILE__)) + '/test_helper'
class DateTests < Test::Unit::TestCase
def setup
@ -6,8 +6,14 @@ class DateTests < Test::Unit::TestCase
end
def test_extending_date_class
assert @date.respond_to?('holidays')
assert @date.respond_to?('holiday?')
assert @date.respond_to?('holiday?')
end
def test_extending_datetime_class
dt = DateTime.civil(2008,1,1)
assert dt.respond_to?('holidays')
assert dt.respond_to?('holiday?')
end
def test_calculating_mdays
@ -95,7 +101,23 @@ class DateTests < Test::Unit::TestCase
end
end
def test_holiday?
def test_date_holiday?
assert Date.civil(2008,1,1).holiday?('ca')
assert Date.today.holiday?('test')
end
def test_datetime_holiday?
# in situations with activesupport
assert DateTime.now.to_date.holiday?('test') if DateTime.now.respond_to?(:to_date)
assert DateTime.now.holiday?('test')
end
# ensure that dates are compared in the same timezone
def test_datetime_offset_holiday?
dt = DateTime.now.new_offset(Rational(23,24))
assert dt.holiday?('test'), dt.inspect
dt = DateTime.now.new_offset(Rational(-23,24))
assert dt.holiday?('test'), dt.inspect
end
end

View File

@ -1,11 +1,22 @@
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__), '../'))
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__), '../lib/'))
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__), '../../lib/'))
$:.unshift(File.expand_path(File.dirname(__FILE__) + '../../lib/'))
$KCODE = 'u'
$KCODE = 'u' if RUBY_VERSION =~ /^1\.8/
require 'rubygems'
require 'test/unit'
require 'date'
require 'holidays'
require 'holidays/ca'
module Holidays
# Test region used for generating a holiday on Date.today
module Test # :nodoc:
DEFINED_REGIONS = [:test]
HOLIDAYS_BY_MONTH = {
Date.today.mon => [{:mday => Date.today.mday, :name => "Test Holiday", :regions => [:test]}]
}
end
end
Holidays.merge_defs(Holidays::Test::DEFINED_REGIONS, Holidays::Test::HOLIDAYS_BY_MONTH)

View File

@ -1,4 +1,4 @@
require File.dirname(__FILE__) + '/test_helper'
require File.expand_path(File.dirname(__FILE__)) + '/test_helper'
require 'holidays/ca'
@ -84,7 +84,7 @@ class HolidaysTests < Test::Unit::TestCase
# Should return Victoria Da and National Patriotes Day.
holidays = Holidays.between(Date.civil(2008,5,1), Date.civil(2008,5,31), :ca_qc)
assert 2, holidays.length
assert_equal 2, holidays.length
# Should return Victoria Day and National Patriotes Day.
holidays = Holidays.between(Date.civil(2008,5,1), Date.civil(2008,5,31), :ca_)
@ -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),

View File

@ -1,4 +1,6 @@
require File.dirname(__FILE__) + '/test_helper'
require File.expand_path(File.dirname(__FILE__)) + '/test_helper'
require 'holidays/gb'
require 'holidays/ie'
class MultipleRegionsTests < Test::Unit::TestCase
def setup

View File

@ -1,157 +0,0 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in rakefile.rb, and run the gemspec command
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{wombleton-holidays}
s.version = "0.9.9"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Alex Dunae", "Rowan Crawford"]
s.date = %q{2010-05-01}
s.description = %q{A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!}
s.email = %q{wombleton@gmail.com}
s.extra_rdoc_files = [
"LICENSE",
"README.rdoc"
]
s.files = [
".gitignore",
"CHANGELOG",
"LICENSE",
"README.rdoc",
"REFERENCES",
"VERSION",
"data/SYNTAX",
"data/au.yaml",
"data/build_defs.rb",
"data/ca.yaml",
"data/cz.yaml",
"data/de.yaml",
"data/dk.yaml",
"data/es.yaml",
"data/fr.yaml",
"data/gb.yaml",
"data/ie.yaml",
"data/index.yaml",
"data/is.yaml",
"data/it.yaml",
"data/mx.yaml",
"data/nl.yaml",
"data/no.yaml",
"data/north_america_informal.yaml",
"data/nyse.yaml",
"data/nz.yaml",
"data/pt.yaml",
"data/se.yaml",
"data/united_nations.yaml",
"data/ups.yaml",
"data/us.yaml",
"data/za.yaml",
"holidays.gemspec",
"lib/holidays.rb",
"lib/holidays/MANIFEST",
"lib/holidays/au.rb",
"lib/holidays/ca.rb",
"lib/holidays/cz.rb",
"lib/holidays/de.rb",
"lib/holidays/dk.rb",
"lib/holidays/es.rb",
"lib/holidays/europe.rb",
"lib/holidays/fr.rb",
"lib/holidays/gb.rb",
"lib/holidays/ie.rb",
"lib/holidays/is.rb",
"lib/holidays/it.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/pt.rb",
"lib/holidays/scandinavia.rb",
"lib/holidays/se.rb",
"lib/holidays/united_nations.rb",
"lib/holidays/ups.rb",
"lib/holidays/us.rb",
"lib/holidays/za.rb",
"rakefile.rb",
"test/defs/test_defs_au.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_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_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",
"wombleton-holidays.gemspec"
]
s.homepage = %q{http://github.com/wombleton/holidays}
s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.6}
s.summary = %q{A collection of Ruby methods to deal with statutory and other holidays. You deserve a holiday!}
s.test_files = [
"test/test_helper.rb",
"test/test_date.rb",
"test/test_multiple_regions.rb",
"test/defs/test_defs_au.rb",
"test/defs/test_defs_no.rb",
"test/defs/test_defs_ups.rb",
"test/defs/test_defs_nyse.rb",
"test/defs/test_defs_scandinavia.rb",
"test/defs/test_defs_dk.rb",
"test/defs/test_defs_se.rb",
"test/defs/test_defs_north_america.rb",
"test/defs/test_defs_europe.rb",
"test/defs/test_defs_nl.rb",
"test/defs/test_defs_fr.rb",
"test/defs/test_defs_us.rb",
"test/defs/test_defs_it.rb",
"test/defs/test_defs_ca.rb",
"test/defs/test_defs_mx.rb",
"test/defs/test_defs_es.rb",
"test/defs/test_defs_de.rb",
"test/defs/test_defs_cz.rb",
"test/defs/test_defs_pt.rb",
"test/defs/test_defs_is.rb",
"test/defs/test_defs_nz.rb",
"test/defs/test_defs_za.rb",
"test/defs/test_defs_gb.rb",
"test/defs/test_defs_ie.rb",
"test/test_holidays.rb"
]
if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 3
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
else
end
else
end
end