From cf96d4e82db142fc6dd98b49b078f29a3be0f0f7 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 7 Oct 2014 10:19:21 +0000 Subject: [PATCH] do not convert empty values, otherwise we will get current date or 1970-01-01 instead --- etemplate/inc/class.etemplate_widget_date.inc.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/etemplate/inc/class.etemplate_widget_date.inc.php b/etemplate/inc/class.etemplate_widget_date.inc.php index 3939d4d414..a8807cf7f4 100644 --- a/etemplate/inc/class.etemplate_widget_date.inc.php +++ b/etemplate/inc/class.etemplate_widget_date.inc.php @@ -65,7 +65,7 @@ class etemplate_widget_date extends etemplate_widget_transformer $form_name = self::form_name($cname, $this->id, $expand); $value =& self::get_array(self::$request->content, $form_name, false, true); - + if($this->type != 'date-duration' && $value) { $value = $this->format_date($value); @@ -101,6 +101,8 @@ class etemplate_widget_date extends etemplate_widget_transformer */ public function format_date($value) { + if (!$value) return $value; // otherwise we will get current date or 1970-01-01 instead of an empty value + if ($this->attrs['dataformat'] && !is_numeric($value)) { $date = date_create_from_format($this->attrs['dataformat'], $value, egw_time::$user_timezone); @@ -120,7 +122,7 @@ class etemplate_widget_date extends etemplate_widget_transformer } return $value; } - + /** * Validate input *