mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
GroupByParamDate now supports datetimes
Previously, the method only worked for date strings but not (for instance) full RFC3339 datetime strings.
This commit is contained in:
parent
a9718f44cd
commit
f9f779786e
2 changed files with 3 additions and 2 deletions
|
@ -316,7 +316,7 @@ func (p Pages) GroupByParamDate(key string, format string, order ...string) (Pag
|
||||||
var r Pages
|
var r Pages
|
||||||
|
|
||||||
for _, p := range pages {
|
for _, p := range pages {
|
||||||
param := resource.GetParamToLower(p, key)
|
param := resource.GetParam(p, key)
|
||||||
var t time.Time
|
var t time.Time
|
||||||
|
|
||||||
if param != nil {
|
if param != nil {
|
||||||
|
|
|
@ -34,7 +34,8 @@ var pageGroupTestSources = []pageGroupTestObject{
|
||||||
{"/section1/testpage2.md", 3, "2012-01-01", "bar"},
|
{"/section1/testpage2.md", 3, "2012-01-01", "bar"},
|
||||||
{"/section1/testpage3.md", 2, "2012-04-06", "foo"},
|
{"/section1/testpage3.md", 2, "2012-04-06", "foo"},
|
||||||
{"/section2/testpage4.md", 1, "2012-03-02", "bar"},
|
{"/section2/testpage4.md", 1, "2012-03-02", "bar"},
|
||||||
{"/section2/testpage5.md", 1, "2012-04-06", "baz"},
|
// date might also be a full datetime:
|
||||||
|
{"/section2/testpage5.md", 1, "2012-04-06T00:00:00Z", "baz"},
|
||||||
}
|
}
|
||||||
|
|
||||||
func preparePageGroupTestPages(t *testing.T) Pages {
|
func preparePageGroupTestPages(t *testing.T) Pages {
|
||||||
|
|
Loading…
Reference in a new issue