From 211d2b66ec5a42e40252209f07019d2543411363 Mon Sep 17 00:00:00 2001 From: senator Date: Wed, 12 Jan 2011 15:52:37 +0000 Subject: [PATCH] Revert r19162 for now, pending further conversation in #Evergreen about the right way to address this. git-svn-id: svn://svn.open-ils.org/ILS/trunk@19166 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Date.pm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Date.pm b/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Date.pm index 1a1f4cdab1..34c85d9691 100644 --- a/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Date.pm +++ b/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Date.pm @@ -167,7 +167,7 @@ sub nth_week_of_month { ); } else { # count backwards - $nth_day->subtract(days => ($dow - $day + 7) % 7); + $nth_day->subtract(days => ($day - $dow + 7) % 7); # 99: last week of month, 98: second last, etc. for (my $i = 99 - $week; $i > 0; $i--) { @@ -196,10 +196,15 @@ sub check_date { if (!defined $day) { # MMWW return ( - ($dt->month == $month) && ( - $dt->week_of_month == - nth_week_of_month($dt, $weekno, $day)->week_of_month - ) + ($dt->month == $month) + && ( + ($dt->week_of_month == $weekno) + || ( + $weekno >= 97 + && ($dt->week_of_month == + nth_week_of_month($dt, $weekno, $day)->week_of_month) + ) + ) ); } -- 2.11.0