undef and empty string default to now for WebGUI::DateTime construction.
This commit is contained in:
parent
6a754ffc43
commit
eceeff448a
2 changed files with 24 additions and 21 deletions
|
|
@ -137,9 +137,11 @@ sub new
|
|||
|
||||
#use Data::Dumper;
|
||||
#warn "Args to DateTime->new: ".Dumper \@_;
|
||||
|
||||
if (@_ > 1 && grep /^mysql$/, @_)
|
||||
{
|
||||
|
||||
if (! scalar(@_) || $_[0] eq '') {
|
||||
$self = $class->SUPER::now();
|
||||
}
|
||||
elsif (@_ > 1 && grep /^mysql$/, @_) {
|
||||
my %hash = @_;
|
||||
$hash{time_zone} ||= "UTC";
|
||||
my $string = delete $hash{mysql};
|
||||
|
|
@ -149,12 +151,10 @@ sub new
|
|||
|
||||
$self = $class->SUPER::new(%hash);
|
||||
}
|
||||
elsif (@_ > 1)
|
||||
{
|
||||
elsif (@_ > 1) {
|
||||
$self = $class->SUPER::new(@_);
|
||||
}
|
||||
elsif ($_[0] =~ /^-?\d+$/)
|
||||
{
|
||||
elsif ($_[0] =~ /^-?\d+$/) {
|
||||
$self = DateTime->from_epoch(epoch=>$_[0], time_zone=>"UTC", locale=>$locale);
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue