From 9aef6781398df7a8ac374d285d124f4ddd6878c3 Mon Sep 17 00:00:00 2001 From: djfiander Date: Mon, 22 Jun 2009 00:19:58 +0000 Subject: [PATCH] Implement subsequent_month() to generate next publication month based on $yp publication pattern. Somehow I missed this on the first pass. git-svn-id: svn://svn.open-ils.org/ILS/trunk@13427 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Date.pm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Date.pm b/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Date.pm index 07715239b6..0180cd3da0 100644 --- a/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Date.pm +++ b/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Date.pm @@ -324,6 +324,22 @@ sub match_month { return ($pat eq $date[1]); } +sub subsequent_month { + my $pat = shift; + my @cur = @_; + + if ($cur[1] >= $pat) { + # Current date is on or after the patter date, so the next + # occurence is next year + $cur[0] += 1; + } + + # The year is right, just set the month to the pattern date. + $cur[1] = $pat; + + return @cur; +} + sub match_season { my $pat = shift; my @date = @_; -- 2.11.0