mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-20 21:31:32 +02:00
resources/resource: Fix GroupByParamDate with raw TOML dates
Closes #11563
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
27620daa20
commit
dd6cd6268d
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user