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.28k stars 510 forks source link

bynmonthday causes issues. #394

Open aklaver opened 4 years ago

aklaver commented 4 years ago

The rrule string that is produced does not match the options output when dealing with bymonthday.

DTSTART:20200331T000000Z
RRULE:FREQ=MONTHLY;INTERVAL=1;BYMONTHDAY=-1 

Object { freq: 1, interval: 1, bymonthday: [], dtstart: Date Mon Mar 30 2020 17:00:00 GMT-0700 (Pacific Daylight Time),...

Instead the negative offset is moved to:

bynmonthday: (1) […]
​​0: -1
​length: 1
​<prototype>: Array []

bynmonthday is not one of the options listed here: https://github.com/jakubroztocil/rrule

Would it be possible to do what dateutil rrule does and merge negative offsets into bymonthday.

hyshka commented 3 years ago

Just ran into this myself...seems like weird behaviour and did not match what I expected after testing this with the demo app:

image

EDIT: I didn't realize there was both an options and origOptions parameter...origOptions followed my expectations.