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
This commit is contained in:
joeuhren
2021-03-28 21:02:10 -06:00
parent 9cdcfe659f
commit 40b6a641f5
22 changed files with 199 additions and 84 deletions
+1 -1
View File
@@ -65,7 +65,7 @@ function get_trades(coin, exchange, cb) {
price: body[i]['price'],
quantity: body[i]['amount'],
total: body[i]['total'],
timestamp: new Date(body[i]['created_at'] * 1000).toUTCString()
timestamp: body[i]['created_at']
};
trades.push(trade);
+1 -1
View File
@@ -53,7 +53,7 @@ function get_trades(coin, exchange, cb) {
ordertype: body[i]['takerSide'],
price: body[i]['rate'],
quantity: body[i]['quantity'],
timestamp: body[i]['executedAt']
timestamp: parseInt(new Date(body[i]['executedAt']).getTime()/1000)
};
trades.push(trade);
+1 -1
View File
@@ -41,7 +41,7 @@ function get_trades(coin, exchange, cb) {
price: body.result[i]['Price'],
quantity: body.result[i]['Quantity'],
total: body.result[i]['Total'],
timestamp: body.result[i]['TimeStamp']
timestamp: parseInt(new Date(body.result[i]['TimeStamp']).getTime()/1000)
};
trades.push(trade);
+1 -1
View File
@@ -39,7 +39,7 @@ function get_trades(coin, exchange, cb) {
ordertype: body[i].side,
quantity: body[i].volume,
price: body[i].price,
timestamp: body[i].timestamp
timestamp: parseInt(new Date(body[i].timestamp).getTime()/1000)
};
trades.push(trade);
+1 -1
View File
@@ -40,7 +40,7 @@ function get_trades(coin, exchange, cb) {
price: body[i]['rate'],
quantity: body[i]['amount'],
total: body[i]['total'],
timestamp: body[i]['date']
timestamp: parseInt(new Date(body[i]['date'] + 'Z').getTime()/1000)
};
trades.push(trade);
+1 -1
View File
@@ -37,7 +37,7 @@ function get_trades(coin, exchange, stex_id, cb) {
ordertype: body.data[i].type,
price: body.data[i].price,
quantity: body.data[i].amount,
timestamp: new Date(body.data[i].timestamp * 1000).toUTCString()
timestamp: body.data[i].timestamp
};
trades.push(trade);
+1 -1
View File
@@ -43,7 +43,7 @@ function get_trades(coin, exchange, cb) {
ordertype: (body[coin + '_' + exchange][i]['type'].toLowerCase() == 'bid' ? 'BUY' : 'SELL'),
price: body[coin + '_' + exchange][i].price,
quantity: body[coin + '_' + exchange][i].amount,
timestamp: new Date(body[coin + '_' + exchange][i].timestamp * 1000).toUTCString()
timestamp: body[coin + '_' + exchange][i].timestamp
};
trades.push(trade);
+15
View File
@@ -97,6 +97,21 @@ exports.shared_pages = {
// NOTE: The path root is /public
// The optimum logo size is 128x128 as the image will be forced to 128px high when displayed
"logo": "/img/logo.png",
// date_time: a collection of settings that pertain to the date and time values displayed in the explorer
"date_time": {
// display_format: The format to use when displaying date/time values
// Date/time values are formatted using the Luxon library and must follow the correct syntax (read more: https://moment.github.io/luxon/docs/manual/formatting.html#table-of-tokens)
// Ex: LLL dd, yyyy HH:mm:ss ZZZZ = May 27, 2019 22:04:11 UTC
"display_format": "LLL dd, yyyy HH:mm:ss ZZZZ",
// timezone: All dates and times are stored as UTC dates and can either be displayed in UTC format or else they can be displayed in the local timezone according to a user's web browser settings
// valid options: utc or local
"timezone": "utc",
// enable_alt_timezone_tooltips: Determine if dates and times should have a mouse-over tooltip which displays an alternate timezone value
// If set to true and the "shared_pages.date_time.timezone" setting is set to "utc" then enabling this option will display date/time tooltips in the local browser's timezone
// If set to true and the "shared_pages.date_time.timezone" setting is set to "local" then enabling this option will display date/time tooltips in the UTC timezone
// If set to false, no tooltips will be displayed for any date/time values
"enable_alt_timezone_tooltips": false
},
// table_header_bgcolor: Change the background color of all table headers
// valid options: light, dark or leave blank ( "" ) for default colors
"table_header_bgcolor": "",