From 17577d852ba7f7beb30d753e0e5eddaf51dcb138 Mon Sep 17 00:00:00 2001 From: Danny van Kooten Date: Tue, 30 Oct 2018 16:27:17 +0100 Subject: [PATCH] fix timezone issue for dates coming from pikaday, which are not taking wintertime into account somehow. relates to #134 --- assets/src/js/components/DatePicker.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/assets/src/js/components/DatePicker.js b/assets/src/js/components/DatePicker.js index d3dce202..652ceb9d 100644 --- a/assets/src/js/components/DatePicker.js +++ b/assets/src/js/components/DatePicker.js @@ -116,9 +116,8 @@ class DatePicker extends Component { // create unix timestamps from local date objects let before, after; - const timezoneOffset = (new Date()).getTimezoneOffset() * 60; - before = Math.round((+endDate) / 1000) - timezoneOffset; - after = Math.round((+startDate) / 1000) - timezoneOffset; + before = Math.round((+endDate) / 1000) - endDate.getTimezoneOffset() * 60; + after = Math.round((+startDate) / 1000) - startDate.getTimezoneOffset() * 60; this.setState({ period: period || '',