-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
251 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,250 @@ | ||
declare module 'ical.js' { | ||
function parse(input: string): unknown[] | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-extraneous-class | ||
export class helpers { | ||
public static updateTimezones(vcal: Component): Component | ||
} | ||
|
||
class Component { | ||
public static fromString(str: string): Component | ||
|
||
public name: string | ||
|
||
constructor(jCal: unknown[] | string, parent?: Component) | ||
|
||
public toJSON(): unknown[] | ||
|
||
public getFirstSubcomponent(name?: string): Component | null | ||
|
||
public getAllSubcomponents(name?: string): Component[] | ||
|
||
public getFirstPropertyValue<T = unknown>(name?: string): T | ||
|
||
public getFirstProperty(name?: string): Property | ||
|
||
public getAllProperties(name?: string): Property[] | ||
|
||
public addProperty(property: Property): Property | ||
|
||
public addPropertyWithValue( | ||
name: string, | ||
value: string | number | object, | ||
): Property | ||
|
||
public updatePropertyWithValue( | ||
name: string, | ||
value: string | number | object, | ||
): Property | ||
|
||
public removeAllProperties(name?: string): boolean | ||
|
||
public addSubcomponent(component: Component): Component | ||
} | ||
|
||
export class Event { | ||
public uid: string | ||
public summary: string | ||
public startDate: Time | ||
public endDate: Time | ||
public description: string | ||
public location: string | ||
public attendees: Property[] | ||
|
||
public component: Component | ||
|
||
public constructor( | ||
component?: Component | null, | ||
options?: { | ||
strictExceptions: boolean | ||
exceptions: (Component | Event)[] | ||
}, | ||
) | ||
|
||
public isRecurring(): boolean | ||
|
||
public iterator(startTime?: Time): RecurExpansion | ||
} | ||
|
||
export class Property { | ||
public name: string | ||
public type: string | ||
|
||
constructor(jCal: unknown[] | string, parent?: Component) | ||
|
||
public getFirstValue<T = unknown>(): T | ||
|
||
public getValues<T = unknown>(): T[] | ||
|
||
public setParameter(name: string, value: string | string[]): void | ||
|
||
public setValue(value: string | object): void | ||
|
||
public setValues(values: (string | object)[]): void | ||
|
||
public toJSON(): unknown | ||
} | ||
|
||
interface TimeJsonData { | ||
year?: number | ||
month?: number | ||
day?: number | ||
hour?: number | ||
minute?: number | ||
second?: number | ||
isDate?: boolean | ||
} | ||
|
||
export class Time { | ||
public static fromString(str: string): Time | ||
|
||
public static fromJSDate(aDate: Date | null, useUTC: boolean): Time | ||
|
||
public static fromData(aData: TimeJsonData): Time | ||
|
||
public static now(): Time | ||
|
||
public isDate: boolean | ||
public timezone: string | ||
public zone: Timezone | ||
|
||
public year: number | ||
public month: number | ||
public day: number | ||
public hour: number | ||
public minute: number | ||
public second: number | ||
|
||
constructor(data?: TimeJsonData) | ||
|
||
public compare(aOther: Time): number | ||
|
||
public clone(): Time | ||
|
||
public convertToZone(zone: Timezone): Time | ||
|
||
public adjust( | ||
aExtraDays: number, | ||
aExtraHours: number, | ||
aExtraMinutes: number, | ||
aExtraSeconds: number, | ||
aTimeOpt?: Time, | ||
): void | ||
|
||
public addDuration(aDuration: Duration): void | ||
|
||
public subtractDateTz(aDate: Time): Duration | ||
|
||
public toUnixTime(): number | ||
|
||
public toJSDate(): Date | ||
|
||
public toJSON(): TimeJsonData | ||
|
||
public toString(): string | ||
} | ||
|
||
export class Duration { | ||
public days: number | ||
} | ||
|
||
export class RecurExpansion { | ||
public complete: boolean | ||
|
||
public next(): Time | ||
} | ||
|
||
export class Timezone { | ||
public static utcTimezone: Timezone | ||
public static localTimezone: Timezone | ||
|
||
public static convert_time( | ||
tt: Time, | ||
fromZone: Timezone, | ||
toZone: Timezone, | ||
): Time | ||
|
||
public tzid: string | ||
public component: Component | ||
|
||
constructor( | ||
data: | ||
| Component | ||
| { | ||
component: string | Component | ||
tzId?: string | ||
location?: string | ||
tzNames?: string | ||
latitude?: number | ||
longitude?: number | ||
}, | ||
) | ||
} | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-extraneous-class | ||
export class TimezoneService { | ||
public static get(tzid: string): Timezone | null | ||
|
||
public static has(tzid: string): boolean | ||
|
||
public static register(tzid: string, zone: Timezone | Component) | ||
|
||
public static remove(tzid: string): Timezone | null | ||
} | ||
|
||
export type FrequencyValues = | ||
| 'YEARLY' | ||
| 'MONTHLY' | ||
| 'WEEKLY' | ||
| 'DAILY' | ||
| 'HOURLY' | ||
| 'MINUTELY' | ||
| 'SECONDLY' | ||
|
||
export enum WeekDay { | ||
SU = 1, | ||
MO, | ||
TU, | ||
WE, | ||
TH, | ||
FR, | ||
SA, | ||
} | ||
|
||
export class RecurData { | ||
public freq?: FrequencyValues | ||
public interval?: number | ||
public wkst?: WeekDay | ||
public until?: Time | ||
public count?: number | ||
public bysecond?: number[] | number | ||
public byminute?: number[] | number | ||
public byhour?: number[] | number | ||
public byday?: string[] | string | ||
public bymonthday?: number[] | number | ||
public byyearday?: number[] | number | ||
public byweekno?: number[] | number | ||
public bymonth?: number[] | number | ||
public bysetpos?: number[] | number | ||
} | ||
|
||
export class RecurIterator { | ||
public next(): Time | ||
} | ||
|
||
export class Recur { | ||
constructor(data?: RecurData) | ||
|
||
public until: Time | null | ||
public freq: FrequencyValues | ||
public count: number | null | ||
|
||
public clone(): Recur | ||
|
||
public toJSON(): Omit<RecurData, 'until'> & {until?: string} | ||
|
||
public iterator(startTime?: Time): RecurIterator | ||
|
||
public isByCount(): boolean | ||
} | ||
} |