jkbrzt / rrule

JavaScript library for working with recurrence rules for calendar dates as defined in the iCalendar RFC and more.

Home Page:https://jkbrzt.github.io/rrule

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: What's the best way to extend a rule?

nandorojo opened this issue · comments

Say I have this rule:

let rule = new RRule({ freq: RRule.WEEKLY })

What's the best way to "edit" the class, preferably immutably?

Should I do this?

let rule = new RRule({ freq: RRule.WEEKLY })

let newRule = new RRule({ ...rule.options, byweekday: [1] })

Thanks!