How can an admin set the datetime format?

How can an admin specify the datetime format used by their Discourse installation? We’d like to standardize on ISO 8601 across all our webapps.

2 Likes

You can change the client-side ones with code in </head>:

<script>
I18n.translations.en.js.dates.time = "HH:mm"
I18n.translations.en.js.dates.long_with_year = "DD MMM YYYY HH:mm:ss"
I18n.translations.en.js.dates.long_date_with_year = "DD MMM YYYY HH:mm:ss"
I18n.translations.en.js.dates.long_no_year_no_time = "DD MMM YYYY"
I18n.translations.en.js.dates.long_with_year_no_time = "DD MMM YYYY"
</script>

Build the rest using http://momentjs.com/docs/

3 Likes

Thanks, but even when adding those changes you provided, I don’t see the new formats showing up anywhere in a new browser session. Looked on badge listings, the full date-time in a post’s “share” box, hover/tooltips, etc.

Is there anything to do other than adding them to the proper place in admin customizations?

You need to do all of the formats. Put I18n.translations.en.js.dates in your browser console and expand the object to see the rest.

1 Like

There really are a lot of formats involved. Even pulling out a list of them from that object via the browser console is a daunting task.

riking, is it possible to give a simple guide to what’s involved with the momentjs stuff? Is there a path through this that someone who is not a javascript developer could follow?

This topic was automatically closed after 3329 days. New replies are no longer allowed.