Date::Holidays::PL - Determine holidays for Poland
version 1.110050
use Date::Holidays::PL qw( pl_holidays is_pl_holiday pl_holidays_dt is_pl_holiday_dt); my ($year, $month, $day) = (localtime)[ 5, 4, 3 ]; $year += 1900; $month += 1; # pl_holidays my $holidays = pl_holidays( $year ); for my $month_day ( keys %$holidays ) { print "$month_day: $holidays->{$month_day}\n"; } # pl_holidays_dt my $holidays_dt = pl_holidays_dt( $year ); for my $name ( keys %$holidays ) { print "$name ", $holidays->{$name}->strftime('%Y-%m-%d'), "\n"; } # is_pl_holiday if ( my $name = is_pl_holiday($year, $month, $day) ) { print "$year-$month-$day is a public holiday: $name\n"; } # is_pl_holiday_dt if ( my $name = is_pl_holiday_dt(DateTime->now) ) { print "Today is a public holiday: $name\n"; }
Date::Holidays::PL determines public holidays for Poland.
my $holidays = pl_holidays( $year ); my $holidays_excluding_weekends = pl_holidays( $year, { WEEKENDS => 0 } );
Returns a hashref of all public holidays for given year. Keys are in the month-day format MMDD and the values are the names of the holidays.
As the second argument hashref could be provided with one configuration option:
If set to false then the list of holidays will not include those which are during weekends.
Boolean, default true.
my $holidays = pl_holidays_dt( $year ); my $holidays_excluding_weekends = pl_holidays_dt( $year, { WEEKENDS => 0 } );
Returns a hashref of all public holidays for given year. Keys are the names of the holidays (in Polish) and values are DateTime objects.
if ( my $name = is_pl_holiday($year, $month, $day) ) { print "$year-$month-$day is a public holiday: $name\n"; }
Takes three arguments: year, month and day.
Returns the name of a holiday if date given is a public holiday, otherwise returns undef.
if ( my $name = is_pl_holiday_dt(DateTime->now) ) { print "Today is a public holiday: $name\n"; }
Takes one argument: DateTime object.
The following Polish holidays have fixed dates:
# New Year's Day Jan 1 Nowy Rok # Epiphany (1951-1959, 2011+ only) Jan 6 Trzech Króli # Labor Day May 1 Święto Państwowe # Constitution Day ( since 1990 ) May 3 Święto Narodowe Trzeciego Maja # Polish Committee of National Liberation Manifesto (1951-1989 only) Jul 22 Święto Odrodzenia Polski # Assumption of the Blessed Virgin Mary ( 1951-1959, 1989+ ) Aug 15 Wniebowzięcie Najświętszej Maryi Panny # All Saints' Day Nov 1 Wszystkich Świętych # Independence Day ( since 1989 ) Nov 11 Narodowe Święto Niepodległości # Christmas Day Dec 25 pierwszy dzień Bożego Narodzenia # Boxing Day Dec 26 drugi dzień Bożego Narodzenia
List of Polish moveable feasts:
# Easter Sunday pierwszy dzień Wielkanocy # Easter Monday +1 day drugi dzień Wielkanocy # Pantecoste Sunday +49 days pierwszy dzień Zielonych Świątek # Corpus Christi +60 days dzień Bożego Ciała
Based on Polish law (since year 1951): Ustawa z dnia 18 stycznia 1951 r. o dniach wolnych od pracy and Ustawa z dnia 24 września 2010 r. o zmianie ustawy - Kodeks pracy oraz niektórych innych ustaw.
Date::Holidays::PL uses Sub::Exporter to export following methods:
"pl_holidays"
"pl_holidays_dt"
"is_pl_holiday"
"is_pl_holiday_dt"
By default no methods are exported.
Date::Holidays
Date::Holidays::Abstract
http://pl.wikipedia.org/wiki/Dni_wolne_od_pracy_w_Polsce
Alex J. G. Burzyński <ajgb@cpan.org>
This software is copyright (c) 2010 by Alex J. G. Burzyński <ajgb@cpan.org>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Date::Holidays::PL, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Date::Holidays::PL
CPAN shell
perl -MCPAN -e shell install Date::Holidays::PL
For more information on module installation, please visit the detailed CPAN module installation guide.