I am using the templater plugin to create a list of task for my day.
My list looks like this:
Day Planner
<% tp.date.now(“HH:mm”) %> First task
<% tp.date.now(“HH:mm”,60) %> Second task <—Current time incremented by 60 minutes
<% tp.date.now(“HH:mm”,120) %> Third task <—Current time incremented by 120 minutes
The time for the first task is correctly inserted when I invoke the template.
For the second task I want to be able to increase the current time by 60 minutes.
Its possible to increment the current time using the templater?
And only the last variant with adding 1 year and 2 months, where effective.
In other words, it seems like you need to switch to javascript and use moment() to get the time calculation you want. So here are some actually working variants:
Is there a way somehow to add to a saved time?
Something like:
<%* const currentTime= moment().format("HH:mm") _%>
- 1 hour after current time: <%* tR += currentTime.add(1, "h").format("HH:mm") %>
- 1 hour after last value of tR or 2 hours after current time: <%* tR += tR.add(1,"h").format("HH:mm") %>
- 2 hours after last value of tR or 4 hours after current time: <%* tR += tR.add(2, "h").format("HH:mm") %>
// If you want to fix the start time, use something like
// const startTime = moment("2000-01-02T08:00")
// For current time, use the line below
const startTime = moment()
function addOffset(offset) {
return startTime.clone().add(offset).format("HH:mm")
}
tR += "- 1 hour and 5 min after current time: " + addOffset("PT1H5M") + "\n"
tR += `- 45 min after start: ${ addOffset("PT45M") }\n`
_%>
- 2 hours since start: <% addOffset("PT2H") %>
- 2.5 hours: <% addOffset("PT2H30M") %>
Here I show how to use that extra function in three different version, all using a standard ISO 8601 way of defining the time period to add to your starting time.