Polish holidays

master
asaletnik 2011-09-12 23:42:44 +02:00
parent 05b8241dea
commit 48639c7fc0
7 changed files with 832 additions and 112 deletions

View File

@ -21,6 +21,7 @@ defs:
"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']
@ -29,5 +30,5 @@ defs:
ZA: ['za.yaml']
North_America: ['ca.yaml', 'mx.yaml', 'us.yaml', 'north_america_informal.yaml']
Scandinavia: ['dk.yaml', 'is.yaml', 'no.yaml', 'se.yaml', 'fi.yaml']
Europe: ['at.yaml', 'cz.yaml', 'dk.yaml', 'de.yaml', 'el.yaml', 'es.yaml', 'fr.yaml', 'gb.yaml', 'ie.yaml', 'is.yaml', 'it.yaml', 'nl.yaml', 'no.yaml', 'pt.yaml']
Europe: ['at.yaml', 'cz.yaml', 'dk.yaml', 'de.yaml', 'el.yaml', 'es.yaml', 'fr.yaml', 'gb.yaml', 'ie.yaml', 'is.yaml', 'it.yaml', 'nl.yaml', 'no.yaml', 'pl.yaml', 'pt.yaml']
JP: ['jp.yaml']

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: |
# January 6 is holiday since 2011
def self.pl_trzech_kroli(year)
year >= 2011 ? 6 : nil
end
pl_trzech_kroli_informal: |
# 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,33 +1,34 @@
==== Regional definitions
The following definition files are included in this installation:
* holidays/at
* holidays/au
* holidays/br
* holidays/ca
* holidays/cz
* holidays/de
* holidays/dk
* holidays/el
* holidays/es
* holidays/europe
* holidays/fi
* holidays/fr
* holidays/gb
* holidays/ie
* holidays/is
* holidays/it
* holidays/jp
* holidays/mx
* holidays/nl
* holidays/no
* holidays/north_america
* holidays/nyse
* holidays/at
* holidays/nz
* holidays/pt
* holidays/nl
* holidays/dk
* holidays/cz
* holidays/scandinavia
* holidays/se
* holidays/no
* holidays/pt
* holidays/nyse
* holidays/it
* holidays/united_nations
* holidays/ups
* holidays/au
* holidays/us
* holidays/ie
* holidays/za
* holidays/is
* holidays/north_america
* holidays/es
* holidays/fi
* holidays/el
* holidays/europe
* holidays/de
* holidays/gb
* holidays/ups
* holidays/jp
* holidays/fr
* holidays/se
* holidays/ca
* holidays/br
* holidays/pl

View File

