DEV Community 👩‍💻👨‍💻

jonasbn
jonasbn

Posted on

Feature release 1.32 of Date::Holidays Perl distribution

Due to a contribution from Wesley Schwengle (waterkip) I am happy to announce release 1.32 of the Date::Holidays Perl distribution.

The release introduces support for:

In addition the adapters for:

Have had their:

  • is_holiday
  • is_holiday_dt

Methods extended with support for additional parameters so the user can specify, the following parameters:

  • gov for handling special dates influencing government interaction
  • lang so language for holidays names can be specified

Please see the specific documentation for the 3 distributions.

I am happy that waterkip created the PR to have Date::Holidays support the use for the 3 and it outlines one of the features that would be nice to have implemented, namely support for localized holiday names (#12)

Here is a short demo of inquiring whether 2022-12-25 is a holiday in the 3 respective calendars.

#!/usr/bin/env perl

use strict;
use warnings;

use Data::Dumper;
use Date::Holidays;

my $holidays_hashref = Date::Holidays->is_holiday(
    year      => 2022,
    month     => 12,
    day       => 25,
    countries => ['nl', 'bq', 'aw'],
);

print STDERR Dumper($holidays_hashref);

exit 0;
Enter fullscreen mode Exit fullscreen mode

The output:

$VAR1 = {
          'aw' => 'Pasco di Nacemento',
          'bq' => 'Pasco di Nacemento',
          'nl' => 'Kerst'
        };
Enter fullscreen mode Exit fullscreen mode

Change log for Date::Holidays.

1.32 2022-10-03 Feature release, update not required

  • Introduction of Date::Holidays::Adapter::BQ for adapting Date::Holidays::BQ

  • Support for extra parameters for is_holiday and is_holiday_dt:

    • Date::Holidays::NL via Date::Holidays::Adapter::NL
    • Date::Holidays::AW via Date::Holidays::Adapter::AW
    • Date::Holidays::BQ via Date::Holidays::Adapter::BQ

All via PR #70 (https://github.com/jonasbn/perl-date-holidays/pull/70) by Wesley Schwengle (@waterkip) author of:

  • Date::Holidays::NL
  • Date::Holidays::AW
  • Date::Holidays::BQ

    • Fixed and clean up to Dist::Zilla configuration by @jonasbn

Top comments (2)

Collapse
 
jonasbn profile image
jonasbn

I did a quick follow-up release 1.33 so the gov and lang parameters can now be used in conjunction with the country list parameter. So you can do:

#!/usr/bin/env perl

use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/../lib";

use Data::Dumper;
use Date::Holidays;

my $holidays_hashref = Date::Holidays->is_holiday(
    year      => 2022,
    month     => 12,
    day       => 25,
    countries => ['nl', 'bq', 'aw'],
    lang      => 'en',
);

print STDERR Dumper($holidays_hashref);

exit 0;
Enter fullscreen mode Exit fullscreen mode

Which will then use the lang parameter and will output:

$VAR1 = {
          'nl' => 'Christmas',
          'aw' => 'Christmas',
          'bq' => 'Christmas'
        };
Enter fullscreen mode Exit fullscreen mode

Meaning the names gets translated.

Do note this is only for:

  • Date::Holidays::NL
  • Date::Holidays::AW
  • Date::Holidays::BQ

I really want to look into getting this to work for all adapted Date::Holidas::* distributions.

Collapse
 
jonasbn profile image
jonasbn

And a 1.34 release, cleaning up some old stuff making the tests run more smoothly with CPAN testers.

The red markings have gone :-)

Super Useful CSS Resources

>> Check out this classic DEV post <<