Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: allDay property is set to true for non-all-day events #171

Open
Programie opened this issue Feb 16, 2024 · 1 comment
Open

[BUG]: allDay property is set to true for non-all-day events #171

Programie opened this issue Feb 16, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@Programie
Copy link

Programie commented Feb 16, 2024

Describe the bug
I have some events which don't have an end-date (i.e. the end date is the same as the start date). Every calendar application is correctly handling that event as a non-all-day event. But in case of this Node-RED module, those events are flagged as all-day events (i.e. allDay of those events is set to true).

To Reproduce
Steps to reproduce the behavior:

  1. Create an event on your calendar server and select the same date/time for start date and end date
  2. Connect a trigger to the "upcoming" node and connect that node to a debug node
  3. Trigger the node
  4. The data shown in the debug node includes allDay: true for the previously created non-all-day event

Expected behavior
The event should have allDay: false in case the event is not an all-day event.

node-red-contrib-ical-events

  • Version: 2.2.5
  • node-red version: 3.1.5
  • nodejs version: 16.20.2
  • is it an ical, caldav or icloud calendar? CalDAV

Logs / Additional context
Example calendar file:

BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
PRODID:-//SabreDAV//SabreDAV//EN
X-WR-CALNAME:Test
X-APPLE-CALENDAR-COLOR:#499AA2
REFRESH-INTERVAL;VALUE=DURATION:PT4H
X-PUBLISHED-TTL:PT4H
BEGIN:VTIMEZONE
TZID:Europe/Berlin
BEGIN:DAYLIGHT
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
TZNAME:CEST
DTSTART:19700329T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
TZNAME:CET
DTSTART:19701025T030000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
CREATED:20240216T195606Z
DTSTAMP:20240216T195900Z
LAST-MODIFIED:20240216T195900Z
SEQUENCE:3
UID:27d5b79f-bfb0-4f22-874f-e81e8162e074
DTSTART;TZID=Europe/Berlin:20240220T100000
DTEND;TZID=Europe/Berlin:20240220T100000
STATUS:CONFIRMED
SUMMARY:Test
END:VEVENT
END:VCALENDAR

JSON output from the "upcoming" node:

[
    {
        "date": "2/20/24, 10:00 AM",
        "eventStart": "2024-02-20T09:00:00.000Z",
        "eventEnd": "2024-02-20T09:00:00.000Z",
        "summary": "Test",
        "duration": "PT0S",
        "durationSeconds": 0,
        "rruleText": null,
        "uid": {
            "uid": "27d5b79f-bfb0-4f22-874f-e81e8162e074",
            "date": "1708419600000"
        },
        "isRecurring": false,
        "datetype": "date",
        "allDay": true,
        "calendarName": "Test",
        "originalEvent": {
            "component": [
                "vevent",
                [
                    [
                        "created",
                        {},
                        "date-time",
                        "2024-02-16T19:56:06Z"
                    ],
                    [
                        "dtstamp",
                        {},
                        "date-time",
                        "2024-02-16T19:59:00Z"
                    ],
                    [
                        "last-modified",
                        {},
                        "date-time",
                        "2024-02-16T19:59:00Z"
                    ],
                    [
                        "sequence",
                        {},
                        "integer",
                        3
                    ],
                    [
                        "uid",
                        {},
                        "text",
                        "27d5b79f-bfb0-4f22-874f-e81e8162e074"
                    ],
                    [
                        "dtstart",
                        {
                            "tzid": "Europe/Berlin"
                        },
                        "date-time",
                        "2024-02-20T10:00:00"
                    ],
                    [
                        "dtend",
                        {
                            "tzid": "Europe/Berlin"
                        },
                        "date-time",
                        "2024-02-20T10:00:00"
                    ],
                    [
                        "status",
                        {},
                        "text",
                        "CONFIRMED"
                    ],
                    [
                        "summary",
                        {},
                        "text",
                        "Test"
                    ]
                ],
                []
            ],
            "_rangeExceptionCache": {},
            "exceptions": {},
            "rangeExceptions": []
        },
        "countdown": {
            "days": 3,
            "hours": 13,
            "minutes": 0,
            "seconds": 51
        },
        "on": false
    }
]
@Programie Programie added the bug Something isn't working label Feb 16, 2024
@Programie
Copy link
Author

As this is still an issue, I've looked for a workaround and found a way to check whether the event is a non-all-day event while the start and end times are the same.

It's quite easy but I didn't saw that before: Just check whether durationSeconds is zero. If that's the case, the event should not be an all-day event. Checking whether eventStart and eventEnd are the same should also work, but I guess it could have different values if eventStart and eventEnd use different time zones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants