|
| 1 | +// Copyright 2017 The Hugo Authors. All rights reserved. |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | +// |
| 8 | +// Unless required by applicable law or agreed to in writing, software |
| 9 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | +// See the License for the specific language governing permissions and |
| 12 | +// limitations under the License. |
| 13 | + |
| 14 | +package time_test |
| 15 | + |
| 16 | +import ( |
| 17 | + "testing" |
| 18 | + |
| 19 | + "github.com/gohugoio/hugo/hugolib" |
| 20 | +) |
| 21 | + |
| 22 | +// See issue 14948. |
| 23 | +func TestTimeFormatMonthAbbreviationsEnGB(t *testing.T) { |
| 24 | + t.Parallel() |
| 25 | + |
| 26 | + files := ` |
| 27 | +-- hugo.toml -- |
| 28 | +locale = 'en-GB' |
| 29 | +disableKinds = ['page','rss','section','sitemap','taxonomy','term'] |
| 30 | +-- layouts/home.html -- |
| 31 | +{{ $dates := slice |
| 32 | + "2025-01-17T10:42:00-08:00" |
| 33 | + "2025-02-17T10:42:00-08:00" |
| 34 | + "2025-03-17T10:42:00-07:00" |
| 35 | + "2025-04-17T10:42:00-07:00" |
| 36 | + "2025-05-17T10:42:00-07:00" |
| 37 | + "2025-06-17T10:42:00-07:00" |
| 38 | + "2025-07-17T10:42:00-07:00" |
| 39 | + "2025-08-17T10:42:00-07:00" |
| 40 | + "2025-09-17T10:42:00-07:00" |
| 41 | + "2025-10-17T10:42:00-07:00" |
| 42 | + "2025-11-17T10:42:00-08:00" |
| 43 | + "2025-12-17T10:42:00-08:00" |
| 44 | +}} |
| 45 | +{{- range $dates }} |
| 46 | + {{- time.Format "Jan" . }}| |
| 47 | +{{- end }} |
| 48 | +` |
| 49 | + |
| 50 | + b := hugolib.Test(t, files) |
| 51 | + |
| 52 | + b.AssertFileContent("public/index.html", "Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sept|Oct|Nov|Dec|") |
| 53 | +} |
0 commit comments