Date-Holidays-UA

NAME

    Date::Holidays::UA - Holidays module for Ukraine

VERSION

    Version 0.02

INSTALLATION

To install this module, run the following commands:

    perl Makefile.PL
    make
    make test
    make install

SYNOPSIS

        # procedural approach
    
        use Date::Holidays::UA qw(:all);
    
        my ($year, $month, $day) = (localtime)[5, 4, 3];
        $year  += 1900;
        $month += 1;
    
        print 'Holiday!' if is_holiday($year, $month, $day);
    
        my $calendar = holidays($year, {language => 'en'});
        print $calendar->{'0824'};
    
    
        # object-oriented approach
    
        use DateTime;
        use Date::Holidays::UA;
    
        my $ua = Date::Holidays::UA->new({ language => 'en' });
        print 'Holiday!' if $ua->is_holiday_dt(DateTime->today);
    
        my $calendar = $ua->holidays(DateTime->today->year);
        print join("\n", value(%$calendar)); # list of holiday names for Ukraine

SUBROUTINES/METHODS

 new()

    Create a new Date::Holidays::UA object. Parameters should be given as a
    hashref of key-value pairs.

        my $ua = Date::Holidays::UA->new();
    
        my $ua = Date::Holidays::UA->new({
            language => 'en'
        });

    One parameters can be specified: language.

 is_holiday()

    For a given year, month (1-12) and day (1-31), return 1 if the given
    day is a holiday; 0 if not. When using procedural calling style, an
    additional hashref of options can be specified.

        $holiday_p = is_holiday($year, $month, $day);
    
        $holiday_p = is_holiday($year, $month, $day, {
            language => 'en'
        });
    
        $holiday_p = $ua->is_holiday($year, $month, $day);

 is_holiday_dt()

    As is_holiday, but accepts a DateTime object in place of a numeric
    year, month, and day.

        $holiday_p = is_holiday_dt($dt, {language => 'en'});
    
        $holiday_p = $ua->is_holiday_dt($dt);

 is_ua_holiday()

    Similar to is_holiday. Return the name of the holiday occurring on the
    specified date if there is one; undef if there isn't.

        print $ua->is_ua_holiday(2020, 1, 1); # "New Year"

 holidays()

    For the given year, return a hashref containing all the holidays for
    that year. The keys are the date of the holiday in mmdd format (eg
    '1225' for December 25); the values are the holiday names.

        my $calendar = holidays($year, {language => 'en'});
        print $calendar->{'0824'}; # "Independence Day"
    
        my $calendar = $ua->holidays($year);
        print $calendar->{'0628'}; # "Constitution Day"

 ua_holidays()

    Same as holidays().

 holidays_dt()

    Similar to holidays(), The keys are the date of the holiday in mmdd
    format (eg '1225' for December 25); and DateTime objects as the values.

    my $calendar = $ua->holidays_dt($year);

AUTHOR

    Denis Boyun, <denisboyun at gmail.com>

BUGS

    Please report any bugs or feature requests to bug-date-holidays-ua at
    rt.cpan.org, or through the web interface at
    https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Date-Holidays-UA. I
    will be notified, and then you'll automatically be notified of progress
    on your bug as I make changes.

SUPPORT

    You can find documentation for this module with the perldoc command.

        perldoc Date::Holidays::UA

    You can also look for information at:

      * RT: CPAN's request tracker (report bugs here)

      https://rt.cpan.org/NoAuth/Bugs.html?Dist=Date-Holidays-UA

      * AnnoCPAN: Annotated CPAN documentation

      http://annocpan.org/dist/Date-Holidays-UA

      * CPAN Ratings

      https://cpanratings.perl.org/d/Date-Holidays-UA

      * Search CPAN

      https://metacpan.org/release/Date-Holidays-UA

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

    This software is copyright (c) 2020 by Denis Boyun.

    This is free software; you can redistribute it and/or modify it under
    the same terms as the Perl 5 programming language system itself.