]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1112181: Relative dates in the future involving months are incorrectly converted
authorFrédéric Buclin <LpSolit@gmail.com>
Tue, 17 Feb 2015 20:26:38 +0000 (21:26 +0100)
committerFrédéric Buclin <LpSolit@gmail.com>
Tue, 17 Feb 2015 20:26:38 +0000 (21:26 +0100)
r=dylan a=glob

Bugzilla/Search.pm

index 80de76311d6819f637878e5dc236bc352f9cd7b4..d712d4bb665564727921cad0a7aabbe37a3c8cd7 100644 (file)
@@ -34,7 +34,7 @@ use Date::Format;
 use Date::Parse;
 use Scalar::Util qw(blessed);
 use List::MoreUtils qw(all firstidx part uniq);
-use POSIX qw(INT_MAX);
+use POSIX qw(INT_MAX floor);
 use Storable qw(dclone);
 use Time::HiRes qw(gettimeofday tv_interval);
 
@@ -2245,7 +2245,8 @@ sub SqlifyDate {
         }
         elsif ($unit eq 'm') {
             $month -= $amount;
-            while ($month<0) { $year--; $month += 12; }
+            $year += floor($month/12);
+            $month %= 12;
             if ($startof) {
                 return sprintf("%4d-%02d-01 00:00:00", $year+1900, $month+1);
             }