diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2021-07-28 18:02:42 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2021-07-28 18:02:42 +0200 |
commit | b5de37ee793c01f2acccdea7119be05c4182723f (patch) | |
tree | 3e756ee580e20c77a364a71231872e29b1c1dd23 /resources | |
parent | bf301daf158e5e9673ad5f457ea3a264315942b5 (diff) |
Handle toml.LocalDate and toml.LocalDateTime in front matter
See #8801
Diffstat (limited to 'resources')
-rw-r--r-- | resources/page/pagemeta/page_frontmatter.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/resources/page/pagemeta/page_frontmatter.go b/resources/page/pagemeta/page_frontmatter.go index 8e03c5f88..d473c69ce 100644 --- a/resources/page/pagemeta/page_frontmatter.go +++ b/resources/page/pagemeta/page_frontmatter.go @@ -17,6 +17,7 @@ import ( "strings" "time" + "github.com/gohugoio/hugo/common/htime" "github.com/gohugoio/hugo/common/paths" "github.com/gohugoio/hugo/common/loggers" @@ -130,7 +131,7 @@ func dateAndSlugFromBaseFilename(location *time.Location, name string) (time.Tim return time.Time{}, "" } - d, err := cast.ToTimeInDefaultLocationE(withoutExt[:10], location) + d, err := htime.ToTimeInDefaultLocationE(withoutExt[:10], location) if err != nil { return time.Time{}, "" } @@ -371,7 +372,7 @@ func (f *frontmatterFieldHandlers) newDateFieldHandler(key string, setter func(d return false, nil } - date, err := cast.ToTimeInDefaultLocationE(v, d.Location) + date, err := htime.ToTimeInDefaultLocationE(v, d.Location) if err != nil { return false, nil } |