dayspan icon indicating copy to clipboard operation
dayspan copied to clipboard

Calculating every nth day even over year boundaries

Open sothix opened this issue 5 years ago • 0 comments

Is there a way to have an event every 2nd (or nth) day that will work even over a year?


var cal = ds.Calendar.days(6,ds.Day.build(2019, ds.Month.DECEMBER, 31));

cal.addEvent({
    id: 'someUserProvidedId',
    data: " - Every second day",
    schedule: new ds.Schedule({
        dayOfYear: {every: 2,offset: 0},
        start: ds.Day.build(2019, ds.Month.DECEMBER, 21),
        end: ds.Day.build(2020, ds.Month.JANUARY, 4),
    })
});



cal.days.forEach((i) => {
    console.log(i.format("ddd, MMM Do YYYY"));
    i.events.forEach((j) => {
        console.log(j.event.data);
    });
});

sothix avatar Aug 24 '19 02:08 sothix