mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-28 04:02:12 +00:00
fix events with rrule byweekday
This commit is contained in:
parent
ca906c4b36
commit
032f7ac299
@ -333,9 +333,12 @@ const CalendarUtils = {
|
|||||||
// 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) {
|
||||||
if (dh < Math.abs(dateoffset / 60)) {
|
if (dh < Math.abs(dateoffset / 60)) {
|
||||||
|
// if the rrule byweekday WAS explicitly set , correct it
|
||||||
// reduce the time by the offset
|
// reduce the time by the offset
|
||||||
|
if(curEvent.rrule.origOptions.byweekday !== undefined){
|
||||||
// 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(24 * 60) * 60000);
|
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..
|
// 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;
|
||||||
@ -346,8 +349,13 @@ const CalendarUtils = {
|
|||||||
//if (event.start.tz === moment.tz.guess()) {
|
//if (event.start.tz === moment.tz.guess()) {
|
||||||
// if the date hour is less than the offset
|
// if the date hour is less than the offset
|
||||||
if (24 - dh <= Math.abs(dateoffset / 60)) {
|
if (24 - dh <= Math.abs(dateoffset / 60)) {
|
||||||
|
// if the rrule byweekday WAS explicitly set , correct it
|
||||||
|
if(curEvent.rrule.origOptions.byweekday !== undefined){
|
||||||
|
if(curEvent.rrule.origOptions.byweekday !== undefined){
|
||||||
// apply the correction to the date/time back to right day
|
// apply the correction to the date/time back to right day
|
||||||
date = new Date(date.getTime() + Math.abs(24 * 60) * 60000);
|
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..
|
// 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;
|
||||||
@ -361,9 +369,12 @@ const CalendarUtils = {
|
|||||||
if (dateoffset < 0) {
|
if (dateoffset < 0) {
|
||||||
// if the date hour is less than the offset
|
// if the date hour is less than the offset
|
||||||
if (dh <= Math.abs(dateoffset / 60)) {
|
if (dh <= Math.abs(dateoffset / 60)) {
|
||||||
// Reduce the time by the offset:
|
// if the rrule byweekday WAS explicitly set , correct it
|
||||||
|
if(curEvent.rrule.origOptions.byweekday !== undefined){
|
||||||
|
// Reduce the time by t:
|
||||||
// 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(24 * 60) * 60000);
|
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..
|
// 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;
|
||||||
@ -374,8 +385,11 @@ const CalendarUtils = {
|
|||||||
//if (event.start.tz === moment.tz.guess()) {
|
//if (event.start.tz === moment.tz.guess()) {
|
||||||
// if the date hour is less than the offset
|
// if the date hour is less than the offset
|
||||||
if (24 - dh <= Math.abs(dateoffset / 60)) {
|
if (24 - dh <= Math.abs(dateoffset / 60)) {
|
||||||
|
// if the rrule byweekday WAS explicitly set , correct it
|
||||||
|
if(curEvent.rrule.origOptions.byweekday !== undefined){
|
||||||
// apply the correction to the date/time back to right day
|
// apply the correction to the date/time back to right day
|
||||||
date = new Date(date.getTime() + Math.abs(24 * 60) * 60000);
|
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..
|
// 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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user