]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 978635: now is interpreted as midnight for searches. r=gerv, a=simon.
authorFedor Ezeev <fezeev@gmail.com>
Thu, 11 Dec 2014 18:06:22 +0000 (18:06 +0000)
committerGervase Markham <gerv@gerv.net>
Thu, 11 Dec 2014 18:06:22 +0000 (18:06 +0000)
Bugzilla/Search.pm

index 0395d08eefb8331a8f2e8db582b861c4c45449ce..80de76311d6819f637878e5dc236bc352f9cd7b4 100644 (file)
@@ -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);