Date-Holidays-EnglandWales

 view release on metacpan or  search on metacpan

lib/Date/Holidays/EnglandWales.pm  view on Meta::CPAN

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself. That means either the Artistic
License or the GNU GPL version 2 or later.

=cut

sub is_holiday { goto &is_uk_holiday; }

sub is_uk_holiday {
    my ($year, $month, $day) = @_;
    ($year, $month, $day) = split m{[-/]}, $year unless $month;
    
    my $dt = DateTime->new(year => $year, month => $month, day => $day)
        or die "Failed to create DateTime object for $year-$month-$day"
            . " - invalid date?";

    if ( $month == 1 ) {
        return "New Years Day" if (
            ( $day == 1 && $dt->day_of_week <= 5 ) || 
            ( $day == 2 && $dt->day_of_week == 1 ) ||
            ( $day == 3 && $dt->day_of_week == 1 ) );



( run in 2.387 seconds using v1.01-cache-2.11-cpan-71847e10f99 )