Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calculating every nth day even over year boundaries #26

Open
sothix opened this issue Aug 24, 2019 · 0 comments
Open

Calculating every nth day even over year boundaries #26

sothix opened this issue Aug 24, 2019 · 0 comments

Comments

@sothix
Copy link

sothix commented Aug 24, 2019

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);
    });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant