Date-Holidays-TW
view release on metacpan or search on metacpan
NAME
Date::Holidays::TW - Determine whether it is Taiwan Holidays or not.
SYNOPSIS
This module can be used by itself:
use Date::Holidays::TW qw(is_tw_holiday);
if ( is_tw_holiday(2020, 6, 25) ) {
...
}
Or via Date::Holidays
my $dh = Date::Holidays->new( countrycode => 'TW' );
if ($dh->is_holiday( 2020, 6, 25 )) {
...
}
DESCRIPTION
This module provides functions to look into Taiwan holiday calendars
for known holidays. It could be used by itself, or under via
Date::Holidays module.
Caveat: Due to the rule of weekend-compensation and the fact that the
majority of holidays are defined by Chinese calendar (Lunar), it
requires some non-trivial amount of computation to correctly determine
whether the given date is an holiday or not -- which is not implemented
at this version.
The current implementation includes all known holidays from year 2013
and 2024 in a lookup table and should therefore correctly determine
holidays in those years. It should also determine most of the future
holidays correctly with some basic compuation, except for the ones
generated by the weekend-compensation rules, which is somewhat
ambiguous.
Conventionally the holiday calendar for the next year is announcend at
the end of June and we could start to mix the new information into the
lookup table in this module.
Generally speaking, queries for far future should be avoided.
EXPORTABLE FUNCTIONS
is_tw_holiday
Usage:
my $holiday_name = is_tw_holiday( $year, $month, $day );
This subroutine returns the name of the holiday for the given day if it
is a holiday. Otherwise it returns undef.
tw_holidays
Usage:
my $holidays = tw_holidays( $year );
This retrieve all Taiwan holidays of given year as a HashRef. With keys
being Month + Day as 4-digit string and values being the name of the
corresponding holiday.
METHODS
is_holiday
Usage:
$o = Date::Holidays::TW->new();
$res = $o->is_holiday( $year, $month, $day );
This does the same thing as function is_tw_holiday.
holidays
Usage:
$o = Date::Holidays::TW->new();
$res = $o->holidays( $year );
This does the same thing as function tw_holidays.
SEE ALSO
Date::Holidays, https://www.dgpa.gov.tw/informationlist?uid=30,
https://data.gov.tw/dataset/14718
AUTHOR
Kang-min Liu <gugod@gugod.org>
Wei-Hon Chen
LICENSE
The MIT License
( run in 2.192 seconds using v1.01-cache-2.11-cpan-5c0b1e786e0 )