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

Bugzilla/Search.pm

index eaab6002e66e80cb8121421860dae93d86e5d74e..acf458e8b6a9ec2bbc7a24f068f0c3bc2817b7a4 100644 (file)
@@ -31,7 +31,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);
 
@@ -2129,7 +2129,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);
             }