Files
purple-explorer/views/includes/common.pug
T
joeuhren 40b6a641f5 Fix + format date/time values across entire site
-Added a new client-side library for date/time formatting: Luxon v1.26.0
-Added new date/time settings for display format, timezone (utc or local) and an option to enable alternate timezone tooltips
-All date/time values are now formatted via Luxon and displayed according to the new configurable settings
-All markets now return Trade History timestamp values as unix timestamp values formatted in seconds
2021-03-28 21:02:10 -06:00

11 lines
645 B
Plaintext

script(type='text/javascript', src='/js/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}');
}