From 098de471cd6b5a5dfd1a95ad4595ff1f1b5e7352 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Mon, 5 May 2014 14:11:00 +0000 Subject: [PATCH] No need to overwrite the "beforeSendToClient" method for date widget, because we are handling date/time conversion on client side --- .../inc/class.etemplate_widget_date.inc.php | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/etemplate/inc/class.etemplate_widget_date.inc.php b/etemplate/inc/class.etemplate_widget_date.inc.php index a54f812abe..c20f0a1978 100644 --- a/etemplate/inc/class.etemplate_widget_date.inc.php +++ b/etemplate/inc/class.etemplate_widget_date.inc.php @@ -29,6 +29,10 @@ * &128 = no icon to trigger popup, click into input trigers it, also removing the separators to save space * * @todo validation of date-duration + * + * @info beforeSendToClient is no longer neccessary, in order to handle date/time conversion, for this widget + * as we are handling both timestamp and string date/time formats on client side + * */ class etemplate_widget_date extends etemplate_widget_transformer { @@ -42,21 +46,8 @@ class etemplate_widget_date extends etemplate_widget_transformer * @var string|array */ protected $legacy_options = 'dataformat,mode'; - - /** - * Change value to be an integer - client side only deals in timestamps - */ - public function beforeSendToClient($cname) - { - $form_name = self::form_name($cname, $this->id); - $value =& self::get_array(self::$request->content, $form_name, true); - if ($value && !empty($this->attrs['dataformat'])) // Non-integer timestamp - { - $date = DateTime::createFromFormat($this->attrs['dataformat'], $value); - if($date) $value = $date->getTimestamp(); - } - } - + + /** * Validate input * @@ -109,4 +100,3 @@ class etemplate_widget_date extends etemplate_widget_transformer } } } -new jscalendar();