diff --git a/etemplate/inc/class.etemplate_widget_date.inc.php b/etemplate/inc/class.etemplate_widget_date.inc.php index c20f0a1978..d7ada97738 100644 --- a/etemplate/inc/class.etemplate_widget_date.inc.php +++ b/etemplate/inc/class.etemplate_widget_date.inc.php @@ -46,8 +46,8 @@ class etemplate_widget_date extends etemplate_widget_transformer * @var string|array */ protected $legacy_options = 'dataformat,mode'; - - + + /** * Validate input * @@ -70,13 +70,9 @@ class etemplate_widget_date extends etemplate_widget_transformer { self::set_validation_error($form_name,lang('Field must not be empty !!!')); } - elseif (is_null($value)) - { - $valid = null; - } elseif ($this->type == 'date-duration') { - $valid = $value; + $valid = (string)$value === '' ? '' : (int)$value; } elseif (empty($this->attrs['dataformat'])) // integer timestamp { diff --git a/etemplate/js/et2_widget_date.js b/etemplate/js/et2_widget_date.js index eb1d1a539b..94878d5ed6 100644 --- a/etemplate/js/et2_widget_date.js +++ b/etemplate/js/et2_widget_date.js @@ -475,7 +475,7 @@ var et2_date_duration = et2_date.extend( var value = this.duration.val().replace(',', '.'); if(value === '') { - return this.options.empty_not_0 ? null : 0; + return this.options.empty_not_0 ? '' : 0; } // Put value into minutes for further processing switch(this.format ? this.format.val() : this.options.display_format)