Index: branches/5.2.x/core/kernel/utility/formatters/date_formatter.php
===================================================================
diff -u -N -r15137 -r16367
--- branches/5.2.x/core/kernel/utility/formatters/date_formatter.php (.../date_formatter.php) (revision 15137)
+++ branches/5.2.x/core/kernel/utility/formatters/date_formatter.php (.../date_formatter.php) (revision 16367)
@@ -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 adodb_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( adodb_mktime(), $field, $object, $options['input_format']);
}
-}
\ No newline at end of file
+}
Index: branches/5.2.x/core/admin_templates/incs/form_blocks.tpl
===================================================================
diff -u -N -r16339 -r16367
--- branches/5.2.x/core/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 16339)
+++ branches/5.2.x/core/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 16367)
@@ -445,7 +445,7 @@
title="Date selector"
/>
()
-
+