jkbrzt / rrule

JavaScript library for working with recurrence rules for calendar dates as defined in the iCalendar RFC and more.
https://jkbrzt.github.io/rrule
Other
3.33k stars 511 forks source link

TypeError: TypeError: undefined is not an object (evaluating 'rfcString.split') #338

Closed vkiranmaniya closed 5 years ago

vkiranmaniya commented 5 years ago

Reporting an issue

I'm Using RRule with React Native and Parsing the Recurrence Rule coming from WordPress. It returns the Error as shown below, `TypeError: TypeError: undefined is not an object (evaluating 'rfcString.split')

This error is located at: in CellRenderer (at VirtualizedList.js:687) in RCTView (at View.js:44) in RCTScrollView (at ScrollView.js:977) in ScrollView (at VirtualizedList.js:1062) in VirtualizedList (at FlatList.js:662) in FlatList (at WhatsOnScreen.js:62) in RCTView (at View.js:44) in RCTView (at View.js:44) in RCTView (at View.js:44) in WhatsOnScreen (created by SceneView) in SceneView (at StackViewLayout.js:784) in RCTView (at View.js:44) in RCTView (at View.js:44) in RCTView (at View.js:44) in AnimatedComponent (at StackViewCard.js:69) in RCTView (at View.js:44) in AnimatedComponent (at screens.native.js:59) in Screen (at StackViewCard.js:57) in Card (at createPointerEventsContainer.js:27) in Container (at StackViewLayout.js:860) in RCTView (at View.js:44) in ScreenContainer (at StackViewLayout.js:311) in RCTView (at View.js:44) in AnimatedComponent (at StackViewLayout.js:307) in Handler (at StackViewLayout.js:300) in StackViewLayout (at withOrientation.js:30) in withOrientation (at StackView.js:79) in RCTView (at View.js:44) in Transitioner (at StackView.js:22) in StackView (created by Navigator) in Navigator (at createKeyboardAwareNavigator.js:12) in KeyboardAwareNavigator (created by SceneView) in SceneView (at createTabNavigator.js:39) in RCTView (at View.js:44) in RCTView (at View.js:44) in ResourceSavingScene (at createBottomTabNavigator.js:113) in RCTView (at View.js:44) in ScreenContainer (at createBottomTabNavigator.js:103) in RCTView (at View.js:44) in TabNavigationView (at createTabNavigator.js:197) in NavigationView (created by Navigator) in Navigator (created by SceneView) in SceneView (created by SwitchView) in SwitchView (created by Navigator) in Navigator (created by SceneView) in SceneView (at DrawerView.js:149) in RCTView (at View.js:44) in RCTView (at View.js:44) in ResourceSavingScene (at DrawerView.js:148) in RCTView (at View.js:44) in ScreenContainer (at DrawerView.js:138) in RCTView (at View.js:44) in AnimatedComponent (at DrawerLayout.js:440) in RCTView (at View.js:44) in AnimatedComponent (at DrawerLayout.js:439) in Handler (at DrawerLayout.js:495) in DrawerLayout (at DrawerView.js:165) in DrawerView (created by Navigator) in Navigator (created by SceneView) in SceneView (at StackViewLayout.js:795) in RCTView (at View.js:44) in AnimatedComponent (at StackViewCard.js:69) in RCTView (at View.js:44) in AnimatedComponent (at screens.native.js:59) in Screen (at StackViewCard.js:57) in Card (at createPointerEventsContainer.js:27) in Container (at StackViewLayout.js:860) in RCTView (at View.js:44) in ScreenContainer (at StackViewLayout.js:311) in RCTView (at View.js:44) in AnimatedComponent (at StackViewLayout.js:307) in Handler (at StackViewLayout.js:300) in StackViewLayout (at withOrientation.js:30) in withOrientation (at StackView.js:79) in RCTView (at View.js:44) in Transitioner (at StackView.js:22) in StackView (created by Navigator) in Navigator (at createKeyboardAwareNavigator.js:12) in KeyboardAwareNavigator (at createAppContainer.js:388) in NavigationContainer (at App.js:24) in RCTView (at View.js:44) in App (at withExpoRoot.js:22) in RootErrorBoundary (at withExpoRoot.js:21) in ExpoRootComponent (at renderApplication.js:34) in RCTView (at View.js:44) in RCTView (at View.js:44) in AppContainer (at renderApplication.js:33) `

Code Block

Here item.rstr = 'FREQ=WEEKLY;WKST=SU;BYday=FR,SA;UNTIL=20191229T235959Z' let rules = RRule.fromString(item.rstr); let dates = rules.all(); console.log({dates});

I have tried parsing this string in official demo on [https://jakubroztocil.github.io/rrule/](RRule Demo) and it works fine.

Info

Platform: Windows 10 React v16.5.0 Expo v32.0.0 rrule v2.6.0

davidgoli commented 5 years ago

By itself, this str isn't in valid RRULE syntax. It should have at least a DTSTART and an RRULE property, like so:

DTSTART:....
RRULE:FREQ=WEEKLY;WKST=SU;BYday=FR,SA;UNTIL=20191229T235959Z