]> 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:28:03 +0000 (21:28 +0100)
committerFrédéric Buclin <LpSolit@gmail.com>
Tue, 17 Feb 2015 20:28:03 +0000 (21:28 +0100)
r=dylan a=glob

Bugzilla/Search.pm

index 0395d08eefb8331a8f2e8db582b861c4c45449ce..4c24dc6fd550e62ded81180460a68e8774f7261c 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);
 
@@ -2241,7 +2241,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);
             }