rruler
v1.1.21
Published
Parse & Format rrule in Russian language
Downloads
160
Readme
rruler
TypeScript library for simple creating, parsing and formatting event RRULE strings.
Examples
Generating RRULE string
import { generateRrule } from 'rruler';
import {
RruleEach,
RruleWeekday,
} from 'rruler/dist/esm/types/generate.interface';
const rruleString = generateRrule({
each: 'day' as RruleEach,
hours: [9, 18],
weekdays: ['mo', 'tu', 'we', 'th', 'fr'] as RruleWeekday[],
});
// RRULE:FREQ=DAYLY;BYHOUR=9,18;BYDAY=MO,TU,WE,TH,FR
console.log(rruleString);
Parsing RRULE
import { parseRrule } from 'rruler';
const rruleObject = parseRrule(rruleString);
Formatting RRULE
import { formatRrule } from 'rruler';
const rruleLabel = formatRrule(rruleObject || rruleString);
import { compileRrule } from 'rruler';
const rruleString = compileRrule({
frequency: 'MONTH',
byMonthDay: [1, 15],
});