Time::M...djusters(3)
π Time::Moment::Adjusters π
okay bestie, sit down, hydrate, and let me tell you about Time::Moment::Adjusters β it's a little slice of the User Contributed Perl Documentation and honestly? iconic. it's the adjuster pack for Time::Moment, and it's about to make your date math so much cuter. π
β¨ NAME β¨
Time::Moment::Adjusters β the adjusters for Time::Moment, no cap. π
πΈ SYNOPSIS πΈ
like, here's the whole vibe in one code block:
$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 π¦
so Time::Moment::Adjusters provides adjusters. and what's an adjuster, you ask? it's literally a CODE reference that you invoke with an instance of Time::Moment, and it's expected to hand you back an instance of Time::Moment. that's the whole deal. periodt. β¨
π 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. so it skips today if today is already that day, bestie. π«Ά
π NextOrSameDayOfWeek
$adjuster = NextOrSameDayOfWeek($day);
the $adjuster adjusts the date to the next occurrence of the given day of the week [1=Monday, 7=Sunday]. but β plot twist β if the date already falls on the given day of the week, it's unaltered. she stays exactly as she is. π
π 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. going back in time, main character energy. βͺ
π PreviousOrSameDayOfWeek
$adjuster = PreviousOrSameDayOfWeek($day);
the $adjuster adjusts the date to the previous occurrence of the given day of the week [1=Monday, 7=Sunday]. and if the date already falls on the given day of the week, it's unaltered. same energy as her next-y sister, just backwards. π
π NearestDayOfWeek
$adjuster = NearestDayOfWeek($day);
the $adjuster adjusts the date to the nearest occurrence of the given day of the week [1=Monday, 7=Sunday]. closest one wins. vibe check passed. β¨
π 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. firsties. π₯
π 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. she's the finale, the closer, the last one out. π«
π 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, and the valid range is[-4, -1] βͺ [1, 4]. yes, negatives are allowed, she contains multitudes. π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. two calendars, one slay. π£β¨
π 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)
note that last one, bestie β T23:55:00 => T00:00:00 (midnight of the following day). she crosses the midnight line and doesn't even apologize. ππ
π EXPORTS π
- None by default. like, she's lowkey shy at first.
- all functions can be exported using the
:alltag, or individually. so you can have all of her, or just the ones you want. obsessed. π
π AUTHOR π
Christian Hansen chansen@cpan.org β the icon, the legend, the moment. π
πΈ 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. free as in freedom, bestie. ποΈ
okay that's the whole page, i love her, i love you, go adjust some dates. mwah. π π
this was Time::M...djusters(3) from the User Contributed Perl Documentation, perl v5.42.0, dated 2026-01-21. bye bestie, drink water. π«Ά
π¦ where this page comes from
- fedora 43: perl-Time-Moment 0.46-1.fc43 Β· (GPL-1.0-or-later OR Artistic-1.0-Perl) AND LicenseRef-Callaway-BSD
- fedora 44: perl-Time-Moment 0.46-1.fc44 Β· (GPL-1.0-or-later OR Artistic-1.0-Perl) AND LicenseRef-Callaway-BSD
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms