From 52830ea6056dc85d8ffcb0cfb7ead7d70624e109 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Tue, 10 Sep 2013 23:37:10 +0200 Subject: Improve handling of date strings and DateTime values in contacts --- program/steps/addressbook/save.inc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'program/steps/addressbook/save.inc') diff --git a/program/steps/addressbook/save.inc b/program/steps/addressbook/save.inc index 1628f5b0f..2adc53bcf 100644 --- a/program/steps/addressbook/save.inc +++ b/program/steps/addressbook/save.inc @@ -77,6 +77,16 @@ foreach ($GLOBALS['CONTACT_COLTYPES'] as $col => $colprop) { } else if (isset($_POST[$fname])) { $a_record[$col] = get_input_value($fname, RCUBE_INPUT_POST, true); + + // normalize the submitted date strings + if ($colprop['type'] == 'date') { + if ($timestamp = rcube_utils::strtotime($a_record[$col])) { + $a_record[$col] = date('Y-m-d', $timestamp); + } + else { + unset($a_record[$col]); + } + } } } -- cgit v1.2.3