The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

NAME

Date::Holidays::ES - Spanish holidays

SYNOPSIS

my $dh = Date::Holidays->new( countrycode => 'es' );
print "Woohoo" if $dh->is_holiday(
year => $year,
month => $month,
day => $day
);
my $h = $dh->holidays( year => $year );
printf "Jan. 1st is named '%s'\n", $h->{'0101'};

DESCRIPTION

This module provide the Spanish national holidays. You should use it with the Date::Holidays OO wrapper, but you can also use it directly.

The following Spanish holidays have fixed dates:

1 Jan Año Nuevo
1 May Día del Trabajo
12 Oct Día de la Hispanidad
1 Nov Día de Todos los Santos
6 Dec Día de la Constitución
8 Dec Día de la Inmaculada Concepción
25 Dec Navidad

The following Spanish holiday hasn't a fixed date:

Viernes Santo Friday before Pascua / Easter

METHODS

new

Create a new Date::Holydays::ES object.

is_holiday

if ( $dh->is_holiday( year => $year, month => $month, day => $day ) ) {
# it's a holiday
}

Arguments:

year (four digits)
month (between 1-12)
day (between 1-31)

The return value from is_holiday is either the string with the holiday name or an undefined value.

is_es_holiday

A wrapper of the is_holiday method. Not available through Date::Holidays.

holidays

my $yh = $dh->holidays( year => $year );
for (keys %$yh) {
my ($day, $month) = unpack "A2A2", $_;
print "$day/$month - $yh->{$_}\n";
}

Arguments:

year (four digits)

Returns a hash reference, where the keys are dates represented as four digits, the two first representing the month (01-12) and the last two representing the day (01-31).

The value for a given key is the local name for the holiday.

es_holidays

A wrapper of the holidays function. Not available through Date::Holidays.

holidays_es

my $dh = Date::Holidays::ES->new;
my $yho = $dh->holidays_es( year => $year );
for my $holiday (sort keys %$yho) {
my $dt = $yho->{$holiday};
my $year = $dt->year;
my $month = $dt->month;
my $day = $dt->day;
print "$holiday is on $day/$month/$year\n";
}

Arguments:

year (four digits)

This method is not available through Date::Holidays' interface.

Returns a hash reference, where the keys are the holidays name and the values are DateTime objects.

SEE ALSO

Date::Holidays, DateTime

AUTHOR

  • jonasbn, <jonasbn@cpan.org>, current maintainer

  • Florian Merges, <fmerges@cpan.org>

COPYRIGHT & LICENSE

Copyright since 2007 Florian Merges, All Rights Reserved.

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