Date formats and resource bundles
Note
This section describes using resource bundles to customize the front end. For information about using resource bundles to customize Brightspot's widgets, dashboard, reports, and other editorial components, see Customizing Brightspot's labels.
Brightspot displays dates with a default Java format of MMMM d, yyyy hh:mm aa
, such as September 8, 2017 02:38 PM.
You can customize the date format by site, theme, content type, and language. For example, you can specify a 12-hour format for general-interest articles, and a 24-hour format for defense-related articles.
Priority of date formats
When resolving the date format to apply, Brightspot checks the following hierarchy and uses the first one available.
Use a format configured in theme's properties (see below).
Use a format configured in a site's settings (see Configuring a site's date format).
Use a format appearing in a view model (see Formatting dates using view models).
Use
MMMM d, yyyy hh:mm aa
.
Configuring date formats with a resource bundle
Change to or create the path
/themes/<theme_name>/resources/brightspot/view/core/
.Change to or create the subdirectory corresponding to the required View for the content type. For example, if you are configuring the date format for the articles' View, change to the subdirectory
article
.Create or open the file
<View>Override.properties
or<View>Override_<language-code>.properties
. Examples:The file
ArticlePageViewOverride.properties
specifies the date format for Views associated with articles.The file
ArticlePageViewOverride_fr.properties
specifies the date format for Views associated with articles displayed in French.For a list of two-letter language codes, see Codes for the Representation of Names of Languages.
In the properties file, add a line of the form
dateFormat=<format-string>
.Construct
format-string
from the listing in Patterns for Formatting and Parsing in the Java class DateTimeFormatter.Example:
dateFormat=YYYY-MMMM-dd HH:mm
displays a date such as2017-September-12 15:05
. Do not enclose the format string in quotes.
Reload or rebuild your Brightspot project.