builttoroam / device_calendar

A cross platform plugin for modifying calendars on the user's device
https://pub.dev/packages/device_calendar
BSD 3-Clause "New" or "Revised" License
259 stars 258 forks source link

AllDay and date start / end bug #543

Open ak1987 opened 2 weeks ago

ak1987 commented 2 weeks ago

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