mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-28 22:19:59 +02:00
@@ -19,6 +19,8 @@ import (
|
||||
"time"
|
||||
_time "time"
|
||||
|
||||
"github.com/gohugoio/hugo/common/hreflect"
|
||||
|
||||
"github.com/gohugoio/hugo/common/htime"
|
||||
|
||||
"github.com/gohugoio/locales"
|
||||
@@ -43,6 +45,9 @@ type Namespace struct {
|
||||
// AsTime converts the textual representation of the datetime string into
|
||||
// a time.Time interface.
|
||||
func (ns *Namespace) AsTime(v interface{}, args ...interface{}) (interface{}, error) {
|
||||
if !hreflect.IsTruthful(v) {
|
||||
return time.Time{}, nil
|
||||
}
|
||||
loc := ns.location
|
||||
if len(args) > 0 {
|
||||
locStr, err := cast.ToStringE(args[0])
|
||||
|
Reference in New Issue
Block a user