@ -2,7 +2,7 @@
module Holidays
# This file is generated by the Ruby Holiday gem.
#
# Definitions loaded: data/at.yaml, data/cz.yaml, data/dk.yaml, data/de.yaml, data/el.yaml, data/es.yaml, data/fr.yaml, data/gb.yaml, data/ie.yaml, data/is.yaml, data/it.yaml, data/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/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
# Holiday gem:
@ -12,33 +12,9 @@ module Holidays
#
# More definitions are available at http://code.dunae.ca/holidays.
module Europe # :nodoc:
DEFINED_REGIONS = [:at, :de_bw, :de_by, :de_nw, :de_rp, :de_sl, :de, :de_he, :cz, :dk, :no, :de_sn, :de_st, :de_bb, :de_mv, :de_th, :el, :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]
DEFINED_REGIONS = [:at, :de, :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]
HOLIDAYS_BY_MONTH = {
5 => [{:mday => 1, :name => "Staatsfeiertag", :regions => [:at]},
{:mday => 1, :name => "Svátek práce", :regions => [:cz]},
{:mday => 8, :name => "Den vítězství", :regions => [:cz]},
{:mday => 1, :name => "Arbejdernes kampdag", :regions => [:dk]},
{:mday => 5, :type => :informal, :name => "Danmarks befrielse", :regions => [:dk]},
{:mday => 1, :name => "Tag der Arbeit", :regions => [:de]},
{:mday => 1, :name => "Πρωτομαγιά", :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 => "Dia do Trabalhador", :regions => [:pt]}],
0 => [{:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Ostermontag", :regions => [:at, :de]},
{: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]},
@ -95,31 +71,21 @@ 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 => 1, :name => "Allerheiligen", :regions => [:at, :de_bw, :de_by, :de_nw, :de_rp, :de_sl]},
{: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 => "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 => "Neujahrstag", :regions => [:at, :de]},
{:mday => 6, :name => "Heilige Drei Könige", :regions => [:at]},
{:mday => 1, :name => "Den obnovy samostatného českého státu", :regions => [:cz]},
@ -139,7 +105,76 @@ module Holidays
{:mday => 6, :name => "Epifania", :regions => [:it]},
{:mday => 1, :name => "Nieuwjaar", :regions => [:nl]},
{:mday => 1, :name => "Nyttårsdag", :regions => [:no]},
{:mday => 1, :name => "Nowy Rok", :regions => [:pl]},
{:function => lambda { |year| Holidays.pl_trzech_kroli(year) }, :function_id => "pl_trzech_kroli(year)", :name => "Objawienie Pańskie (święto Trzech Króli)", :regions => [:pl]},
{:function => lambda { |year| Holidays.pl_trzech_kroli_informal(year) }, :function_id => "pl_trzech_kroli_informal(year)", :type => :informal, :name => "Objawienie Pańskie (święto Trzech Króli)", :regions => [:pl]},
{:mday => 21, :type => :informal, :name => "Dzień Babci", :regions => [:pl]},
{:mday => 22, :type => :informal, :name => "Dzień Dziadka", :regions => [:pl]},
{:mday => 1, :name => "Ano Novo", :regions => [:pt]}],
5 => [{:mday => 1, :name => "Staatsfeiertag", :regions => [:at]},
{:mday => 1, :name => "Svátek práce", :regions => [:cz]},
{:mday => 8, :name => "Den vítězství", :regions => [:cz]},
{:mday => 1, :name => "Arbejdernes kampdag", :regions => [:dk]},
{:mday => 5, :type => :informal, :name => "Danmarks befrielse", :regions => [:dk]},
{:mday => 1, :name => "Tag der Arbeit", :regions => [:de]},
{:mday => 1, :name => "Πρωτομαγιά", :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 => "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]},
{: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]},
@ -173,6 +208,12 @@ module Holidays
{: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]}],
@ -182,28 +223,12 @@ 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 => [: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 => "Assunção de Nossa Senhora", :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]}],
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 => 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]},
@ -212,31 +237,34 @@ 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 => 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 => 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 => 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, :type => :informal, :name => "Ofiarowanie Pańskie (Matki Boskiej Gromnicznej)", :regions => [:pl]},
{:mday => 14, :type => :informal, :name => "Dzień Zakochanych (Walentynki)", :regions => [:pl]}]
}
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)
@ -249,6 +277,30 @@ 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
# January 6 is holiday since 2011
def self.pl_trzech_kroli(year)
year >= 2011 ? 6 : nil
end
# January 6 wasn't holiday before 2011
def self.pl_trzech_kroli_informal(year)
year < 2011 ? 6 : nil
end
end

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

@ -0,0 +1,76 @@
# encoding: utf-8
module Holidays
# This file is generated by the Ruby Holiday gem.
#
# Definitions loaded: data/pl.yaml
#
# To use the definitions in this file, load them right after you load the
# Holiday gem:
#
# require 'holidays'
# require 'holidays/pl'
#
# More definitions are available at http://code.dunae.ca/holidays.
module PL # :nodoc:
DEFINED_REGIONS = [:pl]
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
# January 6 is holiday since 2011
def self.pl_trzech_kroli(year)
year >= 2011 ? 6 : nil
end
# 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

@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
# This file is generated by the Ruby Holiday gem.
#
# Definitions loaded: data/at.yaml, data/cz.yaml, data/dk.yaml, data/de.yaml, data/el.yaml, data/es.yaml, data/fr.yaml, data/gb.yaml, data/ie.yaml, data/is.yaml, data/it.yaml, data/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/nl.yaml, data/no.yaml, data/pl.yaml, data/pt.yaml
class EuropeDefinitionTests < Test::Unit::TestCase # :nodoc:
def test_europe
@ -287,6 +287,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',

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