rossta / montrose

Recurring events library for Ruby. Enumerable recurrence objects and convenient chainable interface.
https://rossta.net/montrose/
MIT License
821 stars 53 forks source link

Support for interval patterns? #133

Closed mmmries closed 7 months ago

mmmries commented 3 years ago

First of all, thank you for the awesome piece of open source ❤️ 💛 💙 💚 💜. We've been using this at Spiff for 3 years now and it has been so helpful.

I have a use-case for support a 4-4-5 fiscal year. These kinds of fiscal years are used in some industries where they try to line up pay periods or fiscal reporting schedules with a weekly calendar and with a quarterly calendar.

I tried to build this using a pattern like:

Montrose.r(
  every: :week,
  on: :monday,
  interval: [4, 4, 5],
  starts: Date.new(2020, 11, 2)
)

The idea here is that it would use an interval of 4 weeks starting on Nov 2, then another interval of 4 weeks after that, and finally an interval of 5 weeks for the last period of the quarter.

Would you be interested in supporting these types of recurrences? I would be happy to take a stab at a PR if you think it would be useful to the community.

rossta commented 3 years ago

@mmmries Thanks! Yes please feel free to put up a PR.