obsidian-daily-notes-interface
Advanced tools
Comparing version 0.8.3 to 0.8.4
@@ -226,3 +226,3 @@ 'use strict'; | ||
.replace(/{{\s*title\s*}}/gi, filename) | ||
.replace(/{{\s*(date|time)\s*(([+-]\d+)([yqmwdhs]))?\s*(:.*)?}}/gi, (_, _timeOrDate, calc, timeDelta, unit, momentFormat) => { | ||
.replace(/{{\s*(date|time)\s*(([+-]\d+)([yqmwdhs]))?\s*(:.+?)?}}/gi, (_, _timeOrDate, calc, timeDelta, unit, momentFormat) => { | ||
const now = moment(); | ||
@@ -309,11 +309,16 @@ const currentDate = date.clone().set({ | ||
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); | ||
}) | ||
@@ -320,0 +325,0 @@ .replace(/{{\s*title\s*}}/gi, filename) |
{ | ||
"name": "obsidian-daily-notes-interface", | ||
"version": "0.8.3", | ||
"version": "0.8.4", | ||
"description": "Interface for creating daily notes in Obsidian", | ||
@@ -5,0 +5,0 @@ "author": "liamcain", |
25934
553