later icon indicating copy to clipboard operation
later copied to clipboard

Every X days occurances

Open arnthorsnaer opened this issue 7 years ago • 3 comments

Assuming any day, for example today's date. How do I create a schedule with occurances on every 9 days from today?

This sounds like a pretty basic question, but I've been reading the docs and trying some code and can't figure this out...

arnthorsnaer avatar Dec 04 '16 22:12 arnthorsnaer

It's not meant to do that. A standard Javascript timer would be better for that, since execution is relative to the time it was set.

MaxMem avatar Dec 05 '16 21:12 MaxMem

@MaxMem thanks for comment.

The thing is that I have a few scheduling options available to the user, and as it stands they are all implemented with the later.js and the schedule data structure. Having to use completely new code and new data structures to manage what is essentially a list of occurrences seems pretty messy.

Anyways, I can't use a timer for this since this will be evaluated somewhere else.

Generating the list of dates is pretty easy - adding the dates to the schedules datastructure is the tricky part.

I'm wondering if I could write a custom modifier to achive this.

arnthorsnaer avatar Dec 08 '16 23:12 arnthorsnaer

I think a every(9).day() time period pattern would make a lot of sense. I feel like a custom modifier could be written that increments the day value of a Date by 1. A lot of logic would need to be written to handle time periods between months, between years, in leap years, etc... But I don't think it's out of the realm of possibility. This would be something like .recur().every(9, "days") in moment-recur

dsullivan7 avatar Oct 01 '17 01:10 dsullivan7