From 452b7c98e1039d2d16f3b3e36f270c28a504bc51 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Tue, 18 Oct 2011 16:33:41 +0000 Subject: [PATCH] Fix typo, accept null values --- etemplate/inc/class.etemplate_widget_date.inc.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/etemplate/inc/class.etemplate_widget_date.inc.php b/etemplate/inc/class.etemplate_widget_date.inc.php index 6d2d926c39..ae456bd06b 100644 --- a/etemplate/inc/class.etemplate_widget_date.inc.php +++ b/etemplate/inc/class.etemplate_widget_date.inc.php @@ -69,14 +69,15 @@ class etemplate_widget_date extends etemplate_widget_transformer $valid = (int)$value; } // string with formatting letters like for php's date() method - elseif (($obs = DateTime::createFromFormat($this->attrs['dataformat'], $value))) + elseif (($obj = DateTime::createFromFormat($this->attrs['dataformat'], $value))) { $valid = $obj->format($this->attrs['dataformat']); } - else + // Null is acceptable also + elseif ($value !== null) { // this is not really a user error, but one of the clientside engine - self::set_validation_error($name,lang("'%1' is not a valid date !!!", $value).' '.$this->dataformat); + self::set_validation_error($form_name,lang("'%1' is not a valid date !!!", $value).' '.$this->dataformat); } } }