Skip to content

Commit

Permalink
🔨 Fix edit event
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham-jitiya-simform committed Nov 26, 2024
1 parent da9b304 commit 6bc0cda
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions example/lib/widgets/add_event_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -550,13 +550,20 @@ class _AddOrEditEventFormState extends State<AddOrEditEventForm> {
if (!(_form.currentState?.validate() ?? true)) return;

_form.currentState?.save();
final occurrences = int.tryParse(_occurrenceController.text);
var occurrences = int.tryParse(_occurrenceController.text);
DateTime? endDate;
if (widget.event?.recurrenceSettings?.occurrences != occurrences) {

// On event edit recurrence end is selected "Never"
// Remove any previous end date & occurrences stored.
if (_selectedRecurrenceEnd == RecurrenceEnd.never) {
endDate = null;
} else {
occurrences = null;
}

if (_selectedRecurrenceEnd == RecurrenceEnd.onDate) {
endDate = _recurrenceEndDate;
}

final recurrenceSettings = RecurrenceSettings.withCalculatedEndDate(
startDate: _startDate,
endDate: endDate,
Expand Down

0 comments on commit 6bc0cda

Please sign in to comment.