3dca953980
-Most modern browsers already have ECMAScript Internationalization API support built-in, but many older browsers do not. For these unsupported browsers, Luxon would fail to load the formatted dates on many of the explorer pages which would cause a cascading effect of not loading other data leading to a broken experience. A polyfilled version of Intl.js is now being loaded into the site which will only be downloaded when using a browser that does not already have Internationalization API support
12 lines
802 B
Plaintext
12 lines
802 B
Plaintext
script(type='text/javascript', src='https://polyfill.io/v3/polyfill.min.js?version=3.111.0&features=Intl')
|
|
script(type='text/javascript', src='https://cdn.jsdelivr.net/npm/luxon@2.1.1/build/global/luxon.min.js')
|
|
script.
|
|
function format_unixtime(unixtime, alt) {
|
|
if (alt == null)
|
|
alt = false;
|
|
// check if this date should be displayed in utc or local timezone
|
|
if (('#{settings.shared_pages.date_time.timezone}'.toLowerCase() == 'local' && !alt) || ('#{settings.shared_pages.date_time.timezone}'.toLowerCase() == 'utc' && alt))
|
|
return luxon.DateTime.fromSeconds(unixtime).toLocal().toFormat('#{settings.shared_pages.date_time.display_format}');
|
|
else
|
|
return luxon.DateTime.fromSeconds(unixtime).toUTC().toFormat('#{settings.shared_pages.date_time.display_format}');
|
|
} |