Make special types for events and calendars.
This will simplify extracting values and already removes some redundancy.master
parent
eb2075d0ec
commit
864dad372f
@ -0,0 +1,31 @@
|
|||||||
|
import * as ICAL from 'ical.js';
|
||||||
|
|
||||||
|
export class EventType extends ICAL.Event {
|
||||||
|
get title() {
|
||||||
|
return this.summary;
|
||||||
|
}
|
||||||
|
|
||||||
|
get start() {
|
||||||
|
return this.startDate.toJSDate();
|
||||||
|
}
|
||||||
|
|
||||||
|
get end() {
|
||||||
|
return this.endDate.toJSDate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ContactType {
|
||||||
|
comp: ICAL.Component;
|
||||||
|
|
||||||
|
constructor(comp: ICAL.Component) {
|
||||||
|
this.comp = comp;
|
||||||
|
}
|
||||||
|
|
||||||
|
get uid() {
|
||||||
|
return this.comp.getFirstPropertyValue('uid');
|
||||||
|
}
|
||||||
|
|
||||||
|
get fn() {
|
||||||
|
return this.comp.getFirstPropertyValue('fn');
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue