Documentation
¶
Overview ¶
Package datefmt writes dates in the language they are being read in.
Go's time package formats month and day names in English only, so {{.PublishedAt.Format "January 2, 2006"}} on a French page reads "July 30, 2026" — the one English string on an otherwise translated page. This package holds the small amount of knowledge needed to avoid that: how each language the CMS knows orders a date, and what it calls the months.
It covers the languages the CMS itself is translated into (English and French, matching the admin UI) and falls back to English formatting for any other locale, which is the same behaviour a host gets today. A site running in a language that isn't here formats its own dates in its own templates, as it always could.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Long ¶
Long writes a date the way a sentence would: "July 30, 2026" in English, "30 juillet 2026" in French. It is what a post's date line wants, and what {{cmsDate}} renders.
The first of the month is "1er juillet" in French — the one ordinal French uses in a date, and the reason this is not a format string.
Types ¶
This section is empty.