This project is no longer being maintained. It should be treated as sample code on one technique to calculate future instances of complex schedules. If you are looking to fire a task every 1 minute, use a cron scheduler instead.
Later is a library for describing recurring schedules and calculating their future occurrences. It supports a very flexible schedule definition including support for composite schedules and schedule exceptions. Create new schedules manually, via Cron expression, via text expressions, or using a fully chainable API.
Types of schedules supported by Later:
- Run a report on the last day of every month at 12 AM except in December
- Install patches on the 2nd Tuesday of every month at 4 AM
- Gather CPU metrics every 10 mins Mon - Fri and every 30 mins Sat - Sun
- Send out a scary e-mail at 13:13:13 every Friday the 13th
For complete documentation visit https://bunkat.github.io/later/.
Using npm:
$ npm install later
Using bower:
$ bower install later
To build the minified javascript files for later, run npm install
to install dependencies and then:
$ make all
To run the tests for later, run npm install
to install dependencies and then:
$ make test
Releases will be numbered with the following format:
<major>.<minor>.<patch>
And constructed with the following guidelines:
- Breaking backward compatibility bumps the major (and resets the minor and patch)
- New additions without breaking backward compatibility bumps the minor (and resets the patch)
- Bug fixes and misc changes bumps the patch
For more information on SemVer, please visit https://semver.org/.
Have a bug or a feature request? Please open a new issue.
- Implemented predefined scheduling definitions for cron
- @yearly, @annually, @monthly, @weekly, @daily, and @hourly are now parsed correctly
- Submitted by pekeler (thanks!)
- Fixed npm and bower entry points
- Various bug fixes
- Merge consecutive ranges when using composite schedules (fixes issues #27)
- Fixed handling of ranged schedules which never go invalid. End date is undefined for these types of schedules.
- Implemented fullDate (fd) constraint to specify a specific occurrence (or exception)
later.parse.recur().on(new Date(2013,3,21,10,30,0)).fullDate()
- Refactored core engine so that it could be better tested
- Added over 41,500 tests and fixed hundreds of edge cases that were unfortunately broken in v0.0.20
- Core engine is now extensible via custom time periods and custom modifiers
- Full examples included in the documentation
- Added support for finding valid ranges as well as valid instances of schedules
- Later can now be used to schedule activities and meetings as well as point in time occurrences
- Improved support for finding past ranges and instances
- Searching forward or backward now produces the same valid occurrences
- No more need to specify a resolution!
- Later now automatically handles this internally, you no longer need to specify your desired resolution. 'Every 5 minutes' now does exactly what you would expect it to :)
- Changing between UTC and local time has changed.
- Use
later.date.UTC()
andlater.date.localTime()
to switch between the two.
- Use
- API for parsers has changed.
- Recur is now at
later.parse.recur()
- Cron is now at
later.parse.cron(expr)
- Text is now at
later.parse.text(expr)
- Recur is now at
- API for calculating occurrences has changed.
- Schedules are now compiled using
later.schedule(schedule)
- getNext is now
later.schedule(schedule).next(count, start, end)
- getPrev is now
later.schedule(schedule).prev(count, start, end)
- Schedules are now compiled using
After
meaning 'don't start until after this amount of time' has been deprecated.- This was a hack since people had a hard time with resolutions. With resolutions gone, this is no longer needed and is deprecated since it produced non-deterministic schedules.
Note: Schedule definitions did not change (unless you were using after
constraints which have been deprecated). If you stored any schedule definitions from v0.0.20, they should continue to work unchanged in v1.0.0.