You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Date localization with .Date.Format doesn't translate e.g. names of Weekdays or Months in diffrent languages well. E.g. if you're trying to use a german datetime format, die Weekdays and Monthnames will stay in english, when using {{ .Date.Format .Site.Params.dateFormat }}
Reproduction steps
set in config.yml
languageCode: de
defaultContentLanguage: de
dateFormat: Mon, 02.01.2006 15:04:05
shortDateFormat: 02.01. 15:04
look at die date of an incident in web view -> english names.
Solution
Use {{ dateFormat .Site.Params.dateFormat .Params.date }} instead. dateFormat is an alias for time.Format (note: time)
it handles timeformats and translations correctly.
layouts/issues/issue.html uses .Date.Format in line 15. in line 55 & 74 dateFormat is used.
-> Change line 15 to {{ dateFormat .Site.Params.dateFormat .Params.date }}
layouts/issues/single.html -> change line 24 to {{ dateFormat .Site.Params.dateFormat .Lastmod }}
The text was updated successfully, but these errors were encountered:
Additionally: relative-time on the main page didn't respected the selected dateformat, but defaulted on UTC.
The Title-Attribute (hover) now displays time in the chosen dateformat. an additional Attribut data-date contains the UTC-Format for calculating the relative times using JavaScript. this way the hover shows the date in the selected format
Describe the bug
Date localization with .Date.Format doesn't translate e.g. names of Weekdays or Months in diffrent languages well. E.g. if you're trying to use a german datetime format, die Weekdays and Monthnames will stay in english, when using
{{ .Date.Format .Site.Params.dateFormat }}
Reproduction steps
set in
config.yml
languageCode: de
defaultContentLanguage: de
dateFormat: Mon, 02.01.2006 15:04:05
shortDateFormat: 02.01. 15:04
look at die date of an incident in web view -> english names.
Solution
Use
{{ dateFormat .Site.Params.dateFormat .Params.date }}
instead.dateFormat
is an alias fortime.Format
(note: time)it handles timeformats and translations correctly.
layouts/issues/issue.html
uses .Date.Format in line 15. in line 55 & 74 dateFormat is used.-> Change line 15 to
{{ dateFormat .Site.Params.dateFormat .Params.date }}
layouts/issues/single.html
-> change line 24 to{{ dateFormat .Site.Params.dateFormat .Lastmod }}
The text was updated successfully, but these errors were encountered: