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.37k stars 517 forks source link

RRule.toString() gives an integer for WKST but fromString throws an error when given an integer for WKST #187

Closed wpercy closed 6 years ago

wpercy commented 7 years ago

From the docs, you can see that when you call RRule.toString(), the property value of WKST is an integer - in this case 0.

RRule.optionsToString(rule.options)
"FREQ=WEEKLY;DTSTART=20120201T093000Z;INTERVAL=5;WKST=0;UNTIL=20130130T230000Z;BYDAY=MO,FR;BYHOUR=10;BYMINUTE=30;BYSECOND=0"

But when you try to feed that back into the RRule.fromString() method, it returns an error:

screen shot 2017-11-17 at 1 53 47 pm

If you replace the 0 with MO, fromString() works as expected.

According to RFC 5545, the WKST property should have a value of weekday, which is later defined as such

weekday = "SU" / "MO" / "TU" / "WE" / "TH" / "FR" / "SA" ;Corresponding to SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, ;FRIDAY, and SATURDAY days of the week.

wpercy commented 7 years ago

@jakubroztocil any chance we could get a release with some of these bugfixes soon?

wpercy commented 6 years ago

@espen thanks for looking through these issues. This has an open PR associated with it too if you'd like to review that as well

espen commented 6 years ago

@wpercy I'm not too comfortable with the code to be merging PRs yet. Can you add some tests for it though?