
Security News
Feross on Risky Business Weekly Podcast: npm’s Ongoing Supply Chain Attacks
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
simple-rrule
Advanced tools
Simple recurrence rules to get scheduler events for calendar dates.
simple-rrule.js expands recurrence dates from a rrule string.
rules as defined in the iCalendar RFC (with partial implementation)
rrule.js supports recurrence rules as defined in the iCalendar
RFC, with a few important
differences. It is a partial port of the
rrule
module from the excellent
python-dateutil library. On top of
that, it supports parsing and serialization of recurrence rules from and
to natural language.
Includes optional TypeScript types
$ yarn add simple-rrule
# or
$ npm install simple-rrule
import { expandRRuleFromString } from 'simple-rrule'
const rRule =
'DTSTART:20221215T100000Z\nRRULE:FREQ=YEARLY;BYDAY=MO;BYMONTH=1;BYSETPOS=2;COUNT=5;WKST=SU'
const rRule = `DTSTART:DTSTART:20221215T100000Z\nRRULE:FREQ=DAILY;INTERVAL=1;COUNT=3;WKST=SU`
const r = expandRRuleFromString(rRule, today, addDays(today, 3))
import { parseRecurrenceFromString, expandRRule, WeekDay } from 'simple-rrule'
const rRule =
'DTSTART:20221216T100000Z\nRRULE:FREQ=MONTHLY;INTERVAL=1;BYSETPOS=2;BYDAY=WE;UNTIL=20230411T100000Z;WKST=SU'
const rRule = await parseRecurrenceFromString(rRule, Weekday.Sunday)
console.log(rRule)
const r = expandRRule(
rRule,
new Date('2023-02-02T10:00:00.000Z'),
new Date('2023-12-31T10:00:00.000Z')
)
import { expandRRuleFromString } from 'simple-rrule'
const rRule =
'DTSTART:20221215T100000Z\nRRULE:FREQ=YEARLY;BYDAY=MO;BYMONTH=1;BYSETPOS=2;COUNT=5;WKST=SU'
const r = expandRRuleFromString(
rRule,
new Date('2023-01-28T10:00:00.000Z'),
new Date('2025-05-31T10:00:00.000Z')
)
import { expandRRuleFromString } from 'simple-rrule'
const rRule =
'DTSTART:20221215T100000Z\nRRULE:FREQ=YEARLY;BYDAY=MO;BYMONTH=1;BYSETPOS=2;COUNT=5;WKST=SU'
const r = expandRRuleFromString(
rRule,
new Date('2023-01-28T10:00:00.000Z'),
new Date('2025-05-31T10:00:00.000Z')
)
Field | Type | Required | Default | Description |
---|---|---|---|---|
dtStart | Date | Y | The recurrence start. | |
dtEnd | Date | Y | Used for duration (dtStart-dtEnd) | |
frequency | Frequency as String | Y |
| |
interval | Positive Integer | Y | 1 | The interval between each freq iteration |
wkst | Weekday as String | Y | 'SU' | The week start day. |
count | Positive Integer | N | How many occurrences will be generated. | |
until | Date | N | End limit of recurrence dates generated. | |
byday | WeekDay[] as String | N | Weekday or WeekDays ex: 'SU' or 'SU,MO,FR' | |
bysetpos | Integer | N | Used only in byMonth and byYear | |
bymonth | Integer | N | Month | |
bymonthday | Integer | N | Month day |
FAQs
simple rrule string parser and expand date events
The npm package simple-rrule receives a total of 56 weekly downloads. As such, simple-rrule popularity was classified as not popular.
We found that simple-rrule demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.