-
Notifications
You must be signed in to change notification settings - Fork 162
/
types.ts
111 lines (97 loc) · 2.82 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/**
* ical-generator supports [native Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date),
* [moment.js](https://momentjs.com/) (and [moment-timezone](https://momentjs.com/timezone/), [Day.js](https://day.js.org/en/) and
* [Luxon](https://moment.github.io/luxon/)'s [DateTime](https://moment.github.io/luxon/docs/class/src/datetime.js~DateTime.html)
* objects. You can also pass a string which is then passed to javascript's Date internally.
*/
export type ICalDateTimeValue = Date | ICalMomentStub | ICalMomentTimezoneStub | ICalLuxonDateTimeStub | ICalDayJsStub | string;
export interface ICalRepeatingOptions {
freq: ICalEventRepeatingFreq;
count?: number;
interval?: number;
until?: ICalDateTimeValue;
byDay?: ICalWeekday[] | ICalWeekday;
byMonth?: number[] | number;
byMonthDay?: number[] | number;
bySetPos?: number[] | number;
exclude?: ICalDateTimeValue[] | ICalDateTimeValue;
startOfWeek?: ICalWeekday;
}
export interface ICalLocation {
title: string;
address?: string;
radius?: number;
geo?: ICalGeo;
}
export interface ICalGeo {
lat: number;
lon: number;
}
export interface ICalOrganizer {
name: string;
email?: string;
mailto?: string;
sentBy?: string;
}
export interface ICalDescription {
plain: string;
html?: string;
}
export interface ICalTimezone {
name: string | null;
generator?: (timezone: string) => string|null;
}
export interface ICalMomentStub {
format(format?: string): string;
clone(): ICalMomentStub;
utc(): ICalMomentStub;
toDate(): Date;
isValid(): boolean;
toJSON(): string;
}
export interface ICalMomentTimezoneStub extends ICalMomentStub {
clone(): ICalMomentTimezoneStub;
utc(): ICalMomentTimezoneStub;
tz(): string | undefined;
tz(timezone: string): ICalMomentTimezoneStub;
}
export interface ICalMomentDurationStub {
asSeconds(): number;
}
export interface ICalLuxonDateTimeStub {
setZone(zone?: string): ICalLuxonDateTimeStub;
toFormat(fmt: string): string;
toJSDate(): Date;
get isValid(): boolean;
toJSON(): string | null;
}
export interface ICalDayJsStub {
tz(zone?: string): ICalDayJsStub;
utc(): ICalDayJsStub;
format(format?: string): string;
toDate(): Date;
isValid(): boolean;
toJSON(): string;
}
export interface ICalRRuleStub {
between(after: Date, before: Date, inc?: boolean, iterator?: (d: Date, len: number) => boolean): Date[];
toString(): string;
}
export enum ICalEventRepeatingFreq {
SECONDLY = 'SECONDLY',
MINUTELY = 'MINUTELY',
HOURLY = 'HOURLY',
DAILY = 'DAILY',
WEEKLY = 'WEEKLY',
MONTHLY = 'MONTHLY',
YEARLY = 'YEARLY'
}
export enum ICalWeekday {
SU = 'SU',
MO = 'MO',
TU = 'TU',
WE = 'WE',
TH = 'TH',
FR = 'FR',
SA = 'SA'
}