Date-Lectionary
view release on metacpan or search on metacpan
lib/Date/Lectionary/Day.pm view on Meta::CPAN
=head1 SYNOPSIS
A helper object for Date::Lectionary to determine the liturgical name(s) and type for the given day according to a given lectionary.
=cut
enum 'DayType', [qw(fixedFeast moveableFeast Sunday noLect)];
enum 'LectionaryType', [qw(acna rcl)];
enum 'MultiLect', [qw(yes no)];
enum 'IncludeFeasts', [qw(yes no)];
enum 'XianSeason', [qw(Advent Christmas Epiphany Ordinary Lent Easter Pentecost NaN)];
no Moose::Util::TypeConstraints;
=head1 SUBROUTINES/METHODS/ATTRIBUTES
=head2 ATTRIBUTES
=head3 date
The Time::Piece object date given at object construction.
lib/Date/Lectionary/Day.pm view on Meta::CPAN
If this is set to 'yes' --- the default value --- the module will include fixed and moveable feasts in its determination of which liturgical Sunday it is.
If set to 'no', it will exclude fixed and moveable feasts. Excluding feasts is useful when using Date::Lectionary::Day in combination with a daily lectionary such as Date::Lectioary::Daily where a fixed feast such as The Transfiguration can conflict...
=head3 season
The liturgical season the day falls within.
Valid values are 'Advent', 'Christmas', 'Epiphany', 'Ordinary', 'Lent', 'Easter', or 'Pentecost'.
If a date is given that is not a Sunday nor a pricipal holy day 'NaN' will be given for the season.
=cut
has 'date' => (
is => 'ro',
isa => 'Time::Piece',
required => 1,
);
has 'type' => (
lib/Date/Lectionary/Day.pm view on Meta::CPAN
my $yesterdayName;
if ( $yesterday->wday == 1 ) {
$yesterdayName = _buildMoveableDays( $yesterday, $lectionary );
}
if ($yesterdayName) {
return (
commonName => $yesterdayName,
type => 'moveableFeast',
season => 'NaN'
);
}
my $fixedDayName = _buildFixedDays( $date, $lectionary );
if ($fixedDayName) {
return (
commonName => $fixedDayName->{commonName},
type => 'fixedFeast',
season => $fixedDayName->{season}
);
}
my $moveableDayName = _buildMoveableDays( $date, $lectionary );
if ( $moveableDayName && $date->wday != 1 ) {
return (
commonName => $moveableDayName,
type => 'moveableFeast',
season => 'NaN'
);
}
return ( commonName => undef, type => undef, season => 'NaN' );
}
=head2 _buildMoveableDays
Private method that takes the Time::Piece date given at construction and determines if the date is one of many moveable feasts in the liturgical calendar. Feasts are taken from the Anglican Church in North America's revision of the revised common le...
=cut
sub _buildMoveableDays {
my $date = shift;
lib/Date/Lectionary/Day.pm view on Meta::CPAN
);
}
}
#If the date isn't a Sunday and we've determined it is not a fixed holiday
#then there are no readings for that day.
if ( $date->wday != 1 ) {
return (
commonName => $date->fullday . ', ' . $date->fullmonth . ' ' . $date->mday . ', ' . $date->year,
type => 'noLect',
season => 'NaN'
);
}
#Sundays of the Liturgical Year
if ( $date < $ashWednesday ) {
my %xmasEpiphany = (
commonName => _determineChristmasEpiphany( $date, $advent, $ashWednesday, $lectionary ),
type => 'Sunday'
);
t/09-day-seasons.t view on Meta::CPAN
$sunday = Date::Lectionary::Day->new(
'date' => Time::Piece->strptime( "2020-01-06", "%Y-%m-%d" ),
'lectionary' => 'acna'
);
is(
$sunday->season,
'Epiphany',
'1/6/202 is Epiphany and should be in the season of Epiphany'
);
#These dates will presently report NaN for the season until the method is updated to do calculations for days other than Sunday and major holy days
$sunday = Date::Lectionary::Day->new(
'date' => Time::Piece->strptime( "2020-12-24", "%Y-%m-%d" ),
'lectionary' => 'acna'
);
is(
$sunday->season,
'NaN',
'12/24/2020 is Christmas Eve and should be in the season of Advent'
);
$sunday = Date::Lectionary::Day->new(
'date' => Time::Piece->strptime( "2020-01-07", "%Y-%m-%d" ),
'lectionary' => 'acna'
);
is(
$sunday->season,
'NaN',
'1/7/2020 should be in Ordinary time'
);
( run in 0.389 second using v1.01-cache-2.11-cpan-fd5d4e115d8 )