Tasks: fix handling of categories.

We were wrongly creating them as strings instead of arrays,
which was causig them to be serialized wrong.

Fixes #171
master
Tom Hacohen 4 years ago
parent 66331a4e2a
commit 31aa091893

@ -209,12 +209,18 @@ export class TaskType extends EventType {
} }
set tags(tags: string[]) { set tags(tags: string[]) {
this.component.updatePropertyWithValue("categories", tags.join(",")); const property = this.component.getFirstProperty("categories");
if (property) {
property.setValues(tags);
} else {
const newProp = new ICAL.Property("categories", this.component);
newProp.setValues(tags);
this.component.addProperty(newProp);
}
} }
get tags() { get tags() {
const tags = this.component.getFirstPropertyValue("categories"); return this.component.getFirstProperty("categories")?.getValues() ?? [];
return tags ? tags.split(",") : [];
} }
set dueDate(date: ICAL.Time | undefined) { set dueDate(date: ICAL.Time | undefined) {

Loading…
Cancel
Save