resources/resource: Fix GroupByParamDate with raw TOML dates

Closes #11563
This commit is contained in:
Joe Mooring
2023-11-13 13:34:41 -08:00
committed by Bjørn Erik Pedersen
parent 27620daa20
commit dd6cd6268d
2 changed files with 70 additions and 3 deletions

View File

@@ -18,6 +18,7 @@ import (
"time"
"github.com/gohugoio/hugo/helpers"
"github.com/pelletier/go-toml/v2"
"github.com/spf13/cast"
)
@@ -55,6 +56,10 @@ func getParam(r Resource, key string, stringToLower bool) any {
return cast.ToFloat64(v)
case time.Time:
return val
case toml.LocalDate:
return val.AsTime(time.UTC)
case toml.LocalDateTime:
return val.AsTime(time.UTC)
case []string:
if stringToLower {
return helpers.SliceToLower(val)
@@ -65,6 +70,5 @@ func getParam(r Resource, key string, stringToLower bool) any {
case map[any]any:
return v
}
return nil
}