Files
personal-hub/_templates/Add-Temporal.md
T
Marcel Arndt a2ad5f5c6d import vault
2026-07-16 14:04:45 +02:00

20 lines
820 B
Markdown

<%*
// temporal: gives this note a date, deadline, reminder or time range.
const componentName = "temporal";
const today = tp.date.now("YYYY-MM-DD");
const file = tp.file.find_tfile(tp.file.path(true));
setTimeout(async () => {
await tp.app.fileManager.processFrontMatter(file, (frontmatter) => {
const components = Array.isArray(frontmatter["components"]) ? frontmatter["components"] : [];
if (!components.includes(componentName)) components.push(componentName);
frontmatter["components"] = components;
frontmatter["time_at"] = frontmatter["time_at"] ?? today;
frontmatter["time_timezone"] = frontmatter["time_timezone"] ?? "Europe/Berlin";
frontmatter["time_recurrence"] = frontmatter["time_recurrence"] ?? "";
frontmatter["time_precision"] = frontmatter["time_precision"] ?? "date";
});
}, 300)
-%>