Time::Moment::Adjusters(3pm)

NAME
Time::Moment::Adjusters - Adjusters for Time::Moment

SYNOPSIS
    $adjuster = NextDayOfWeek($day);
    $adjuster = NextOrSameDayOfWeek($day);

    $adjuster = PreviousDayOfWeek($day);
    $adjuster = PreviousOrSameDayOfWeek($day);

    $adjuster = NearestDayOfWeek($day);

    $adjuster = FirstDayOfWeekInMonth($day);
    $adjuster = LastDayOfWeekInMonth($day);

    $adjuster = NthDayOfWeekInMonth($ordinal, $day);

    $adjuster = WesternEasterSunday();
    $adjuster = OrthodoxEasterSunday();

    $adjuster = NearestMinuteInterval($interval);

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.

  NearestDayOfWeek
    $adjuster = NearestDayOfWeek($day);

The $adjuster adjusts the date to the nearest occurrence of the given day of the week [1=Monday, 7=Sunday].

  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].

  WesternEasterSunday
    $adjuster = WesternEasterSunday();

The $adjuster adjusts the date to the Western Easter Sunday. The Western computus is based on the Gregorian calendar.

  OrthodoxEasterSunday
    $adjuster = OrthodoxEasterSunday();

The $adjuster adjusts the date to the Orthodox Easter Sunday. The Orthodox computus is based on the Julian calendar with the Julian date converted to the equivalent Gregorian date.

  NearestMinuteInterval
    $adjuster = NearestMinuteInterval($interval);

The $adjuster adjusts the time of day to the nearest minute of the given minute interval [1, 1440].

Given an minute interval of 30:

    T10:14:59 => T10:00:00
    T10:15:00 => T10:30:00
    T10:29:59 => T10:30:00
    T23:55:00 => T00:00:00 (midnight of the following day)

EXPORTS
None by default. All functions can be exported using the ":all" tag or individually.

AUTHOR
Christian Hansen "chansen@cpan.org"

COPYRIGHT
Copyright 2015-2017 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.