summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2012-04-12 20:43:31 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2012-04-12 20:43:31 +0200
commit920c007392dbadbb05fff9521dfcab3871435d35 (patch)
tree3c042a52387a8ebec16a3ed1592d382d5df80a4e
parent5bb875b887b0d895b9a2146f7ceebf0f52b4ab86 (diff)
downloadbugzilla-920c007392dbadbb05fff9521dfcab3871435d35.tar.gz
bugzilla-920c007392dbadbb05fff9521dfcab3871435d35.tar.xz
Bug 737436: Relative dates do not work correctly with the deadline field
r=dkl a=LpSolit
-rw-r--r--Bugzilla/Search.pm16
1 files changed, 11 insertions, 5 deletions
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm
index d349a31ae..5c1a8c7ba 100644
--- a/Bugzilla/Search.pm
+++ b/Bugzilla/Search.pm
@@ -1936,16 +1936,22 @@ sub _timestamp_translate {
my $value = $args->{value};
my $dbh = Bugzilla->dbh;
- return if $value !~ /^[\+\-]?\d+[hdwmy]s?$/i;
-
- $args->{value} = SqlifyDate($value);
- $args->{quoted} = $dbh->quote($args->{value});
+ return if $value !~ /^(?:[\+\-]?\d+[hdwmy]s?|now)$/i;
+
+ # By default, the time is appended to the date, which we don't want
+ # for deadlines.
+ $value = SqlifyDate($value);
+ if ($args->{field} eq 'deadline') {
+ ($value) = split(/\s/, $value);
+ }
+ $args->{value} = $value;
+ $args->{quoted} = $dbh->quote($value);
}
sub SqlifyDate {
my ($str) = @_;
my $fmt = "%Y-%m-%d %H:%M:%S";
- $str = "" if !defined $str;
+ $str = "" if (!defined $str || lc($str) eq 'now');
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);