Skip to content

Commit

Permalink
[#2494] Make sure the new timezone endpoint gets called in JavaScript
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Oderbolz committed Jun 30, 2015
1 parent ec775ed commit 58abf68
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ckan/public/base/javascript/main.js
Expand Up @@ -30,6 +30,20 @@ this.ckan = this.ckan || {};
ckan.SITE_ROOT = getRootFromData('siteRoot');
ckan.LOCALE_ROOT = getRootFromData('localeRoot');

/* Save UTC offset of user in browser to display dates correctly
* getTimezoneOffset returns the offset between the local time and UTC,
* but we want to store it the other way round.
* see http://mdn.io/getTimezoneOffset for details
*/
now = new Date();
utc_timezone_offset = -(now.getTimezoneOffset());
$.ajax(
ckan.sandbox().client.url('/util/set_timezone_offset/' + utc_timezone_offset),
{
async:false
}
);

// Load the localisations before instantiating the modules.
ckan.sandbox().client.getLocaleData(locale).done(function (data) {
ckan.i18n.load(data);
Expand Down

0 comments on commit 58abf68

Please sign in to comment.