builttoroam/device_calendar

AllDay and date start / end bug

Closed this issue · 1 comments

Describe the bug
Error 400 on creating allday event (iOS):
To create or update an all day event you must provide calendar ID, event with a title and event's start date

Working:
var test = await _deviceCalendarPlugin.createOrUpdateEvent(Event(calendarId, title: 'Title 1', allDay: true, start: TZDateTime.local(2024, 6, 20), end: TZDateTime.local(2024, 6, 20)));

Not working:
var test = await _deviceCalendarPlugin.createOrUpdateEvent(Event(calendarId, title: 'Title 1', allDay: true, start: TZDateTime.local(2024, 6, 20)));

device_calendar.dart, lines ~236:

_assertParameter(
          result,
          !(event.allDay == true && (event.calendarId?.isEmpty ?? true) ||
              event.start == null ||
              event.end == null),
          ErrorCodes.invalidArguments,
          ErrorMessages.createOrUpdateEventInvalidArgumentsMessageAllDay,
        );

Expected behavior
All day event creates without date end parameter

Device(s) tested
iPhone 15 simulator

All day events can last multiple days, so explicitly stating an end date should be preferred. Seem to be working as intended & not a bug.