Templater plugin (1.5 and newer): New Syntax and Examples

Hm. Thanks for bringing this up!

Something must have changed, or I made a stupid mistake. I also get PT0.219S (ISO duration, meaning 0.219 seconds) where it should be 219 days.

At least

<% moment("12-24", "MM-DD").diff(moment(), "days") %>

shows 219 (the correct # days). Which should be enough for the intended “days til Xmas”.

If, for some reason, it needs to be more exact, one could probably use

<% moment.duration(moment("12-24", "MM-DD").diff(moment())).as('days') %>

to arrive at 219.278469375 (at this moment in time).

Sorry if I messed something up!

4 Likes