NAME
Date::Holidays::GB - Date::Holidays class for GB
VERSION
version 0.001
SYNOPSIS
use Date::Holidays::GB qw/ holidays is_holiday /;
# All UK holidays
my $holidays = holidays( year => 2013 );
# Holidays in England & Wales and Scotland
my $holidays = holidays( year => 2013, regions => [ 'EAW', 'SCT' ] );
if (is_holiday(
year => 2013, month => 12, day => 25,
regions => [ 'EAW', 'SCT' ] )
) {
print "No work today!";
}
DESCRIPTION
A Date::Holidays style package updated with the British holiday dates now published at https://www.gov.uk/bank-holidays.
NAME
Date::Holidays::GB - UK public holiday dates, updated from gov.uk
EXPORTS
Exports holidays
and is_holiday
on demand.
METHODS
Both is_holiday
and holidays
take either an argument list or hash of named arguments.
The named arguments are year
, month
, day
, and region
. region
should be either omitted (to search all regions) or an arrayref of the UK regions that you are interested in, as ISO-3166-2 codes.
The argument list should be in the following order: year, month, day, and (optionally) regions.
Note that you will need to specify region(s) to make correct use of this module!
holidays
# year, month, day, [regions]
my $holidays = Date::Holidays::GB->holidays( @args );
or # ( year => ..., month => ..., day => ..., [ regions => \@. .. ] ) my $holidays = Date::Holidays::GB->holidays( %args );
Returns hashref of holiday dates, values are a string listing the holiday(s) taking place on that date, with the region name(s) in parenthesis.
Holidays that occur in all regions are returned with a single canonical name, taken from the name in England & Wales.
Date keys are in the format MMDD, as per the behaviour ofDate::Holidays.
is_holiday
# year, month, day, [regions]
my $holiday = Date::Holidays::GB->is_holiday( @args );
or # ( year => ..., month => ..., day => ..., [ regions => \@. .. ] ) my $holiday = Date::Holidays::GB->is_holiday( %args );
Returns the holiday details (as per holidays
) but for a single date. Returns false if the specified date is not a holiday in the appropriate region(s).
ISO-3166-2 REGION CODES
Valid codes for regions are:
EAW - England & Wales
SCT - Scotland
NIR - Northern Ireland
SEE ALSO
SUPPORT
Bugs / Feature Requests
Please report any bugs or feature requests through the issue tracker at https://github.com/mjemmeson/date-holidays-gb/issues. You will be notified automatically of any progress on your issue.
Source Code
This is open source software. The code repository is available for public review and contribution under the terms of the license.
https://github.com/mjemmeson/date-holidays-gb
git clone git://github.com/mjemmeson/date-holidays-gb.git
AUTHOR
Michael Jemmeson <mjemmeson@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Michael Jemmeson.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.