Skip to content

Every 3 and 6 Months Recurrence on later.js stating from a particular date #232

Description

@aravind2base

I am trying to create recurrence every 3 and 6 months using the later.js(https://github.com/bunkat/later).

This is my code

// My value.scheduled_date is 2018-09-06
var d = new Date(value.scheduled_date);
var day = d.getDate();
// month count will be -1 as it starts from 0
var month = d.getMonth();
var year = d.getFullYear();
var recurSched = later.parse.recur().on(day).dayOfMonth().every(3).month();
var schedules = later.schedule(recurSched).next(5);
console.log(schedules)

This gives 3 months recurrence starting from the current month, but I want the recurrence to start from the scheduled_date. When I add starting On to the code

var recurSched = later.parse.recur().on(day).dayOfMonth().every(3).month().startingOn(month + 1);
var schedules = later.schedule(recurSched).next(5);
console.log(schedules)

Recurrence is staring only after that month for every year. I want recurrence to start from a particular date so that the recurrence of other years won't be affected.

The same is the case with my 6 months code

var recurSched = later.parse.recur().on(day).dayOfMonth().every(6).month().startingOn(month+1);
var schedules = later.schedule(recurSched).next(5);
console.log(schedules);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions