mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
refix #2483 , recurring FULL Day event, start date before 2007
This commit is contained in:
parent
cccaa1f33d
commit
d11e4e5c92
@ -63,6 +63,7 @@ _This release is scheduled to be released on 2021-04-01._
|
|||||||
- Fix weather module openweathermap not loading if lat and lon set without onecall.
|
- Fix weather module openweathermap not loading if lat and lon set without onecall.
|
||||||
- Fix calendar daylight savings offset calculation if recurring start date before 2007
|
- Fix calendar daylight savings offset calculation if recurring start date before 2007
|
||||||
- Fix calendar time/date adjustment when time with GMT offset is different day (#2488)
|
- Fix calendar time/date adjustment when time with GMT offset is different day (#2488)
|
||||||
|
- Fix calendar daylight savings offset calculation if recurring FULL DAY start date before 2007 (#2483)
|
||||||
|
|
||||||
## [2.14.0] - 2021-01-01
|
## [2.14.0] - 2021-01-01
|
||||||
|
|
||||||
|
@ -300,29 +300,43 @@ const CalendarUtils = {
|
|||||||
// this will be the correction we need to apply
|
// this will be the correction we need to apply
|
||||||
let nowOffset = new Date().getTimezoneOffset();
|
let nowOffset = new Date().getTimezoneOffset();
|
||||||
// for full day events, the time might be off from RRULE/Luxon problem
|
// for full day events, the time might be off from RRULE/Luxon problem
|
||||||
|
// get time zone offset of the rule calculated event
|
||||||
|
let dateoffset = date.getTimezoneOffset();
|
||||||
|
// reduce the time by the offset
|
||||||
|
Log.debug(" recurring date is " + date + " offset is " + dateoffset);
|
||||||
|
let dh = moment(date).format("HH");
|
||||||
|
Log.debug(" recurring date is " + date + " offset is " + dateoffset / 60 + " Hour is " + dh);
|
||||||
if (CalendarUtils.isFullDayEvent(event)) {
|
if (CalendarUtils.isFullDayEvent(event)) {
|
||||||
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 (date.getTimezoneOffset() < 0) {
|
if (dateoffset < 0) {
|
||||||
Log.debug("now offset is " + nowOffset);
|
// if the date hour is less than the offset
|
||||||
// reduce the time by the offset
|
if (dh < Math.abs(dateoffset / 60)) {
|
||||||
Log.debug(" recurring date is " + date + " offset is " + date.getTimezoneOffset());
|
// reduce the time by the offset
|
||||||
// apply the correction to the date/time to get it UTC relative
|
Log.debug(" recurring date is " + date + " offset is " + dateoffset);
|
||||||
date = new Date(date.getTime() - Math.abs(nowOffset) * 60000);
|
// apply the correction to the date/time to get it UTC relative
|
||||||
// the duration was calculated way back at the top before we could correct the start time..
|
date = new Date(date.getTime() - Math.abs(nowOffset) * 60000);
|
||||||
// fix it for this event entry
|
// the duration was calculated way back at the top before we could correct the start time..
|
||||||
duration = 24 * 60 * 60 * 1000;
|
// fix it for this event entry
|
||||||
Log.debug("new recurring date is " + date);
|
//duration = 24 * 60 * 60 * 1000;
|
||||||
|
Log.debug("new recurring date1 is " + date);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// if the timezones are the same, correct date if needed
|
||||||
|
if (event.start.tz === moment.tz.guess()) {
|
||||||
|
// if the date hour is less than the offset
|
||||||
|
if (24 - dh < Math.abs(dateoffset / 60)) {
|
||||||
|
// apply the correction to the date/time back to right day
|
||||||
|
date = new Date(date.getTime() + Math.abs(24 * 60) * 60000);
|
||||||
|
// the duration was calculated way back at the top before we could correct the start time..
|
||||||
|
// fix it for this event entry
|
||||||
|
//duration = 24 * 60 * 60 * 1000;
|
||||||
|
Log.debug("new recurring date2 is " + date);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// not full day, but luxon can still screw up the date on the rule processing
|
// not full day, but luxon can still screw up the date on the rule processing
|
||||||
// get time zone offset of the rule calculated event
|
|
||||||
let dateoffset = date.getTimezoneOffset();
|
|
||||||
// reduce the time by the offset
|
|
||||||
Log.debug(" recurring date is " + date + " offset is " + dateoffset);
|
|
||||||
let dh = moment(date).format("HH");
|
|
||||||
Log.debug(" recurring date is " + date + " offset is " + dateoffset / 60 + " Hour is " + dh);
|
|
||||||
|
|
||||||
// we need to correct the date to get back to the right event for
|
// we need to correct the date to get back to the right event for
|
||||||
if (dateoffset < 0) {
|
if (dateoffset < 0) {
|
||||||
// if the date hour is less than the offset
|
// if the date hour is less than the offset
|
||||||
@ -337,14 +351,17 @@ const CalendarUtils = {
|
|||||||
Log.debug("new recurring date1 is " + date);
|
Log.debug("new recurring date1 is " + date);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// if the date hour is less than the offset
|
// if the timezones are the same, correct date if needed
|
||||||
if (24 - dh < Math.abs(dateoffset / 60)) {
|
if (event.start.tz === moment.tz.guess()) {
|
||||||
// apply the correction to the date/time back to right day
|
// if the date hour is less than the offset
|
||||||
date = new Date(date.getTime() + Math.abs(24 * 60) * 60000);
|
if (24 - dh < Math.abs(dateoffset / 60)) {
|
||||||
// the duration was calculated way back at the top before we could correct the start time..
|
// apply the correction to the date/time back to right day
|
||||||
// fix it for this event entry
|
date = new Date(date.getTime() + Math.abs(24 * 60) * 60000);
|
||||||
//duration = 24 * 60 * 60 * 1000;
|
// the duration was calculated way back at the top before we could correct the start time..
|
||||||
Log.debug("new recurring date2 is " + date);
|
// fix it for this event entry
|
||||||
|
//duration = 24 * 60 * 60 * 1000;
|
||||||
|
Log.debug("new recurring date2 is " + date);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user