Skip to Content
DocsConfigure O3Configure calendars

Configuring Calendars

With the O3 frontend, we aim to support a wide range of requirements around displaying dates and times in order to ensure that users can see date data in a format that is easy for them to understand.

Locale-preferred calendars

While the OpenMRS backend tends to represent dates using the Gregorian calendar, the O3 frontend supports displaying and capturing dates in many different calendar systems, specifically those supported by the @internationalized/date  library.

Currently the way OpenMRS supports this is by associating a default calendar to a locale. For example, I might want my system to display in mostly English text, but use the Ethiopic calendar system. This is configurable using the preferredCalendar option of the @openmrs/esm-styleguide namespace. To configure displaying English text with the Ethiopic calendar, you would need the following configuration snippet added to your frontend configuration:

{ "@openmrs/esm-styleguide": { "preferredCalendar": { "en": "ethiopic", "en-GB": "ethiopic" } } }

Alternative date formatting

One requirement we sometimes have is to override the default formatting of dates in the O3 date pickers. By default, OpenMRS date pickers display dates in English using British date formatting, but this can be configured similarly to the preferred calendar. If I want dates displayed according to French Canadian standards while keeping English as the application language, I can do that with this configuration snippet:

{ "@openmrs/esm-styleguide": { "preferredDateLocale": { "en": "fr-CA" } } }
Last updated on