1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Add local time display option to numerics in debug window

This commit is contained in:
Dave Conway-Jones 2019-02-04 15:51:42 +00:00
parent 5110eaff96
commit c409af0ea8
No known key found for this signature in database
GPG Key ID: 9E7F9C73F5168CD4

View File

@ -192,6 +192,14 @@ RED.utils = (function() {
format = 'hex' format = 'hex'
} }
} else if (format === 'dateMS' || format == 'dateS') { } else if (format === 'dateMS' || format == 'dateS') {
if ((obj.toString().length===13) && (obj<=2147483647000)) {
format = 'dateML';
} else if ((obj.toString().length===10) && (obj<=2147483647)) {
format = 'dateL';
} else {
format = 'hex'
}
} else if (format === 'dateML' || format == 'dateL') {
format = 'hex'; format = 'hex';
} else { } else {
format = 'dec'; format = 'dec';
@ -210,6 +218,12 @@ RED.utils = (function() {
element.text((new Date(obj)).toISOString()); element.text((new Date(obj)).toISOString());
} else if (format === 'dateS') { } else if (format === 'dateS') {
element.text((new Date(obj*1000)).toISOString()); element.text((new Date(obj*1000)).toISOString());
} else if (format === 'dateML') {
var dd = new Date(obj);
element.text(dd.toLocaleString() + " [UTC" + ( dd.getTimezoneOffset()/-60 <=0?"":"+" ) + dd.getTimezoneOffset()/-60 +"]");
} else if (format === 'dateL') {
var ddl = new Date(obj*1000);
element.text(ddl.toLocaleString() + " [UTC" + ( ddl.getTimezoneOffset()/-60 <=0?"":"+" ) + ddl.getTimezoneOffset()/-60 +"]");
} else if (format === 'hex') { } else if (format === 'hex') {
element.text("0x"+(obj).toString(16)); element.text("0x"+(obj).toString(16));
} }