rSchedule
Version 1.x Docs
A javascript library, written in typescript, for working with recurring dates. The library is "date agnostic" and usable with Date
, Moment, luxon, dayjs, or js-joda objects. If your chosen date library supports time zones, rSchedule supports time zones. All objects in rSchedule are immutable. rSchedule supports creating schedules with durations. rSchedule is modular, tree-shakable, and extensible. It supports JSON and ICAL serialization as well as custom recurrence rules.
Installation
# To install both the main package and the `StandardDateAdapter` for standard javascript dates */
yarn add @rschedule/core @rschedule/standard-date-adapter
# or
npm install @rschedule/core @rschedule/standard-date-adapter
# Current DateAdapter packages
@rschedule/standard-date-adapter
@rschedule/moment-date-adapter
@rschedule/moment-tz-date-adapter
@rschedule/luxon-date-adapter
@rschedule/dayjs-date-adapter
@rschedule/joda-date-adapter
Setup
rSchedule supports multiple date libraries though a DateAdapter
interface. To get started, you need to import the date adapter for your chosen date library (see the DateAdapter
section for more information). Note: you can only use one date adapter at a time in a project.
Create an rschedule.ts
(or rschedule.js
) file in your project which configures rSchedule locally. Instead of importing objects from @rschedule/core
, you'll import them from this local file.
For example:
// rschedule.ts
import '@rschedule/moment-date-adapter/setup';
// import '@rschedule/json-tools/setup' <-- optional json support
export * from '@rschedule/moment-date-adapter';
export * from '@rschedule/core';
export * from '@rschedule/core/generators';
// export * from '@rschedule/ical-tools' <-- optional ical support
// other project file
import { Schedule } from './rschedule';
// ... do stuff
Usage Overview
See Usage Overview for more info.
Other javascript recurring date libraries I'm aware of
- rrulejs
- Supports time zones via luxon and supports iCal.
rrulejs
is older and more mature than rSchedule and I used it before making rSchedule. - For most projects, rrulejs will probably do everything you need and you may feel more comfortable using something older and with a larger install base. Another reason you might want to choose rrule would be for it's NLP, internationalization support, or support for
BYWEEKNO
,BYYEARDAY
, andBYSETPOS
ICal rules. By comparison, rSchedule has better timezone support, support for different date libraries, duration support, custom rule support, a smaller minimum bundle size, and complex calendar support. See the docs of both projects to learn more.
- Supports time zones via luxon and supports iCal.
- laterjs (currently unmaintained)
- Simpler API. Not ICAL compatible. Has support for chron jobs.
- dayspan
- Appears to be a pretty full featured recurring dates library (like rSchedule or rrulejs), but I don't know much about it. Interestingly, while rrulejs and rSchedule have somewhat similar APIs (borrowing heavily from the ICAL spec), dayspan's API seems to be very different and somewhat unique in places.