package helpers import ( "time" "github.com/flosch/pongo2/v6" ) func TemplTimeDiff(in *pongo2.Value, param *pongo2.Value) (*pongo2.Value, *pongo2.Error) { if !in.IsTime() { return pongo2.AsSafeValue("invalid time"), nil } start := in.Time() now := time.Now() diff := now.Sub(start) return pongo2.AsSafeValue(diff.Milliseconds()), nil }