Bug 1112181: Relative dates in the future involving months are incorrectly converted

r=dylan a=glob


git-svn-id: svn://10.0.0.236/trunk@265811 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bzrmirror%bugzilla.org 2015-02-17 20:45:53 +00:00
parent 9f87a8d813
commit d4df00dc66
3 changed files with 5 additions and 4 deletions

View File

@ -1 +1 @@
9295 9296

View File

@ -1 +1 @@
077949ad0423d2446f2dff331fb5c44ee87c449a 9f76caa9e3493c2df055bed736463659770c0798

View File

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