Skip to content

Commit 6f4add6

Browse files
author
wyrie
committed
Added support for datetime form encoding
1 parent 887ceb6 commit 6f4add6

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

interface/lib/classes/remoting_lib.inc.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,18 @@ function encode($record) {
325325
case 'CURRENCY':
326326
$new_record[$key] = str_replace(",",".",$record[$key]);
327327
break;
328+
329+
case 'DATETIME':
330+
if (is_array($record[$key]))
331+
{
332+
$filtered_values = array_map(create_function('$item','return (int)$item;'), $record[$key]);
333+
extract($filtered_values, EXTR_PREFIX_ALL, '_dt');
334+
335+
if ($_dt_day != 0 && $_dt_month != 0 && $_dt_year != 0) {
336+
$new_record[$key] = date( 'Y-m-d H:i:s', mktime($_dt_hour, $_dt_minute, $_dt_second, $_dt_month, $_dt_day, $_dt_year) );
337+
}
338+
}
339+
break;
328340
}
329341

330342
// The use of the field value is deprecated, use validators instead

0 commit comments

Comments
 (0)