rrule

  • Version 2.8.1
  • Published
  • 687 kB
  • 1 dependency
  • BSD-3-Clause license

Install

npm i rrule
yarn add rrule
pnpm add rrule

Overview

JavaScript library for working with recurrence rules for calendar dates.

Index

Variables

variable ALL_WEEKDAYS

const ALL_WEEKDAYS: WeekdayStr[];

    Functions

    function datetime

    datetime: (
    y: number,
    m: number,
    d: number,
    h?: number,
    i?: number,
    s?: number
    ) => Date;

      function rrulestr

      rrulestr: (s: string, options?: Partial<RRuleStrOptions>) => RRule | RRuleSet;

        Classes

        class RRule

        class RRule implements QueryMethods {}
        • Parameter options

          see <http://labix.org/python-dateutil/#head-cf004ee9a75592797e076752b2a889c10f445418> - The only required option is freq, one of RRule.YEARLY, RRule.MONTHLY, ...

        constructor

        constructor(options?: Partial<Options>, noCache?: boolean);

          property DAILY

          static readonly DAILY: number;

            property FR

            static readonly FR: Weekday;

              property FREQUENCIES

              static readonly FREQUENCIES: (
              | 'YEARLY'
              | 'MONTHLY'
              | 'WEEKLY'
              | 'DAILY'
              | 'HOURLY'
              | 'MINUTELY'
              | 'SECONDLY'
              )[];

                property HOURLY

                static readonly HOURLY: number;

                  property MINUTELY

                  static readonly MINUTELY: number;

                    property MO

                    static readonly MO: Weekday;

                      property MONTHLY

                      static readonly MONTHLY: number;

                        property options

                        options: ParsedOptions;

                          property optionsToString

                          static optionsToString: (options: Partial<Options>) => string;

                            property origOptions

                            origOptions: Partial<Options>;

                              property parseString

                              static parseString: (rfcString: string) => Partial<Options>;

                                property SA

                                static readonly SA: Weekday;

                                  property SECONDLY

                                  static readonly SECONDLY: number;

                                    property SU

                                    static readonly SU: Weekday;

                                      property TH

                                      static readonly TH: Weekday;

                                        property TU

                                        static readonly TU: Weekday;

                                          property WE

                                          static readonly WE: Weekday;

                                            property WEEKLY

                                            static readonly WEEKLY: number;

                                              property YEARLY

                                              static readonly YEARLY: number;

                                                method after

                                                after: (dt: Date, inc?: boolean) => Date | null;
                                                • Returns the first recurrence after the given datetime instance. The inc keyword defines what happens if dt is an occurrence. With inc == True, if dt itself is an occurrence, it will be returned.

                                                  Date or null

                                                method all

                                                all: (iterator?: (d: Date, len: number) => boolean) => Date[];
                                                • Parameter iterator

                                                  optional function that will be called on each date that is added. It can return false to stop the iteration. Array containing all recurrences.

                                                method before

                                                before: (dt: Date, inc?: boolean) => Date | null;
                                                • Returns the last recurrence before the given datetime instance. The inc keyword defines what happens if dt is an occurrence. With inc == True, if dt itself is an occurrence, it will be returned.

                                                  Date or null

                                                method between

                                                between: (
                                                after: Date,
                                                before: Date,
                                                inc?: boolean,
                                                iterator?: (d: Date, len: number) => boolean
                                                ) => Date[];
                                                • Returns all the occurrences of the rrule between after and before. The inc keyword defines what happens if after and/or before are themselves occurrences. With inc == True, they will be included in the list, if they are found in the recurrence set.

                                                  Array

                                                method clone

                                                clone: () => RRule;
                                                • a RRule instance with the same freq and options as this one (cache is not cloned)

                                                method count

                                                count: () => number;
                                                • Returns the number of recurrences in this set. It will have go trough the whole recurrence, if this hasn't been done before.

                                                method fromString

                                                static fromString: (str: string) => RRule;

                                                  method fromText

                                                  static fromText: (text: string, language?: Language) => RRule;

                                                    method isFullyConvertibleToText

                                                    isFullyConvertibleToText: () => boolean;

                                                      method parseText

                                                      static parseText: (text: string, language?: Language) => Partial<Options>;

                                                        method toString

                                                        toString: () => string;
                                                        • Converts the rrule into its string representation

                                                          See Also

                                                          • <http://www.ietf.org/rfc/rfc2445.txt> String

                                                        method toText

                                                        toText: (
                                                        gettext?: GetText,
                                                        language?: Language,
                                                        dateFormatter?: DateFormatter
                                                        ) => string;
                                                        • Will convert all rules described in nlp:ToText to text.

                                                        class RRuleSet

                                                        class RRuleSet extends RRule {}

                                                          constructor

                                                          constructor(noCache?: boolean);
                                                          • Parameter noCache

                                                            The same stratagy as RRule on cache, default to false

                                                          property dtstart

                                                          dtstart: any;

                                                            property tzid

                                                            tzid: any;

                                                              method clone

                                                              clone: () => RRuleSet;
                                                              • Create a new RRuleSet Object completely base on current instance

                                                              method exdate

                                                              exdate: (date: Date) => void;
                                                              • Adds an EXDATE to the set

                                                                Parameter

                                                                {Date}

                                                              method exdates

                                                              exdates: () => Date[];
                                                              • Get list of included datetimes in this recurrence set.

                                                                List of exdates

                                                              method exrule

                                                              exrule: (rrule: RRule) => void;
                                                              • Adds an EXRULE to the set

                                                                Parameter

                                                                {RRule}

                                                              method exrules

                                                              exrules: () => (RRule | RRuleSet)[];
                                                              • Get list of excluded rrules in this recurrence set.

                                                                List of exrules

                                                              method rdate

                                                              rdate: (date: Date) => void;
                                                              • Adds an RDate to the set

                                                                Parameter

                                                                {Date}

                                                              method rdates

                                                              rdates: () => Date[];
                                                              • Get list of included datetimes in this recurrence set.

                                                                List of rdates

                                                              method rrule

                                                              rrule: (rrule: RRule) => void;
                                                              • Adds an RRule to the set

                                                                Parameter

                                                                {RRule}

                                                              method rrules

                                                              rrules: () => (RRule | RRuleSet)[];
                                                              • Get list of included rrules in this recurrence set.

                                                                List of rrules

                                                              method toString

                                                              toString: () => string;
                                                              • to generate recurrence field such as: DTSTART:19970902T010000Z RRULE:FREQ=YEARLY;COUNT=2;BYDAY=TU RRULE:FREQ=YEARLY;COUNT=1;BYDAY=TH

                                                              method valueOf

                                                              valueOf: () => string[];

                                                                class Weekday

                                                                class Weekday {}

                                                                  constructor

                                                                  constructor(weekday: number, n?: number);

                                                                    property n

                                                                    readonly n?: number;

                                                                      property weekday

                                                                      readonly weekday: number;

                                                                        method equals

                                                                        equals: (other: Weekday) => boolean;

                                                                          method fromStr

                                                                          static fromStr: (str: WeekdayStr) => Weekday;

                                                                            method getJsWeekday

                                                                            getJsWeekday: () => number;

                                                                              method nth

                                                                              nth: (n: number) => Weekday;

                                                                                method toString

                                                                                toString: () => string;

                                                                                  Interfaces

                                                                                  interface Options

                                                                                  interface Options {}

                                                                                    property byeaster

                                                                                    byeaster: number | null;

                                                                                      property byhour

                                                                                      byhour: number | number[] | null;

                                                                                        property byminute

                                                                                        byminute: number | number[] | null;

                                                                                          property bymonth

                                                                                          bymonth: number | number[] | null;

                                                                                            property bymonthday

                                                                                            bymonthday: number | number[] | null;

                                                                                              property bynmonthday

                                                                                              bynmonthday: number[] | null;

                                                                                                property bynweekday

                                                                                                bynweekday: number[][] | null;

                                                                                                  property bysecond

                                                                                                  bysecond: number | number[] | null;

                                                                                                    property bysetpos

                                                                                                    bysetpos: number | number[] | null;

                                                                                                      property byweekday

                                                                                                      byweekday: ByWeekday | ByWeekday[] | null;

                                                                                                        property byweekno

                                                                                                        byweekno: number | number[] | null;

                                                                                                          property byyearday

                                                                                                          byyearday: number | number[] | null;

                                                                                                            property count

                                                                                                            count: number | null;

                                                                                                              property dtstart

                                                                                                              dtstart: Date | null;

                                                                                                                property freq

                                                                                                                freq: Frequency;

                                                                                                                  property interval

                                                                                                                  interval: number;

                                                                                                                    property tzid

                                                                                                                    tzid: string | null;

                                                                                                                      property until

                                                                                                                      until: Date | null;

                                                                                                                        property wkst

                                                                                                                        wkst: Weekday | number | null;

                                                                                                                          interface RRuleStrOptions

                                                                                                                          interface RRuleStrOptions {}

                                                                                                                            property cache

                                                                                                                            cache: boolean;

                                                                                                                              property compatible

                                                                                                                              compatible: boolean;

                                                                                                                                property dtstart

                                                                                                                                dtstart: Date | null;

                                                                                                                                  property forceset

                                                                                                                                  forceset: boolean;

                                                                                                                                    property tzid

                                                                                                                                    tzid: string | null;

                                                                                                                                      property unfold

                                                                                                                                      unfold: boolean;

                                                                                                                                        Enums

                                                                                                                                        enum Frequency

                                                                                                                                        enum Frequency {
                                                                                                                                        YEARLY = 0,
                                                                                                                                        MONTHLY = 1,
                                                                                                                                        WEEKLY = 2,
                                                                                                                                        DAILY = 3,
                                                                                                                                        HOURLY = 4,
                                                                                                                                        MINUTELY = 5,
                                                                                                                                        SECONDLY = 6,
                                                                                                                                        }

                                                                                                                                          member DAILY

                                                                                                                                          DAILY = 3

                                                                                                                                            member HOURLY

                                                                                                                                            HOURLY = 4

                                                                                                                                              member MINUTELY

                                                                                                                                              MINUTELY = 5

                                                                                                                                                member MONTHLY

                                                                                                                                                MONTHLY = 1

                                                                                                                                                  member SECONDLY

                                                                                                                                                  SECONDLY = 6

                                                                                                                                                    member WEEKLY

                                                                                                                                                    WEEKLY = 2

                                                                                                                                                      member YEARLY

                                                                                                                                                      YEARLY = 0

                                                                                                                                                        Type Aliases

                                                                                                                                                        type ByWeekday

                                                                                                                                                        type ByWeekday = WeekdayStr | number | Weekday;

                                                                                                                                                          type WeekdayStr

                                                                                                                                                          type WeekdayStr = 'MO' | 'TU' | 'WE' | 'TH' | 'FR' | 'SA' | 'SU';

                                                                                                                                                            Package Files (7)

                                                                                                                                                            Dependencies (1)

                                                                                                                                                            Dev Dependencies (28)

                                                                                                                                                            Peer Dependencies (0)

                                                                                                                                                            No peer dependencies.

                                                                                                                                                            Badge

                                                                                                                                                            To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                            You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/rrule.

                                                                                                                                                            • Markdown
                                                                                                                                                              [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/rrule)
                                                                                                                                                            • HTML
                                                                                                                                                              <a href="https://www.jsdocs.io/package/rrule"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>