NAME
Time::Moment::Adjusters - Adjusters for Time::Moment
SYNOPSIS
$adjuster = NextDayOfWeek($day);
$adjuster = NextOrSameDayOfWeek($day);
$adjuster = PreviousDayOfWeek($day);
$adjuster = PreviousOrSameDayOfWeek($day);
$adjuster = FirstDayOfWeekInMonth($day);
$adjuster = LastDayOfWeekInMonth($day);
$adjuster = NthDayOfWeekInMonth($ordinal, $day);
DESCRIPTION
Time::Moment::Adjusters
provides adjusters. An adjuster is a CODE reference invoked with an instance of Time::Moment and is expected to return an instance of Time::Moment.
FUNCTIONS
NextDayOfWeek
$adjuster = NextDayOfWeek($day);
The $adjuster
adjusts the date to the next occurrence of the given day of the week [1=Monday, 7=Sunday] that is after the date.
NextOrSameDayOfWeek
$adjuster = NextOrSameDayOfWeek($day);
The $adjuster
adjusts the date to the next occurrence of the given day of the week [1=Monday, 7=Sunday]. If the date already falls on the given day of the week it's unaltered.
PreviousDayOfWeek
$adjuster = PreviousDayOfWeek($day);
The $adjuster
adjusts the date to the previous occurrence of the given day of the week [1=Monday, 7=Sunday] that is before the date.
PreviousOrSameDayOfWeek
$adjuster = PreviousOrSameDayOfWeek($day);
The $adjuster
adjusts the date to the previous occurrence of the given day of the week [1=Monday, 7=Sunday]. If the date already falls on the given day of the week it's unaltered.
FirstDayOfWeekInMonth
$adjuster = FirstDayOfWeekInMonth($day);
The $adjuster
adjusts the date to the first occurrence of the given day of the week [1=Monday, 7=Sunday] within the month.
LastDayOfWeekInMonth
$adjuster = LastDayOfWeekInMonth($day);
The $adjuster
adjusts the date to the last occurrence of the given day of the week [1=Monday, 7=Sunday] within the month.
NthDayOfWeekInMonth
$adjuster = NthDayOfWeekInMonth($ordinal, $day);
The $adjuster
adjusts the date to the given ordinal day of the week within the month.
Parameters:
- ordinal
-
The ordinal of the week within the month [-4, -1] ∪ [1, 4].
- day
-
The day of the week [1=Monday, 7=Sunday].
EXPORTS
None by default. All functions can be exported using the :all
tag or individually.
AUTHOR
Christian Hansen chansen@cpan.org
COPYRIGHT
Copyright 2015 by Christian Hansen.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.