Move the creating event from calendar to one place.

master
Tom Hacohen 7 years ago
parent 03bbc7af17
commit 0fb37c1132

@ -51,7 +51,7 @@ class JournalEntries extends React.Component {
let name; let name;
let uid; let uid;
if (comp.name === 'vcalendar') { if (comp.name === 'vcalendar') {
const vevent = new EventType(comp.getFirstSubcomponent('vevent')); const vevent = EventType.fromVCalendar(comp);
name = vevent.summary; name = vevent.summary;
uid = vevent.uid; uid = vevent.uid;
} else if (comp.name === 'vcard') { } else if (comp.name === 'vcard') {

@ -50,7 +50,7 @@ export function syncEntriesToCalendarItemMap(collection: EteSync.CollectionInfo,
const color = colorIntToHtml(collection.color); const color = colorIntToHtml(collection.color);
for (const syncEntry of entries) { for (const syncEntry of entries) {
let comp = new EventType(new ICAL.Component(ICAL.parse(syncEntry.content)).getFirstSubcomponent('vevent')); let comp = EventType.fromVCalendar(new ICAL.Component(ICAL.parse(syncEntry.content)));
if (comp === null) { if (comp === null) {
continue; continue;

@ -14,6 +14,10 @@ export class EventType extends ICAL.Event {
get end() { get end() {
return this.endDate.toJSDate(); return this.endDate.toJSDate();
} }
static fromVCalendar(comp: ICAL.Component) {
return new EventType(comp.getFirstSubcomponent('vevent'));
}
} }
export class ContactType { export class ContactType {

Loading…
Cancel
Save