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

Later.js UTC time schedules events the day before for early morning hours #201

Open codingfriend1 opened 7 years ago

codingfriend1 commented 7 years ago

Here is an example

        later.date.UTC();
        var s = later.parse.text('at 1:15 am on tues, thur every 1st week');
        console.log('s', s);
        var newEvents = later
            .schedule(s)
            .next(
                100,
                new Date('Wed Feb 22 2017 00:00:00 GMT-0600'),
                new Date('Wed Apr 25 2017 00:00:00 GMT-0600')
            );

            for (var i = 0; i < newEvents.length; i++) {
                console.log('newEvents[i]', newEvents[i]);
            }

The first two events are on Monday and Wednesday rather than Tuesday and Thursday

newEvents[i] Wed Feb 22 2017 19:15:00 GMT-0600 (CST) newEvents[i] Mon Feb 27 2017 19:15:00 GMT-0600 (CST)

How would I get repeating events that I want to be at 7:15pm Tues and Thurs? I have to use UTC time because it's on a server.