summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2012-04-12 20:44:59 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2012-04-12 20:44:59 +0200
commit8169d04e9c85cde59e030bfb665f5e1c065e9c1a (patch)
tree332991fc154b143ecc6e4a0d2ceec725cc9666c5 /Bugzilla
parent978956aeeeabf9adbe0825d7b547bc570819c23a (diff)
downloadbugzilla-8169d04e9c85cde59e030bfb665f5e1c065e9c1a.tar.gz
bugzilla-8169d04e9c85cde59e030bfb665f5e1c065e9c1a.tar.xz
Bug 737436: Relative dates do not work correctly with the deadline field
r=dkl a=LpSolit
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Search.pm16
1 files changed, 11 insertions, 5 deletions
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm
index 03242ae83..2ea4b1ae1 100644
--- a/Bugzilla/Search.pm
+++ b/Bugzilla/Search.pm
@@ -1924,16 +1924,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);