bunkat / later

A javascript library for defining recurring schedules and calculating future (or past) occurrences for them. Includes support for using English phrases and Cron schedules. Works in Node and in the browser.
http://bunkat.github.io/later/
MIT License
2.42k stars 245 forks source link

Every 6 months starting from a particular date #210

Open vivinjoy opened 7 years ago

vivinjoy commented 7 years ago

I am not able to express the following criteria. Every 6 months starting from '2013-03-21T11:30:00'. So the next two occurrences would be at '2013-09-21T11:30:00' and ''2014-03-21T11:30:00''.

Maybe I am missing some easy way to do this.

KurtStauffer commented 7 years ago

Use the startingOn(val) function chained after every(val) function. So for your case you can do...

// every 6 months starting on the 3rd month
later.parse.recur().every(6).month().startingOn(3)

See here for more info. Hope this helps!