From: djfiander Date: Mon, 22 Jun 2009 00:19:58 +0000 (+0000) Subject: Implement subsequent_month() to generate next publication month X-Git-Tag: sprint4-merge-nov22~9787 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=9aef6781398df7a8ac374d285d124f4ddd6878c3;p=working%2FEvergreen.git 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 --- 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 = @_;