UNPKG

4.57 kBTypeScriptView Raw
1import IterResult, { IterArgs } from './iterresult';
2import { Language } from './nlp/i18n';
3import { DateFormatter, GetText } from './nlp/totext';
4import { ParsedOptions, Options, Frequency, QueryMethods, QueryMethodTypes, IterResultType } from './types';
5import { parseString } from './parsestring';
6import { optionsToString } from './optionstostring';
7import { Cache, CacheKeys } from './cache';
8import { Weekday } from './weekday';
9export declare const Days: {
10 MO: Weekday;
11 TU: Weekday;
12 WE: Weekday;
13 TH: Weekday;
14 FR: Weekday;
15 SA: Weekday;
16 SU: Weekday;
17};
18export declare const DEFAULT_OPTIONS: Options;
19export declare const defaultKeys: ("freq" | "dtstart" | "interval" | "wkst" | "count" | "until" | "tzid" | "bysetpos" | "bymonth" | "bymonthday" | "bynmonthday" | "byyearday" | "byweekno" | "byweekday" | "bynweekday" | "byhour" | "byminute" | "bysecond" | "byeaster")[];
20/**
21 *
22 * @param {Options?} options - see <http://labix.org/python-dateutil/#head-cf004ee9a75592797e076752b2a889c10f445418>
23 * The only required option is `freq`, one of RRule.YEARLY, RRule.MONTHLY, ...
24 * @constructor
25 */
26export default class RRule implements QueryMethods {
27 _cache: Cache | null;
28 origOptions: Partial<Options>;
29 options: ParsedOptions;
30 static readonly FREQUENCIES: (keyof typeof Frequency)[];
31 static readonly YEARLY = Frequency.YEARLY;
32 static readonly MONTHLY = Frequency.MONTHLY;
33 static readonly WEEKLY = Frequency.WEEKLY;
34 static readonly DAILY = Frequency.DAILY;
35 static readonly HOURLY = Frequency.HOURLY;
36 static readonly MINUTELY = Frequency.MINUTELY;
37 static readonly SECONDLY = Frequency.SECONDLY;
38 static readonly MO: Weekday;
39 static readonly TU: Weekday;
40 static readonly WE: Weekday;
41 static readonly TH: Weekday;
42 static readonly FR: Weekday;
43 static readonly SA: Weekday;
44 static readonly SU: Weekday;
45 constructor(options?: Partial<Options>, noCache?: boolean);
46 static parseText(text: string, language?: Language): Partial<Options> | null;
47 static fromText(text: string, language?: Language): RRule;
48 static parseString: typeof parseString;
49 static fromString(str: string): RRule;
50 static optionsToString: typeof optionsToString;
51 protected _iter<M extends QueryMethodTypes>(iterResult: IterResult<M>): IterResultType<M>;
52 private _cacheGet;
53 _cacheAdd(what: CacheKeys | 'all', value: Date[] | Date | null, args?: Partial<IterArgs>): void;
54 /**
55 * @param {Function} iterator - optional function that will be called
56 * on each date that is added. It can return false
57 * to stop the iteration.
58 * @return Array containing all recurrences.
59 */
60 all(iterator?: (d: Date, len: number) => boolean): Date[];
61 /**
62 * Returns all the occurrences of the rrule between after and before.
63 * The inc keyword defines what happens if after and/or before are
64 * themselves occurrences. With inc == True, they will be included in the
65 * list, if they are found in the recurrence set.
66 * @return Array
67 */
68 between(after: Date, before: Date, inc?: boolean, iterator?: (d: Date, len: number) => boolean): Date[];
69 /**
70 * Returns the last recurrence before the given datetime instance.
71 * The inc keyword defines what happens if dt is an occurrence.
72 * With inc == True, if dt itself is an occurrence, it will be returned.
73 * @return Date or null
74 */
75 before(dt: Date, inc?: boolean): Date;
76 /**
77 * Returns the first recurrence after the given datetime instance.
78 * The inc keyword defines what happens if dt is an occurrence.
79 * With inc == True, if dt itself is an occurrence, it will be returned.
80 * @return Date or null
81 */
82 after(dt: Date, inc?: boolean): Date;
83 /**
84 * Returns the number of recurrences in this set. It will have go trough
85 * the whole recurrence, if this hasn't been done before.
86 */
87 count(): number;
88 /**
89 * Converts the rrule into its string representation
90 * @see <http://www.ietf.org/rfc/rfc2445.txt>
91 * @return String
92 */
93 toString(): string;
94 /**
95 * Will convert all rules described in nlp:ToText
96 * to text.
97 */
98 toText(gettext?: GetText, language?: Language, dateFormatter?: DateFormatter): string;
99 isFullyConvertibleToText(): boolean;
100 /**
101 * @return a RRule instance with the same freq and options
102 * as this one (cache is not cloned)
103 */
104 clone(): RRule;
105}
106//# sourceMappingURL=rrule.d.ts.map
\No newline at end of file