Skip to content

[Bug] Event.new doesn't set a DTEND when neither it nor DURATION are provided #1275

@stevepiercy

Description

@stevepiercy

Describe the bug

According to the iCalendar specification for VEVENT:

For cases where a "VEVENT" calendar component specifies a "DTSTART" property with a DATE value type but no "DTEND" nor "DURATION" property, the event's duration is taken to be one day. For cases where a "VEVENT" calendar component specifies a "DTSTART" property with a DATE-TIME value type but no "DTEND" property, the event ends on the same calendar date and time of day specified by the "DTSTART" property.

icalendar doesn't set this property.

To reproduce

import icalendar
import datetime as dt
import zoneinfo
from icalendar import Event

calendar = Calendar.new()
event = Event.new(
    start=dt.datetime(2026, 3, 21, 6, 30,0, tzinfo=zoneinfo.ZoneInfo("Europe/Berlin")),
)
calendar.add_component(event)
print(calendar.to_ical().decode())
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//collective//icalendar//7.0.3.dev78//EN
UID:898b4925-3576-4893-a82f-0f01eaedb6a9
BEGIN:VEVENT
DTSTART;TZID=Europe/Berlin:20260321T063000
DTSTAMP:20260312T203408Z
UID:e07a90f5-bee8-4fab-8622-9202eb2d9090
CATEGORIES:
END:VEVENT
END:VCALENDAR

Expected behavior

A calendar event should set its DTEND property to the DTSTART property when neither DTEND nor DURATION are set.

Environment

  • Operating system: macOS 13.7.8 (22H730)
  • Python version: Python 3.14
  • icalendar version: 7.0.3.dev78

Additional context

See plone/volto#7993 (comment)

@SashankBhamidi @niccokunzmann @tobixen @abe-101 I'd like your interpretation of the RFC to verify what I think is the correct behavior before anyone works on this issue. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions