UNPKG

4.34 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: (keyof Options)[];
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 declare 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>;
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 *
67 * @return Array
68 */
69 between(after: Date, before: Date, inc?: boolean, iterator?: (d: Date, len: number) => boolean): Date[];
70 /**
71 * Returns the last recurrence before the given datetime instance.
72 * The inc keyword defines what happens if dt is an occurrence.
73 * With inc == True, if dt itself is an occurrence, it will be returned.
74 *
75 * @return Date or null
76 */
77 before(dt: Date, inc?: boolean): Date | null;
78 /**
79 * Returns the first recurrence after the given datetime instance.
80 * The inc keyword defines what happens if dt is an occurrence.
81 * With inc == True, if dt itself is an occurrence, it will be returned.
82 *
83 * @return Date or null
84 */
85 after(dt: Date, inc?: boolean): Date | null;
86 /**
87 * Returns the number of recurrences in this set. It will have go trough
88 * the whole recurrence, if this hasn't been done before.
89 */
90 count(): number;
91 /**
92 * Converts the rrule into its string representation
93 *
94 * @see <http://www.ietf.org/rfc/rfc2445.txt>
95 * @return String
96 */
97 toString(): string;
98 /**
99 * Will convert all rules described in nlp:ToText
100 * to text.
101 */
102 toText(gettext?: GetText, language?: Language, dateFormatter?: DateFormatter): string;
103 isFullyConvertibleToText(): boolean;
104 /**
105 * @return a RRule instance with the same freq and options
106 * as this one (cache is not cloned)
107 */
108 clone(): RRule;
109}
110//# sourceMappingURL=rrule.d.ts.map
\No newline at end of file