Date::Holidays::CZ - Determine Czech holidays
use Date::Holidays::CZ qw(holidays); my $svatky_ref = holidays(); my @svatky = @$svatky_ref;
This module exports a single function named holidays() which returns a list of Czech holidays in a given year.
Version 0.13
The module knows about the following holidays (official names):
obss Den obnovy samostatného českého státu velk Velikonoční pátek veln Velikonoční neděle velp Velikonoční pondělí svpr Svátek práce devi Den vítězství cyme Den slovanských věrozvěstů Cyrila a Metoděje mhus Den upálení mistra Jana Husa wenc Den české státnosti vzcs Den vzniku samostatného československého státu bojs Den boje za svobodu a demokracii sted Štědrý den van1 1. svátek vánoční van2 2. svátek vánoční
The module knows about the following holidays (English names):
obss Restoration Day of the Independent Czech State velk Good Friday veln Easter Sunday velp Easter Monday svpr Labor Day dvit Liberation Day cyme Saints Cyril and Methodius Day mhus Jan Hus Day wenc Feast of St. Wenceslas (Czech Statehood Day) vzcs Independent Czechoslovak State Day bojs Struggle for Freedom and Democracy Day sted Christmas Eve van1 Christmas Day van2 Feast of St. Stephen
The list returned by holidays() consists of UNIX-Style timestamps in seconds since The Epoch. You may pass a strftime() style format string to get the dates in any format you desire:
my $svatky_ref = holidays(FORMAT=>"%d.%m.%Y");
Here are a few examples to get you started:
FORMAT=>"%d.%m.%Y" 25.12.2001 FORMAT=>"%Y%m%d" 20011225 FORMAT=>"%a, %B %d" Tuesday, December 25
Please consult the manual page of strftime() for a complete list of available format definitions.
There is, however, one "proprietary" extension to the formats of strftime(): The format definition %# will print the internal abbreviation used for each holiday.
FORMAT=>"%#:%d.%m" van1:25.12.
As the module doesn't want to deal with i18n issues, you'll have to find your own way to translate the aliases into your local language. See the example/svatky.pl script included in the distribution to get the idea.
By default, holidays() returns the holidays for the current year. Specify a year as follows:
my $svatky_ref = holidays(YEAR=>2004);
By default, holidays() includes Holidays that occur on weekends in its listing.
To disable this behaviour, set the WEEKENDS option to 0:
my $svatky_ref = holidays(WEEKENDS=>0);
Get all holidays in 2004, except those that occur on weekends. Return the date list in human readable format:
my $feiertage_ref = holidays( FORMAT => "%a, %d.%m.%Y", WEEKENDS => 0, YEAR => 2004, );
Uses Date::Calc for all calculations. Makes use of the POSIX and Time::Local modules from the standard Perl distribution.
Returns a list of Czech holidays in a given year.
If you run into a miscalculation, need some sort of feature or an additional holiday, or if you know of any new changes to our funky holiday situation, please drop the author a note.
Patches are welcome. If you can, please fork the project on github to submit your change:
http://github.com/smithfarm/Date-Holidays-CZ
The authority for Czech holidays is the Parliament of the Czech Republic, which sets the holidays by decree of law.
The official list of list of Czech holidays is available at:
http://www.mpsv.cz/cs/74
Date::Calc works with year, month and day numbers exclusively. Even though this module uses Date::Calc for all calculations, it represents the calculated holidays as UNIX timestamps (seconds since The Epoch) to allow for more flexible formatting. This limits the range of years to work on to the years from 1972 to 2037.
Date::Holidays::CZ is not configurable. Holiday changes don't come overnight and a new module release can be rolled out within a single day.
Nathan Cutler <ncutler@suse.com>
perl, Date::Calc.
1 POD Error
The following errors were encountered while parsing the POD:
Non-ASCII character seen before =encoding in 'samostatného'. Assuming UTF-8
To install Date::Holidays::CZ, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Date::Holidays::CZ
CPAN shell
perl -MCPAN -e shell install Date::Holidays::CZ
For more information on module installation, please visit the detailed CPAN module installation guide.