Date-Pcalc
view release on metacpan or search on metacpan
lib/Date/Pcalendar/Profiles.pm view on Meta::CPAN
###############################################################################
## ##
## Copyright (c) 2000 - 2009 by Steffen Beyer. ##
## All rights reserved. ##
## ##
## This package is free software; you can redistribute it ##
## and/or modify it under the same terms as Perl itself. ##
## ##
###############################################################################
package Date::Pcalendar::Profiles;
BEGIN { eval { require bytes; }; }
use strict;
use vars qw( @ISA @EXPORT @EXPORT_OK $VERSION $Profiles );
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw();
@EXPORT_OK = qw(
$Profiles
&Previous_Friday
&Next_Monday
&Next_Monday_or_Tuesday
&Nearest_Workday
&Sunday_to_Monday
&Advent1
&Advent2
&Advent3
&Advent4
&Advent
);
$VERSION = '6.1';
use Date::Pcalc qw(:all);
use Carp::Clan qw(^Date::);
##########################################################################
# #
# Moving ("variable") holidays depending on the date of Easter Sunday: #
# #
# Weiberfastnacht, Fettdonnerstag = -52 days #
# Carnival Monday / Rosenmontag / Veille du Mardi Gras = -48 days #
# Mardi Gras / Karnevalsdienstag / Mardi Gras = -47 days #
# Ash Wednesday / Aschermittwoch / Mercredi des Cendres = -46 days #
# Palm Sunday / Palmsonntag / Dimanche des Rameaux = -7 days #
# Maundy Thursday / Gruendonnerstag / Jeudi avant Paques = -3 days #
# Good Friday / Karfreitag / Vendredi Saint = -2 days #
# Easter Saturday / Ostersamstag / Samedi de Paques = -1 day #
# Easter Sunday / Ostersonntag / Dimanche de Paques = +0 days #
# Easter Monday / Ostermontag / Lundi de Paques = +1 day #
# Prayer Day / Bettag / Jour de la Priere (Denmark) = +26 days #
# Ascension of Christ / Christi Himmelfahrt / Ascension = +39 days #
# Whitsunday / Pfingstsonntag / Dimanche de Pentecote = +49 days #
# Whitmonday / Pfingstmontag / Lundi de Pentecote = +50 days #
# Feast of Corpus Christi / Fronleichnam / Fete-Dieu = +60 days #
# #
##########################################################################
###############################################
# #
# Rules to enhance readability: #
# #
# 1) First level constants in single quotes, #
# second level constants in double quotes. #
# 2) Use leading zeros for fixed length. #
# #
lib/Date/Pcalendar/Profiles.pm view on Meta::CPAN
$Profiles->{'NO'} = # Norway
{
"Nyttårsdag" => "01/01",
"Onsdag før Skjærtorsdag" => "#-4", # sometimes half a day off
"Skjærtorsdag" => "-3",
"Langfredag" => "-2",
"Påskedag" => "+0",
"2. Påskedag" => "+1",
"1. mai" => "05/01",
"Grunnlovsdag" => "05/17",
"Kristi himmelfartsdag" => "+39",
"Pinsedag" => "+49",
"2. Pinsedag" => "+50",
"Julaften" => "#12/24", # sometimes half a day off
"Juledag" => "12/25",
"2. Juledag" => "12/26",
"Nyttårsaften" => "#31.12" # sometimes half a day off
};
## Thanks to:
## Sercan Uslu <sercanuslu@su.sabanciuniv.edu>
#
#$Profiles->{'TR'} = # Türkiye
#{
## National Public Holidays (fixed):
#
# "New Year's Day" => "01-01",
# "National Sovereignty Day" => "23-04",
# "Children's Day" => "23-04",
# "Atatürk Commemoration" => "19-05",
# "Youth and Sports Day" => "19-05",
# "Victory Day" => "30-08",
# "Republic Day" => "29-10",
#
## Religious Public Holidays (moving):
#
# "Kurban Bayram (Eid al Adha) 1" => "22-02", # only valid in 2002
# "Kurban Bayram (Eid al Adha) 2" => "23-02", # only valid in 2002
# "Kurban Bayram (Eid al Adha) 3" => "24-02", # only valid in 2002
# "Kurban Bayram (Eid al Adha) 4" => "25-02", # only valid in 2002
#
# "Ramazan / Seker Bayram (Eid al Fitr) 1" => "05-12", # only valid in 2002
# "Ramazan / Seker Bayram (Eid al Fitr) 2" => "06-12", # only valid in 2002
# "Ramazan / Seker Bayram (Eid al Fitr) 3" => "07-12" # only valid in 2002
#};
# Thanks to:
# Jonathan Stowe <gellyfish@gellyfish.com>
$Profiles->{'GB'} = # Great Britain
{
"New Year's Day" => \&GB_New_Year,
"Good Friday" => "-2",
"Easter Sunday" => "+0",
"Easter Monday" => "+1",
"Early May Bank Holiday" => \&GB_Early_May,
"Late May Bank Holiday" => "5/Mon/May", # Last Monday
#
# Jonathan Stowe <gellyfish@gellyfish.com> told me that spring
# bank holiday is the first Monday after Whitsun, but my pocket
# calendar suggests otherwise. I decided to follow my pocket
# guide and an educated guess ;-), but please correct me if
# I'm wrong!
#
"Summer Bank Holiday" => "5/Mon/Aug", # Last Monday
"Christmas Day" => \&GB_Christmas,
"Boxing Day" => \&GB_Boxing
};
sub GB_New_Year
{
my($year,$label) = @_;
return( &Next_Monday($year,1,1) );
}
#
# The following formula (also from Jonathan Stowe <gellyfish@gellyfish.com>)
# also contradicts my pocket calendar, but for lack of a better guess I
# left it as it is. Please tell me the correct formula in case this one
# is wrong! Thank you!
#
sub GB_Early_May # May bank holiday is the first Monday after May 1st
{
my($year,$label) = @_;
if (Day_of_Week($year,5,1) == 1)
{ return( Nth_Weekday_of_Month_Year($year,5,1,2) ); }
else
{ return( Nth_Weekday_of_Month_Year($year,5,1,1) ); }
}
sub GB_Christmas
{
my($year,$label) = @_;
return( &Next_Monday($year,12,25) );
}
sub GB_Boxing
{
my($year,$label) = @_;
return( &Next_Monday_or_Tuesday($year,12,26) );
}
# Thanks to:
# Bianca Taylor <bianca@unisolve.com.au>
# Andie Posey <andie@posey.org>
# Don Simonetta <don.simonetta@tequinox.com>
# Paul Fenwick <pjf@cpan.org>
# Brian Graham <brian.graham@nec.com.au>
# Pat Waters <pat.waters@dir.qld.gov.au>
# Stephen Riehm <Stephen.Riehm@gmx.net>
# http://www.holidayfestival.com/Australia.html
# http://www.earthcalendar.net/countries/2001/australia.html
# Sven Geisler <sgeisler@aeccom.com>
# Canberra (ACT):
# http://www.workcover.act.gov.au/labourreg/publicholidays.html
# New South Wales (NSW):
# http://www.dir.nsw.gov.au/holidays/index.html
# Northern Territory (NT):
# http://www.nt.gov.au/ocpe/documents/public-holidays/
# Queensland (QLD):
# http://www.wageline.qld.gov.au/publicholidays/list_pubhols.html
# South Australia (SA):
# http://www.sacentral.sa.gov.au/information/pubhols.htm
# Tasmania (TAS):
# http://www.workcover.tas.gov.au/WSTPublish/node/wststatutory.htm
# Victoria (VIC):
# http://www.info.vic.gov.au/resources/publichols.htm
# Western Australia (WA):
# http://www.doplar.wa.gov.au/wages/pub_hol1.htm
$Profiles->{'AU'} = # Australia
{
"Australia Day" => \&AU_Australia,
"St. Valentine's Day" => "#14.02.",
"Good Friday" => "-2",
"Easter Sunday" => "+0",
"Easter Monday" => "+1",
"Anzac Day" => "25.04.",
"Christmas Day" => \&AU_Christmas,
"Boxing Day" => \&AU_Boxing
};
sub AU_Australia
{
my($year,$label) = @_;
return( &Next_Monday($year,1,26) );
}
sub AU_Christmas
{
my($year,$label) = @_;
return( &Next_Monday($year,12,25) );
}
sub AU_Boxing
{
my($year,$label) = @_;
return( &Next_Monday_or_Tuesday($year,12,26) );
}
sub AU_New_Year
{
my($year,$label) = @_;
return( &Next_Monday($year,1,1) );
}
sub AU_Lauceston
{
my($year,$label) = @_;
if (Nth_Weekday_of_Month_Year($year,2,3,5))
{ return( Nth_Weekday_of_Month_Year($year,2,3,4) ); }
else
{ return( Nth_Weekday_of_Month_Year($year,2,3,3) ); }
}
sub AU_May
{
( run in 0.644 second using v1.01-cache-2.11-cpan-5a3173703d6 )