Commit 920c0073 authored by Frédéric Buclin's avatar Frédéric Buclin

Bug 737436: Relative dates do not work correctly with the deadline field

r=dkl a=LpSolit
parent 5bb875b8
......@@ -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);
......
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