Include last seen in device boxes on graphviz map (#1633)

* Include last seen in device boxes on graphviz map

* Refactor

* Fix test cases

* Bind

* Refactor last seen label construction

* style fix
This commit is contained in:
clockbrain authored and Koen Kanters committed 2019-06-17 21:28:27 +02:00
1 parent 1c529c4873
commit b28da0265e
5 files changed
+51 -13

No files matched your search

+22
View File
@@ -100,6 +100,27 @@ function getZigbee2mqttVersion(callback) {
});
}
function formatDate(date, type, _default) {
let result;
switch (type) {
case 'ISO_8601':
result = new Date(date).toISOString();
break;
case 'ISO_8601_local':
result = toLocalISOString(new Date(date));
break;
case 'epoch':
result = date;
break;
default:
result = _default;
break;
}
return result;
}
module.exports = {
millisecondsToSeconds: (milliseconds) => milliseconds / 1000,
secondsToMilliseconds: (seconds) => seconds * 1000,
@@ -113,6 +134,7 @@ module.exports = {
isNumeric: (string) => /^\d+$/.test(string),
toLocalISOString: (dDate) => toLocalISOString(dDate),
getPostfixes: () => postfixes,
formatDate: (date, type, _default=null) => formatDate(date, type, _default),
correctDeviceType: (device) => {
if (device) {
if (forceEndDevice.includes(device.modelId)) {