Commit 24b471d6 authored by Frédéric Buclin's avatar Frédéric Buclin

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

r=dylan a=glob
parent d371e14e
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment