Index: branches/5.3.x/core/kernel/utility/formatters/date_formatter.php =================================================================== diff -u -N -r15928 -r16395 --- branches/5.3.x/core/kernel/utility/formatters/date_formatter.php (.../date_formatter.php) (revision 15928) +++ branches/5.3.x/core/kernel/utility/formatters/date_formatter.php (.../date_formatter.php) (revision 16395) @@ -1,6 +1,6 @@ GetFieldOptions($field_name); + + if ( is_null($value) ) { + if ( $format != 'picker' || !isset($options['picker_default']) ) { + return ''; + } + + $value = strtotime($options['picker_default']); + } + + if ( $format == 'picker' ) { + $format = '_input_'; + } + if ( !is_numeric($value) ) { return $value; // for leaving badly formatted date on the form } + settype($value, 'int'); + if ( !is_int($value) ) { return $value; } - $options = $object->GetFieldOptions($field_name); if ( isset($format) ) { $options['format'] = $format; } - if (preg_match('/_regional_(.*)/', $options['format'], $regs)) { + if ( preg_match('/_regional_(.*)/', $options['format'], $regs) ) { // when such type of format is given directly to kDBBase::GetField $options['format'] = $this->language->GetDBField($regs[1]); } - if ($options['format'] == '_input_') { + if ( $options['format'] == '_input_' ) { // use input format instead of output format $options['format'] = $options['input_format']; } - if (!$options['use_timezone']) { + if ( !$options['use_timezone'] ) { return gmdate($options['format'], $value); } $format = defined($options['format']) ? constant($options['format']) : $options['format']; $dt_separator = getArrayValue($options, 'date_time_separator'); - if ($dt_separator) { + if ( $dt_separator ) { $format = trim($format, $dt_separator); } @@ -506,4 +521,4 @@ { return $this->Format( time(), $field, $object, $options['input_format']); } -} \ No newline at end of file +}