obsidian-daily-notes-interface
Advanced tools
Comparing version 0.9.0 to 0.9.1
@@ -381,11 +381,16 @@ 'use strict'; | ||
const createdFile = await vault.create(normalizedPath, templateContents | ||
.replace(/{{\s*(date|time)\s*:(.*?)}}/gi, (_, _timeOrDate, momentFormat) => { | ||
.replace(/{{\s*(date|time)\s*(([+-]\d+)([yqmwdhs]))?\s*(:.+?)?}}/gi, (_, _timeOrDate, calc, timeDelta, unit, momentFormat) => { | ||
const now = window.moment(); | ||
return date | ||
.set({ | ||
const currentDate = date.clone().set({ | ||
hour: now.get("hour"), | ||
minute: now.get("minute"), | ||
second: now.get("second"), | ||
}) | ||
.format(momentFormat.trim()); | ||
}); | ||
if (calc) { | ||
currentDate.add(parseInt(timeDelta, 10), unit); | ||
} | ||
if (momentFormat) { | ||
return currentDate.format(momentFormat.substring(1).trim()); | ||
} | ||
return currentDate.format(format); | ||
}) | ||
@@ -392,0 +397,0 @@ .replace(/{{\s*date\s*}}/gi, filename) |
{ | ||
"name": "obsidian-daily-notes-interface", | ||
"version": "0.9.0", | ||
"version": "0.9.1", | ||
"description": "Interface for creating daily notes in Obsidian", | ||
@@ -5,0 +5,0 @@ "author": "liamcain", |
26867
572