Commit 9ba963d1 authored by myk%mozilla.org's avatar myk%mozilla.org

Fix for bug 217029: creates appropriate date string if string is empty now that…

Fix for bug 217029: creates appropriate date string if string is empty now that Date::Parse 2.27 doesn't do it for us auto-magically. r=justdave a=justdave
parent 36b4d0d3
...@@ -974,6 +974,10 @@ sub init { ...@@ -974,6 +974,10 @@ sub init {
sub SqlifyDate { sub SqlifyDate {
my ($str) = @_; my ($str) = @_;
$str = "" if !defined $str; $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 ($str =~ /^-?(\d+)([dDwWmMyY])$/) { # relative date if ($str =~ /^-?(\d+)([dDwWmMyY])$/) { # relative date
my ($amount, $unit, $date) = ($1, lc $2, time); my ($amount, $unit, $date) = ($1, lc $2, time);
my ($sec, $min, $hour, $mday, $month, $year, $wday) = localtime($date); my ($sec, $min, $hour, $mday, $month, $year, $wday) = localtime($date);
......
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