Hey @dryice! I’ve actually once written two complete moment.js addons for rounding date/time and generating date/time intervals. These are a little more complicated and not so easy to add to Obsidian, so here are two simpler solutions, maybe one of these fits your bill:
Very simple (and ugly) solution without Javascript:
- <% moment().add(15-(moment().minute()%15),'minutes').startOf('minute').format('HH:mm') %>
- <% moment().add(15-(moment().minute()%15),'minutes').startOf('minute').add(15, 'minutes').format('HH:mm') %>
- <% moment().add(15-(moment().minute()%15),'minutes').startOf('minute').add(30, 'minutes').format('HH:mm') %>
Simple solution using Javascript:
<%*
let start = moment().add(15-(moment().minute()%15),'minutes').startOf('minute');
tR += "- " + start.format('HH:mm') + " \n";
// moment.js dates are mutable, so always only add 15 mins!
tR += "- " + start.add(15, 'minutes').format('HH:mm') + " \n";
tR += "- " + start.add(15, 'minutes').format('HH:mm') + " \n";
%>
It is assumed that both of these are saved as a Templater template in the template folder, and inserted upon request (Alt+E).
Result (for both) should be (at 19:58:17):