Add a {time} template helper, reuse timestamp code from Quick Note as a niceTime (#555)

niceTime helper
This commit is contained in:
johnl
2023-11-03 12:04:51 +01:00
committed by GitHub
parent e0b6fbed3e
commit 0e2a802bbd
3 changed files with 12 additions and 5 deletions
+2 -1
View File
@@ -1,4 +1,4 @@
import { niceDate } from "$sb/lib/dates.ts";
import { niceDate, niceTime } from "$sb/lib/dates.ts";
export function handlebarHelpers() {
return {
@@ -15,6 +15,7 @@ export function handlebarHelpers() {
substring: (s: string, from: number, to: number, elipsis = "") =>
s.length > to - from ? s.substring(from, to) + elipsis : s,
time: () => niceTime(new Date()),
today: () => niceDate(new Date()),
tomorrow: () => {
const tomorrow = new Date();