Skip to content

NPM library for working with recurrence rules written in rust

License

Notifications You must be signed in to change notification settings

lsndr/rrule-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rrule-rust

npm version npm downloads/month npm downloads license

rrule-rust is a library for working with recurrence rules based on Rust's rrule crate

  1. Quick Start
  2. Performance

Quick Start

See test folder to find more use cases

  npm i rrule-rust
import { RRule, RRuleSet, Frequency, DateTime } from 'rrule-rust';

const rrule = new RRule({
  frequency: Frequency.Daily,
  count: 5,
});
const set = new RRuleSet({
  dtstart: DateTime.create(1997, 9, 2, 9, 0, 0, false),
  tzid: 'US/Eastern',
  rrules: [rrule],
});

const dates = set.all(); // [ DateTime, DateTime, DateTime, DateTime, DateTime ]
const asString = set.toString(); // DTSTART;TZID=US/Eastern:19970902T090000\nFREQ=daily;COUNT=5;BYHOUR=9;BYMINUTE=0;BYSECOND=0

Performance

  Host: MacBook Pro, 14-inch, 2023
  OS: macOS 14.4.1 (23E224)
  Processor: Apple M3 Pro
  Memory: 36 GB LPDDR5
rrule rrule-rust
UTC TZ 15 904 ops/s 108 538 ops/s ~6x faster
Other TZ 260 ops/s 106 034 ops/s ~400x faster

You can run benchmarks using npm run benchmark

License

rrule-rust is MIT licensed.