Merge pull request #2697 from jupadin/fixTimeOffset

This commit is contained in:
Michael Teeuw 2021-10-20 15:20:22 +02:00 committed by GitHub
commit 66b2ba07bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 15 deletions

View File

@ -26,6 +26,7 @@ _This release is scheduled to be released on 2022-01-01._
- Fixed wrong file `kr.json` to `ko.json`. Use language code 'ko' instead of 'kr' for Korean language. - Fixed wrong file `kr.json` to `ko.json`. Use language code 'ko' instead of 'kr' for Korean language.
- Fixed `feels_like` data from openweathermaps current weather being ignored (#2678). - Fixed `feels_like` data from openweathermaps current weather being ignored (#2678).
- Fixed chaotic newsfeed display after network connection loss thanks to @jalibu (#2638). - Fixed chaotic newsfeed display after network connection loss thanks to @jalibu (#2638).
- Fixed incorrect time zone correction of recurring full day events (#2632 and #2634).
## [2.17.1] - 2021-10-01 ## [2.17.1] - 2021-10-01

View File

@ -160,7 +160,7 @@ const CalendarUtils = {
} }
if (event.type === "VEVENT") { if (event.type === "VEVENT") {
Log.debug("\nEvent: " + JSON.stringify(event)); Log.debug("Event:\n" + JSON.stringify(event));
let startDate = eventDate(event, "start"); let startDate = eventDate(event, "start");
let endDate; let endDate;
@ -177,8 +177,8 @@ const CalendarUtils = {
} }
} }
Log.debug("startDate (local): " + startDate.toDate()); Log.debug("start: " + startDate.toDate());
Log.debug("endDate (local): " + endDate.toDate()); Log.debug("end:: " + endDate.toDate());
// Calculate the duration of the event for use with recurring events. // Calculate the duration of the event for use with recurring events.
let duration = parseInt(endDate.format("x")) - parseInt(startDate.format("x")); let duration = parseInt(endDate.format("x")) - parseInt(startDate.format("x"));
@ -332,17 +332,15 @@ const CalendarUtils = {
Log.debug("Fullday"); Log.debug("Fullday");
// If the offset is negative (east of GMT), where the problem is // If the offset is negative (east of GMT), where the problem is
if (dateoffset < 0) { if (dateoffset < 0) {
// Remove the offset, independently of the comparison between the date hour and the offset, if (dh <= Math.abs(dateoffset / 60)) {
// since in the case that *date houre < offset*, the *new Date* command will handle this by // reduce the time by the offset
// representing the day before.
// Reduce the time by the offset:
// Apply the correction to the date/time to get it UTC relative // Apply the correction to the date/time to get it UTC relative
date = new Date(date.getTime() - Math.abs(nowOffset) * 60000); date = new Date(date.getTime() - Math.abs(dateoffset) * 60000);
// the duration was calculated way back at the top before we could correct the start time.. // the duration was calculated way back at the top before we could correct the start time..
// fix it for this event entry // fix it for this event entry
//duration = 24 * 60 * 60 * 1000; //duration = 24 * 60 * 60 * 1000;
Log.debug("new recurring date1 is " + date); Log.debug("new recurring date1 is " + date);
}
} else { } else {
// if the timezones are the same, correct date if needed // if the timezones are the same, correct date if needed
if (event.start.tz === moment.tz.guess()) { if (event.start.tz === moment.tz.guess()) {
@ -387,7 +385,7 @@ const CalendarUtils = {
} }
} }
startDate = moment(date); startDate = moment(date);
Log.debug("Corrected startDate (local): " + startDate.toDate()); Log.debug("Corrected startDate: " + startDate.toDate());
let adjustDays = CalendarUtils.calculateTimezoneAdjustment(event, date); let adjustDays = CalendarUtils.calculateTimezoneAdjustment(event, date);