Skip to content

Commit

Permalink
Merge pull request #3342 from fanderegg/fix-format-date-language
Browse files Browse the repository at this point in the history
javascript: use ckan locale instead of browser locale to format dates
  • Loading branch information
wardi committed Dec 6, 2016
2 parents f733a24 + 2438938 commit 7c39683
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions ckan/public/base/javascript/main.js
Expand Up @@ -20,7 +20,6 @@ this.ckan = this.ckan || {};
ckan.initialize = function () {
var body = jQuery('body');
var locale = jQuery('html').attr('lang');
var browserLocale = window.navigator.userLanguage || window.navigator.language;
var location = window.location;
var root = location.protocol + '//' + location.host;

Expand All @@ -33,7 +32,7 @@ this.ckan = this.ckan || {};

// Convert all datetimes to the users timezone
jQuery('.automatic-local-datetime').each(function() {
moment.locale(browserLocale);
moment.locale(locale);
var date = moment(jQuery(this).data('datetime'));
if (date.isValid()) {
jQuery(this).html(date.format("LL, LT ([UTC]Z)"));
Expand Down

0 comments on commit 7c39683

Please sign in to comment.