Change the date format for the showLastUpdateTime at the bottom of pages

Viewed 204

I've added the

          showLastUpdateTime: true,

line to my docusaurus.config.js, and the date is showing at the bottom of documents, but the format is US (which doesn't work for the majority of the world). I need it to be unambiguous, or not 'wrong' :D

Does anyone know how I can change this?

1 Answers

I don't believe you can explicitly set the format manually - it uses the default Intl.DateTimeFormat constructor under the hood - however you can manipulate it by setting the base locale of your site to something other than the default.

To do this, you need to leverage the i18n configuration - add this to your docusaurus.config.js:

i18n: {
  defaultLocale: 'en-GB',
  locales: ['en-GB']
}

Substitute en-GB for whatever your desired locale is, and you'll see the date show in that locale's format, so in the UK it's dd/MM/yyyy.

Related