From df83b4dbbeacb6a50ba390e34cbd5c47a30b0598 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 27 Aug 2014 16:57:22 +0000 Subject: [PATCH] an other timezone fix for time(only) widget: this.date is on current date, changing it in get_value() to 1970-01-01, gives a time-difference, if we are currently on DST --- etemplate/js/et2_widget_date.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/etemplate/js/et2_widget_date.js b/etemplate/js/et2_widget_date.js index dd0edf3701..9bc490eee2 100644 --- a/etemplate/js/et2_widget_date.js +++ b/etemplate/js/et2_widget_date.js @@ -154,6 +154,10 @@ var et2_date = et2_inputWidget.extend( return; } this.set_validation_error(false); + // this.date is on current date, changing it in get_value() to 1970-01-01, gives a time-difference, if we are currently on DST + this.date.setDate(1); + this.date.setMonth(0); + this.date.setFullYear(1970); // Avoid javascript timezone offset, hour is in 'user time' this.date.setUTCHours(parsed.hour); this.date.setMinutes(parsed.minute); @@ -259,7 +263,7 @@ var et2_date = et2_inputWidget.extend( this.date.setUTCHours(0); this.date.setUTCMinutes(0); } - + // Convert to timestamp - no seconds this.date.setSeconds(0,0); return this.date.toJSON();