From 739d2406bc5822ac41fa807bd12847e08cbe60ca Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Tue, 26 Aug 2014 13:45:36 +0000 Subject: [PATCH] Backport commit r48260, committed by Nathan Gray. Even more date fixes: - Don't send a date (just 1970-01-01) with timeonly values - Avoid infinite loop when setting timeonly with timepicker --- etemplate/inc/class.etemplate_widget_date.inc.php | 4 ++++ etemplate/js/et2_widget_date.js | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/etemplate/inc/class.etemplate_widget_date.inc.php b/etemplate/inc/class.etemplate_widget_date.inc.php index 68ea86a57a..97fc0c7a80 100644 --- a/etemplate/inc/class.etemplate_widget_date.inc.php +++ b/etemplate/inc/class.etemplate_widget_date.inc.php @@ -74,6 +74,10 @@ class etemplate_widget_date extends etemplate_widget_transformer { $date = new egw_time((int)$value, new DateTimeZone('UTC')); } + if($this->type == 'date-timeonly') + { + $date->setDate(1970, 1, 1); + } if($date) { // Set timezone to UTC so javascript doesn't add/subtract anything diff --git a/etemplate/js/et2_widget_date.js b/etemplate/js/et2_widget_date.js index f7888c1e5e..11f2359c37 100644 --- a/etemplate/js/et2_widget_date.js +++ b/etemplate/js/et2_widget_date.js @@ -157,9 +157,9 @@ var et2_date = et2_inputWidget.extend( // Avoid javascript timezone offset, hour is in 'user time' this.date.setUTCHours(parsed.hour); this.date.setMinutes(parsed.minute); - this.input_date.val(_value); - if(old_value !== this.getValue()) + if(this.input_date.val() != _value) { + this.input_date.val(_value); this.input_date.timepicker('setTime',_value); if (this._oldValue !== et2_no_init) {