diff options
author | satotake <doublequotation@gmail.com> | 2022-04-27 02:57:04 +0900 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-05-08 16:56:26 +0200 |
commit | e77ca3c105bd64c5077d823d2127f6f812a4f681 (patch) | |
tree | ebbe9c310bfab1e34f9fd2e36b738fd2a37d6f11 /tpl/time | |
parent | f2946da9e806c2bafbdd26707fe339db79bd980b (diff) |
Add `clock` cli flag
Close #8787
Diffstat (limited to 'tpl/time')
-rw-r--r-- | tpl/time/init.go | 1 | ||||
-rw-r--r-- | tpl/time/time.go | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/tpl/time/init.go b/tpl/time/init.go index 4bb2ddf67..7dd71f210 100644 --- a/tpl/time/init.go +++ b/tpl/time/init.go @@ -28,6 +28,7 @@ func init() { if d.Language == nil { panic("Language must be set") } + ctx := New(langs.GetTimeFormatter(d.Language), langs.GetLocation(d.Language)) ns := &internal.TemplateFuncsNamespace{ diff --git a/tpl/time/time.go b/tpl/time/time.go index 623b7206a..cd78b83aa 100644 --- a/tpl/time/time.go +++ b/tpl/time/time.go @@ -68,9 +68,9 @@ func (ns *Namespace) Format(layout string, v any) (string, error) { return ns.timeFormatter.Format(t, layout), nil } -// Now returns the current local time. +// Now returns the current local time or `clock` time func (ns *Namespace) Now() _time.Time { - return _time.Now() + return htime.Now() } // ParseDuration parses the duration string s. |