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

Weekly rule without a BYDAY throws an error #2237

Open
chanan opened this issue Dec 31, 2024 · 1 comment
Open

Weekly rule without a BYDAY throws an error #2237

chanan opened this issue Dec 31, 2024 · 1 comment
Labels
calendar Calendar component open Open

Comments

@chanan
Copy link

chanan commented Dec 31, 2024

Bug description

An rrule like this which is valid: FREQ=WEEKLY;UNTIL=20170324T220000Z;INTERVAL=2 throws an error because _findWeeklyRule (line 1754 of recurrence_helper.dart) return 0 items due to the if (weeklyRule[i].contains('BYDAY'))

According to the iCal spec the above is valid: https://www.kanzaki.com/docs/ical/rrule.html

Steps to reproduce

  1. Create an Appointment object with a valid weekly rrule that does not contain a BYDAY section
  2. Add it to a datasource of a calendar.

Code sample

Code sample ``` final list = [_Meeting(summary: 'test', from: '2017-02-10 16:00:00:00.000', rrule: 'FREQ=WEEKLY;UNTIL=20170324T220000Z;INTERVAL=2')]; final source = _AppointmentDataSource(source: list);

return SfCalendar(dataSource: source);

</details>

### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>

n/a

</details>


### Stack Traces

<details open><summary>Stack Traces</summary>

```dart
The following assertion was thrown building LayoutBuilder:
Invalid weekly recurrence rule
'package:syncfusion_flutter_calendar/src/calendar/appointment_engine/recurrence_helper.dart':
Failed assertion: line 271 pos 12: 'weeklyByDayPos != -1'

The relevant error-causing widget was: 
  SfCalendar SfCalendar:file:///Users/chanan/flutter/bkhome/lib/features/calendar/widgets/calendar_widget.dart:30:12
When the exception was thrown, this was the stack: 
#2      RecurrenceHelper._getWeeklyRecurrenceDateTimeCollection (package:syncfusion_flutter_calendar/src/calendar/appointment_engine/recurrence_helper.dart:271:12)
#3      RecurrenceHelper.getRecurrenceDateTimeCollection (package:syncfusion_flutter_calendar/src/calendar/appointment_engine/recurrence_helper.dart:1072:14)
#4      _SfCalendarState._getMaxAppointmentDate (package:syncfusion_flutter_calendar/src/calendar/sfcalendar.dart:5273:28)
#5      _SfCalendarState.addAgenda (package:syncfusion_flutter_calendar/src/calendar/sfcalendar.dart:6722:16)
#6      _SfCalendarState.build.<anonymous closure> (package:syncfusion_flutter_calendar/src/calendar/sfcalendar.dart:3100:21)
#7      _LayoutBuilderElement._rebuildWithConstraints.updateChildCallback (package:flutter/src/widgets/layout_builder.dart:199:77)
#8      BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:3038:19)
#9      _LayoutBuilderElement._rebuildWithConstraints (package:flutter/src/widgets/layout_builder.dart:239:12)
#10     RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:2738:59)
#11     PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:1108:15)
#12     RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:2738:14)
#13     RenderConstrainedLayoutBuilder.rebuildIfNecessary (package:flutter/src/widgets/layout_builder.dart:286:5)
#14     _RenderLayoutBuilder.performLayout (package:flutter/src/widgets/layout_builder.dart:377:5)
#15     RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:2465:7)
#16     PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:1062:18)
#17     PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:1075:15)
#18     RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:609:23)
#19     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:1178:13)
#20     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:475:5)
#21     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1397:15)
#22     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1318:9)
#23     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1176:5)
#24     _invoke (dart:ui/hooks.dart:312:13)
#25     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:427:5)
#26     _drawFrame (dart:ui/hooks.dart:283:31)
(elided 2 frames from class _AssertionError)

On which target platforms have you observed this bug?

macOS

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.27.1, on macOS 15.2 24C101 darwin-arm64, locale en-US)
    • Flutter version 3.27.1 on channel stable at /Users/chanan/flutter/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 17025dd882 (2 weeks ago), 2024-12-17 03:23:09 +0900
    • Engine revision cb4b5fff73
    • Dart version 3.6.0
    • DevTools version 2.40.2

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/chanan/Library/Android/sdk
    • Platform android-35, build-tools 34.0.0
    • ANDROID_HOME = /Users/chanan/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16C5032a
    • CocoaPods version 1.14.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)

[✓] VS Code (version 1.96.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.102.0

[✓] Connected device (5 available)
    • Chanan’s iPhone (mobile)        • 00008140-001201C12EA3001C • ios            • iOS 18.3 22D5034e
    • macOS (desktop)                 • macos                     • darwin-arm64   • macOS 15.2 24C101 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad     • darwin         • macOS 15.2 24C101 darwin-arm64
    • Chrome (web)                    • chrome                    • web-javascript • Google Chrome 131.0.6778.205
    • Raspberry Pi 5 (mobile)         • pi-5                      • linux-arm64    • Raspberry Pi 5
    ! Error: Browsing on the local area network for Chanan’s iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)

[✓] Network resources
    • All expected network resources are available.

• No issues found!
@chanan
Copy link
Author

chanan commented Dec 31, 2024

Another valid rrule that fails on int parsing is FREQ=YEARLY;BYMONTH=3;BYDAY=1SA;UNTIL=20241207

@VijayakumarMariappan VijayakumarMariappan added calendar Calendar component open Open labels Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
calendar Calendar component open Open
Projects
None yet
Development

No branches or pull requests

2 participants