[open-ils-commits] r19166 - trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD (senator)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Jan 12 10:52:39 EST 2011


Author: senator
Date: 2011-01-12 10:52:37 -0500 (Wed, 12 Jan 2011)
New Revision: 19166

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Date.pm
Log:
Revert r19162 for now, pending further conversation in #Evergreen
about the right way to address this.


Modified: trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Date.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Date.pm	2011-01-12 14:37:52 UTC (rev 19165)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Utils/MFHD/Date.pm	2011-01-12 15:52:37 UTC (rev 19166)
@@ -167,7 +167,7 @@
         );
     } 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 @@
     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)
+                )
+              )
         );
     }
 



More information about the open-ils-commits mailing list