MagicMirrorOrg / MagicMirror

MagicMirror² is an open source modular smart mirror platform. With a growing list of installable modules, the MagicMirror² allows you to convert your hallway or bathroom mirror into your personal assistant.
http://magicmirror.builders
MIT License
19.76k stars 4.2k forks source link

Calendar: All items scheduled for one day late #1718

Closed Kugelfang666 closed 4 years ago

Kugelfang666 commented 5 years ago

lease only submit re When submitting a new issue, please supply the following information:

Platform: Raspberry Pi 2/3

MagicMirror Version: latest version pulled from git 2019-07-07

Description:

The calendar plugin shows items on wrong date. I'm connected to two iCloud calendars. An Item which is scheduled for tomorrow appears to be due for the day after tomorrow. All other plugins like the clock are showing correct date + time

Additional Notes: this problem occurred once I updated the installation. Previously I was running a version dating back to April. Problem occurred without touching the config.js

EDIT: I did some more digging and changed the timeFormat to "date headers" interestingly the plugin shows actually a wrong date. For example a item which is in the ical file for the 9th appears to be due on the 10th.

        {
            module: 'calendar',
            header: 'Kalender',
            position: 'top_left',
            config: {
                fade: false,
                showEnd: false,
                fullDayEventDateFormat:'DD MMM',
                maximumNumberOfDays: 31,
                timeFormat: 'absolute',
                calendars: [
                    {
                        symbol: 'star-o',
                        url: 'webcal://www.calendarlabs.com/templates/ical/Germany-Holidays.ics'
                    },
                    {
                        url: 'URL',
                        symbol: 'birthday-cake',
                        auth: {
                            user: 'USER',
                            pass: 'PW',
                            method: 'basic'
                        }
                    },
                    {
                        url: 'URL',
                        symbol: 'calendar-check-o',
                        auth: {
                            user: 'USER',
                            pass: 'PW',
                            method: 'basic'
                        }
                    },

                    ]
            }
        },
Kugelfang666 commented 5 years ago

For the record: I rolled back the default calendar plugin to the previous release (April) an the problem is solved. There seems to be something wrong with the latest release

Kugelfang666 commented 5 years ago

Unfortunately rolling back the calendar module created a new problem. Now the calendar gets stuck at one day. Hence after a fresh boot it correctly shows that a item is due „tomorrow“ but it does not change to „today“ at midnight. In fact the items displayed are stuck at the day of booting

MichMich commented 5 years ago

We did; t get any other reports of this issue. Have you checked if the timezone is correct?

Kugelfang666 commented 5 years ago

Hi, mhm actually I did, both in MM as well as via SSH in raspy-config...

With regards to the initial problem (one day lag): this was solved by rolling back to the previous version of the calendar module.

The second problem was actually my mistake: I set the module to a rather long fetch interval of twice a day to prevent my Synology which is hosting the calendars to wake up unnecessarily often. Could it be that the fetch interval also governs how often the time indications (tomorrow, today...) are being updated? After decreasing the setting the problem went away.

Maybe it would be worthwhile to introduce two separate values, one for how often the calendar is fetched from the server and a second for how often the interface is being updated.

stefsims commented 5 years ago

I also have this issue. All day events "today" are show as "tomorrow". This is only for recurring events. I made a single entry for today (all day, not recurring) and it showed "today". Using Google Calendar My config: { colored: true, maximumEntries: 5, maximumNumberOfDays: 3, timeFormat: 'absolute', showEnd: false, fullDayEventDateFormat: 'dddd', dateFormat: 'HH:mm ddd', dateEndFormat: 'HH:mm', urgency: 0, getRelative: 8,

magnuskonze commented 5 years ago

I also recognised this problem.

I'm new to the MagicMirror-Project (tried it this week for the first time), but i already played around with the code: In calendarfetcher.js line 187 (var dates = rule.between(past, future, true, limitFunction);) all dates are off by 2 hours. So line 228 (startDate = moment(date);) creates a wrong startDate. When i remove this line everything seems to work fine. I still don't understand why the date has to be recalculated here.

I noticed, that my google calendar has timezone GMT +2 (Berlin), while my raspberry has Europe/Berlin. Should be the same, but it feels like a timezone problem.

Perhaps this helps?

magnuskonze commented 5 years ago

My "fix" (removing line 228) doesn't work anymore. I can't reproduce the scenario anymore...

Anyway, the problem only occures with recurring fullday events. They are shown one day later. Recurring events with starting time respectively non-recurring fullday events are working fine.

Btw. those calendar rules seem to use UTC, correct? This would explain, while the dates in line 187 are 2 hours off in my case.

magnuskonze commented 5 years ago

I switched back to version 2.7.1 and now recurring fullday events seem to work for me.

Kugelfang666 commented 4 years ago

I just ran an full update on my MM and the issue reappeared. After rolling just the calendar module back tu 2.7.1. everything is working fine again.

ykuzmycz commented 4 years ago

@Kugelfang666 how do you roll back just the calendar module?

Kugelfang666 commented 4 years ago

I just downloaded the folder from an previous release from git

ykuzmycz commented 4 years ago

I can confirm rolling back just the calendar module to 2.7.1 corrects my reoccurring events (both daily and hourly).

1803

1798

oemel09 commented 4 years ago

I noticed, that this depends on the way the event saves the recurrence rule. I had my New Years Eve event saved with this rrule:

rrule: RRule {
    _cache: Cache { all: false, before: [], after: [], between: [] },
    origOptions: {
      dtstart: 2000-12-30T23:00:00.000Z,
      freq: 0,
      bymonth: 12,
      bymonthday: 31,
      tzid: undefined
    },
    ...
},

New Years Day event was saved with this rrule:

rrule: RRule {
    _cache: Cache { all: false, before: [], after: [], between: [] },
    origOptions: {
      dtstart: 1999-12-31T23:00:00.000Z,
      freq: 0,
      interval: 1,
      tzid: undefined
    },
    ....
},

In my calendar app they were both displayed correctly.

However after calling the between function the returned date for both events was 2019-12-31T23:00:00.000Z resulting in displaying New Years Eve and New Years Day happening at the same day.

I assume 23:00:00 is because those events are full day events and are saved in UTC as my time zone currently is UTC+1.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.