Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Calendar] - recurrent appointment with FREQ=WEEKLY throws an exception when BYDAY parameter is missing #180

Closed
angel1st opened this issue Aug 6, 2020 · 4 comments

Comments

@angel1st
Copy link

angel1st commented Aug 6, 2020

Hi there,
It's very easy to replicate error:

  1. Define
@override
String getRecurrenceRule(int index) { return 'FREQ=WEEKLY;INTERVAL=1;' }
  1. It throws an error:

E/flutter (10612): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: Invalid argument(s)
E/flutter (10612): #0 List.[] (dart:core-patch/growable_array.dart:146:60)
E/flutter (10612): #1 _getRecurrenceDateTimeCollection (package:syncfusion_flutter_calendar/src/calendar/appointment_engine/recurrence_helper.dart:124:47)
E/flutter (10612): #2 _getRecurrenceAppointments (package:syncfusion_flutter_calendar/src/calendar/appointment_engine/appointment_helper.dart:1416:20)
E/flutter (10612): #3 _getVisibleAppointments (package:syncfusion_flutter_calendar/src/calendar/appointment_engine/appointment_helper.dart:1240:5)
E/flutter (10612): #4 _SfCalendarState._updateVisibleAppointments (package:syncfusion_flutter_calendar/src/calendar/sfCalendar.dart:1079:36)
E/flutter (10612): #5 _SfCalendarState._getAppointment (package:syncfusion_flutter_calendar/src/calendar/sfCalendar.dart:1071:5)
E/flutter (10612): #6 _SfCalendarState.didUpdateWidget (package:syncfusion_flutter_calendar/src/calendar/sfCalendar.dart:1446:7)
E/flutter (10612): #7 StatefulElement.update (package:flutter/src/widgets/framework.dart:4690:58)
E/flutter (10612): #8 Element.updateChild (package:flutter/src/widgets/framework.dart:3201:15)
E/flutter (10612): #9 RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:5522:32)
E/flutter (10612): #10 MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:5957:17)
E/flutter (10612): #11 Element.updateChild (package:flutter/src/widgets/framework.dart:3201:15)
E/flutter (10612): #12 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4527:16)
E/flutter (10612): #13 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4675:11)
E/flutter (10612): #14 Element.rebuild (package:flutter/src/widgets/framework.dart:4218:5)
E/flutter (10612): #15 StatefulElement.update (package:flutter/src/widgets/framework.dart:4707:5)
E/flutter (10612): #16 Element.updateChild (package:flutter/src/widgets/framework.dart:3201:15)
E/flutter (10612): #17 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4527:16)
E/flutter (10612): #18 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4675:11)
E/flutter (10612): #19 Element.rebuild (package:flutter/src/widgets/framework.dart:4218:5)
E/flutter (10612): #20 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2627:33)
E/flutter (10612): #21 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:883:20)
E/flutter (10612): #22 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:284:5)
E/flutter (10612): #23 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1113:15)
E/flutter (10612): #24 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1052:9)
E/flutter (10612): #25 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:968:5)
E/flutter (10612): #26 _rootRun (dart:async/zone.dart:1184:13)
E/flutter (10612): #27 _CustomZone.run (dart:async/zone.dart:1077:19)
E/flutter (10612): #28 _CustomZone.runGuarded (dart:async/zone.dart:979:7)
E/flutter (10612): #29 _invoke (dart:ui/hooks.dart:261:10)
E/flutter (10612): #30 _drawFrame (dart:ui/hooks.dart:219:3)

@angel1st angel1st changed the title [Calendar] - recurrent FREQ=WEEKLY throws an exception when BYDAY parameter is missing [Calendar] - recurrent appointment with FREQ=WEEKLY throws an exception when BYDAY parameter is missing Aug 6, 2020
@Indumathi1195R
Copy link

Hi @angel1st ,

Based on the provided information, we have checked the mentioned issue “Issue with Weekly recurrence rule”. When we create the weekly recurrence appointment, we need to specify the weekday(s) on “BYDAY” property of the recurrence rule. It is a mandatory field for creating a recurrence appointment with weekly.

Please find the UG link for the recurrence rule.

UG link: https://help.syncfusion.com/flutter/calendar/appointments#recurrence-rule

Regards,
Indumathi R

@angel1st
Copy link
Author

angel1st commented Aug 7, 2020

Hi @Indumathi1195R and thanks for the feedback.
I have two remarks on your answer:

  1. I am aware of the UG link. This is the part regarding BYDAY parameter:

It holds the “DAY” values of an appointment to render. For example, when you create the weekly appointment, select the day(s) from the day options (Monday/Tuesday/Wednesday/Thursday/Friday/Saturday/Sunday). When Monday is selected, the first two letters of the selected day “MO” is stored in the “BYDAY” property. When you select multiple days, the values are separated by commas. Example: FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,WE;COUNT=10

However, I don't find UG is quite clear about BYDAY mandatory nature in case FREQ=WEEKLY.

  1. Even though the field is mandatory, you should have an assert statement inside the code, which IMO is a better programming practice rather than an exception that is currently thrown from your code.

@Indumathi1195R
Copy link

Hi @angel1st ,

We will provide assert for this exception and we will improve the documentation for the same.

Regards,
Indumathi R

@angel1st angel1st closed this as completed Aug 7, 2020
@loicgeek
Copy link

hello @Indumathi1195R , byDay field should not be mandatory, this rrule, RRULE:FREQ=WEEKLY;UNTIL=20210326T065900Z;INTERVAL=1 is valid and works well here : https://jakubroztocil.github.io/rrule/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants