Alex J. G. Burzyński > Date-Holidays-PL-1.110050 > Date::Holidays::PL

Download:
Date-Holidays-PL-1.110050.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 1.110050   Source  

NAME ^

Date::Holidays::PL - Determine holidays for Poland

VERSION ^

version 1.110050

SYNOPSIS ^

    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";
    }

DESCRIPTION ^

Date::Holidays::PL determines public holidays for Poland.

METHODS ^

pl_holidays

    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:

WEEKENDS

If set to false then the list of holidays will not include those which are during weekends.

Boolean, default true.

pl_holidays_dt

    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.

As the second argument hashref could be provided with one configuration option:

WEEKENDS

If set to false then the list of holidays will not include those which are during weekends.

Boolean, default true.

is_pl_holiday

    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.

is_pl_holiday_dt

    if ( my $name = is_pl_holiday_dt(DateTime->now) ) {
        print "Today is a public holiday: $name\n";
    }

Takes one argument: DateTime object.

Returns the name of a holiday if date given is a public holiday, otherwise returns undef.

PUBLIC HOLIDAYS ^

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.

EXPORTS ^

Date::Holidays::PL uses Sub::Exporter to export following methods:

By default no methods are exported.

SEE ALSO ^

AUTHOR ^

Alex J. G. Burzyński <ajgb@cpan.org>

COPYRIGHT AND LICENSE ^

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.

syntax highlighting: