In my case the time entries are in my daily Periodic Notes journals. The script looks like this:
// Open the latest journal file
const latest = this.journal[0]
await this.goToFile(latest.file.path)
// Find the end of the time tracking section
const contents = await this.getContents(latest.file.path)
const match = contents.match(/^.*?\n## 🕔 Time tracking.*?\n---/s)
if (match) {
const lines = match[0].split('\n').slice(0, -2)
// Move cursor to end of time tracking section
await this.setEditMode(true)
await this.sleep(20)
this.view.editor.focus()
this.view.editor.setCursor({ line: lines.length - 1, ch: lines[lines.length - 1].length })
await this.sleep(50)
return moment().format('HH:mm') + '-'
}
return ''
The template part is really just:
moment().format('HH:mm') + '-'