From b4c5ed1af358ce52e9c1413ead836e4a371094d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Buclin?= Date: Tue, 17 Feb 2015 21:28:03 +0100 Subject: Bug 1112181: Relative dates in the future involving months are incorrectly converted r=dylan a=glob --- Bugzilla/Search.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index 0395d08ee..4c24dc6fd 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -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); } -- cgit v1.2.1