Skip to content

Commit

Permalink
add DTSTART and DUE to Todo
Browse files Browse the repository at this point in the history
  • Loading branch information
niccokunzmann committed Oct 16, 2024
1 parent 6db6147 commit 61c89a1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/icalendar/cal.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ def p_get(self : Component):
raise InvalidCalendar(f"Multiple {prop} defined.")
value = getattr(result, value_attr, result)
if not isinstance(value, value_type):
raise InvalidCalendar(f"{prop} must be either a date or a datetime, not {value}.")
raise InvalidCalendar(f"{prop} must be either a {' or '.join(t.__name__ for t in value_type)}, not {value}.")
return value

def p_set(self:Component, value) -> None:
Expand Down Expand Up @@ -708,6 +708,9 @@ class Todo(Component):
'ATTACH', 'ATTENDEE', 'CATEGORIES', 'COMMENT', 'CONTACT', 'EXDATE',
'RSTATUS', 'RELATED', 'RESOURCES', 'RDATE', 'RRULE'
)
DTSTART = create_single_property("DTSTART", "dt", (datetime, date), date, 'The "DTSTART" property for a "VTODO" specifies the inclusive start of the Todo.')
DUE = create_single_property("DUE", "dt", (datetime, date), date, 'The "DUE" property for a "VTODO" calendar component specifies the non-inclusive end of the Todo.')



class Journal(Component):
Expand Down
2 changes: 1 addition & 1 deletion src/icalendar/tests/test_issue_662_component_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def set_event_start(request):
"""Create a new event."""
return request.param

def test_event_dtstart(dtstart, start_end_component):
def test_component_dtstart(dtstart, start_end_component):
"""Test the start of events."""
assert start_end_component.DTSTART == dtstart

Expand Down

0 comments on commit 61c89a1

Please sign in to comment.