From 7cafc2fd9c693fe68c8faf4b19302fd82fbbd9c7 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 8 Sep 2014 11:38:23 +0000 Subject: [PATCH] * eTemplate2/all apps: fixed not displayed readonly dates outside lists (eg. created/modified dates in dialogs) --- etemplate/js/et2_widget_date.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/etemplate/js/et2_widget_date.js b/etemplate/js/et2_widget_date.js index ea702d9a38..df73856eb8 100644 --- a/etemplate/js/et2_widget_date.js +++ b/etemplate/js/et2_widget_date.js @@ -735,7 +735,7 @@ var et2_date_ro = et2_valueWidget.extend([et2_IDetachedDOM], */ attributes: { "value": { - "type": "integer" + "type": "string" }, "type": { "ignore": false @@ -781,7 +781,12 @@ var et2_date_ro = et2_valueWidget.extend([et2_IDetachedDOM], return; } - if(typeof _value == 'string' && isNaN(_value)) + if(typeof _value == 'string' && _value.match(/(\d{4})-(\d{2})-(\d{2})T(\d{2})\:(\d{2})\:(\d{2})(?:\.\d{3})?(?:Z|[+-](\d{2})\:(\d{2}))/)) + { + this.date = new Date(_value); + this.date = new Date(this.date.valueOf() + (this.date.getTimezoneOffset()*60*1000)) + } + else if(typeof _value == 'string' && isNaN(_value)) { // parseDateTime to handle string PHP: DateTime local date/time format var parsed = (typeof jQuery.datepicker.parseDateTime("yy-mm-dd","hh:mm:ss", _value) !='undefined')?