javascriptlaterjs

Every two weeks or every two months


Here is the fiddle: http://jsfiddle.net/ccarns/hXPU9/

Trying to get the "Two Months" option to display the same date 2 months from user date (and Two Weeks and Quarter with similar logic).

One month code works just fine

later.parse.recur().on(_dayOfTheMonth).dayOfMonth();

Any suggestions would be appreciated. I would like to stick with Recur Parser if possible. I am finding the examples are lacking.

Example for Every Twos Weeks with Start Date of 12/16/13:

12/16/13
12/30/13
01/13/14
01/27/14

I guess I can just not use Later and do a simple +14 days for Week - but Two Months and Quarter is not that simple.

Example for Every Twos Months with Start Date of 12/04/13:

12/04/13
02/04/14
04/04/14
06/04/14

It does seem easy enough to do without Later.js but would like to use it if possible


Solution

  • OK here is a jsFiddle with AN answer: http://jsfiddle.net/ccarns/2gMyx/

    The reason I say that is I cheated a bit because every(2).months(); and other methods I tried for every two weeks would return unexpected results.

    later.parse.recur().on(_dayOfTheMonth).dayOfMonth().every(2).month();
    

    For instance a start date of 12/1/2013 would return the same results as 1/1/2103 (both returning the first value as 1/1/2103). It seem like the implimenation treated every 2 as every odd month. Try the original fiddle at top to see what I mean.