You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.1 KiB
TypeScript
59 lines
1.1 KiB
TypeScript
7 years ago
|
import * as ICAL from 'ical.js';
|
||
|
|
||
|
export class EventType extends ICAL.Event {
|
||
7 years ago
|
color: string;
|
||
|
|
||
7 years ago
|
static fromVCalendar(comp: ICAL.Component) {
|
||
|
return new EventType(comp.getFirstSubcomponent('vevent'));
|
||
|
}
|
||
|
|
||
7 years ago
|
get title() {
|
||
|
return this.summary;
|
||
|
}
|
||
|
|
||
|
get start() {
|
||
7 years ago
|
return this.startDate.toJSDate();
|
||
7 years ago
|
}
|
||
|
|
||
|
get end() {
|
||
7 years ago
|
return this.endDate.toJSDate();
|
||
7 years ago
|
}
|
||
7 years ago
|
|
||
7 years ago
|
toIcal() {
|
||
|
let comp = new ICAL.Component(['vcalendar', [], []]);
|
||
|
comp.updatePropertyWithValue('prodid', '-//iCal.js EteSync Web');
|
||
7 years ago
|
comp.updatePropertyWithValue('version', '4.0');
|
||
7 years ago
|
|
||
|
comp.addSubcomponent(this.component);
|
||
|
return comp.toString();
|
||
7 years ago
|
}
|
||
7 years ago
|
|
||
|
clone() {
|
||
|
return new EventType(new ICAL.Component(this.component.toJSON()));
|
||
|
}
|
||
7 years ago
|
}
|
||
|
|
||
|
export class ContactType {
|
||
|
comp: ICAL.Component;
|
||
|
|
||
|
constructor(comp: ICAL.Component) {
|
||
|
this.comp = comp;
|
||
|
}
|
||
|
|
||
7 years ago
|
toIcal() {
|
||
|
return this.comp.toString();
|
||
|
}
|
||
|
|
||
7 years ago
|
clone() {
|
||
|
return new ContactType(new ICAL.Component(this.comp.toJSON()));
|
||
|
}
|
||
|
|
||
7 years ago
|
get uid() {
|
||
|
return this.comp.getFirstPropertyValue('uid');
|
||
|
}
|
||
|
|
||
|
get fn() {
|
||
|
return this.comp.getFirstPropertyValue('fn');
|
||
|
}
|
||
|
}
|