diff --git a/esm/src/document.js b/esm/src/document.js
index 4d9346c..c24ccb9 100644
--- a/esm/src/document.js
+++ b/esm/src/document.js
@@ -210,9 +210,19 @@ export class List {
get note() {
return this.data.note || "";
}
- /** Date of last change */
+ /** Date of creation, or undefined if not available */
+ get createdAt() {
+ if (this.data.created !== undefined) {
+ return this.#companion.getRealTimestamp(this.data.created);
+ }
+ return undefined;
+ }
+ /** Date of last change, or undefined if not available */
get lastModifiedAt() {
- return this.#companion.getRealTimestamp(this.data.lastModified);
+ if (this.data.lastModified !== undefined) {
+ return this.#companion.getRealTimestamp(this.data.lastModified);
+ }
+ return undefined;
}
/** Date of completion, or undefined if not completed */
get completedAt() {
@@ -318,7 +328,7 @@ export class List {
});
this.#companion.shortIdMap.set(newId.split("-").pop(), newId);
this.itemIds.splice(priority, 0, newId);
- const parentid = this.id === "home" ? ROOT : this.id;
+ const parentid = this.id === ROOT ? "None" : this.id;
this.#companion.addOperation(this.data.treeId, {
type: "create",
data: {
diff --git a/esm/src/export.js b/esm/src/export.js
index 0213a2c..34f7ba6 100644
--- a/esm/src/export.js
+++ b/esm/src/export.js
@@ -53,6 +53,9 @@ export function toJson(list) {
name: list.name,
note: list.note,
isCompleted: list.isCompleted,
+ createdAt: list.createdAt?.toISOString(),
+ lastModifiedAt: list.lastModifiedAt?.toISOString(),
+ completedAt: list.completedAt?.toISOString(),
items: list.items.map((sublist) => toJson(sublist)),
};
}
diff --git a/esm/src/schema.js b/esm/src/schema.js
index f3d3e31..057da4a 100644
--- a/esm/src/schema.js
+++ b/esm/src/schema.js
@@ -48,6 +48,7 @@ export const TreeDataSchema = z.object({
prnt: z.string().or(z.null()),
pr: z.number(),
cp: z.number().optional(),
+ ct: z.number().optional(),
lm: z.number(),
metadata: z.object({
mirror: z.object({
@@ -63,6 +64,7 @@ export const TreeDataSchema = z.object({
parentId: i.prnt !== null ? i.prnt : ROOT,
priority: i.pr,
completed: i.cp,
+ created: i.ct,
lastModified: i.lm,
originalId: i.metadata?.mirror?.originalId,
isMirrorRoot: i.metadata?.mirror?.isMirrorRoot === true,