Following a discussion in #cph.pm (The Copenhagen Perl Mongers IRC channel). I have added two new experimental methods to the Date::Holidays class.
The methods are:
is_holiday_dt
holidays_dt
The first one takes one argument, a
DateTime object, it then validates whether this is a holiday in the calendar specified for by the country code with which the Date::Holidays object have been instantiated.
The second one acts just as the normal holidays method. It takes a single named argument, namely year. If possible it returns a reference to a hash containing all the holidays as in the scenario above, but the reference to the hash contains DateTime objects and are indexed by the holiday names.
This has not been sent to the CPAN yet and I consider it experimental since it does not as such have any priority, but it made me think that if the Date::Holidays module is going to act as wrapper for all of these things, then I guess it would be ok to implement Date::Holidays::Super as an alternative to
Date::Holidays::Abstract.