Localize all the GroupBy*Date methods

Fixes #9745
This commit is contained in:
Bjørn Erik Pedersen
2022-04-05 09:57:58 +02:00
parent e0a882fd3b
commit 658e11ebaa
13 changed files with 144 additions and 42 deletions

View File

@@ -20,6 +20,7 @@ import (
qt "github.com/frankban/quicktest"
"github.com/gohugoio/hugo/common/htime"
translators "github.com/gohugoio/localescompressed"
)
@@ -27,7 +28,7 @@ func TestTimeLocation(t *testing.T) {
t.Parallel()
loc, _ := time.LoadLocation("America/Antigua")
ns := New(translators.GetTranslator("en"), loc)
ns := New(htime.NewTimeFormatter(translators.GetTranslator("en")), loc)
for i, test := range []struct {
name string
@@ -86,7 +87,7 @@ func TestFormat(t *testing.T) {
c.Run("UTC", func(c *qt.C) {
c.Parallel()
ns := New(translators.GetTranslator("en"), time.UTC)
ns := New(htime.NewTimeFormatter(translators.GetTranslator("en")), time.UTC)
for i, test := range []struct {
layout string
@@ -129,7 +130,7 @@ func TestFormat(t *testing.T) {
loc, err := time.LoadLocation("America/Los_Angeles")
c.Assert(err, qt.IsNil)
ns := New(translators.GetTranslator("en"), loc)
ns := New(htime.NewTimeFormatter(translators.GetTranslator("en")), loc)
d, err := ns.Format(":time_full", "2020-03-09T11:00:00")
@@ -143,7 +144,7 @@ func TestFormat(t *testing.T) {
func TestDuration(t *testing.T) {
t.Parallel()
ns := New(translators.GetTranslator("en"), time.UTC)
ns := New(htime.NewTimeFormatter(translators.GetTranslator("en")), time.UTC)
for i, test := range []struct {
unit any