Commit f264250f authored by Fedor Ezeev's avatar Fedor Ezeev Committed by Gervase Markham

Bug 978635: now is interpreted as midnight for searches. r=gerv, a=simon.

parent 8ab6357c
......@@ -2206,11 +2206,15 @@ sub _date_translate {
sub SqlifyDate {
my ($str) = @_;
my $fmt = "%Y-%m-%d %H:%M:%S";
$str = "" if (!defined $str || lc($str) eq 'now');
$str = "" if (!defined $str);
if ($str eq "") {
my ($sec, $min, $hour, $mday, $month, $year, $wday) = localtime(time());
return sprintf("%4d-%02d-%02d 00:00:00", $year+1900, $month+1, $mday);
}
if (lc($str) eq 'now') {
my ($sec, $min, $hour, $mday, $month, $year, $wday) = localtime(time());
return sprintf("%4d-%02d-%02d %02d:%02d:%02d", $year+1900, $month+1, $mday, $hour, $min, $sec);
}
if ($str =~ /^(-|\+)?(\d+)([hdwmy])(s?)$/i) { # relative date
my ($sign, $amount, $unit, $startof, $date) = ($1, $2, lc $3, lc $4, time);
......
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