From 671d7e2bebbbb890289432e2fbb1fe24f7f0d812 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Mon, 28 Nov 2016 17:28:49 +0000 Subject: [PATCH] debug - format if time if correct length/range --- editor/js/ui/utils.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/editor/js/ui/utils.js b/editor/js/ui/utils.js index 58af98b75..8a232f644 100644 --- a/editor/js/ui/utils.js +++ b/editor/js/ui/utils.js @@ -111,14 +111,18 @@ RED.utils = (function() { } else if (typeof obj === 'number') { e = $('').text(""+obj).appendTo(entryObj); - if ((obj^0)===obj) { + if (Number.isInteger(obj) && (obj >= 0)) { // if it's a +ve integer e.addClass("debug-message-type-number-toggle"); e.click(function(evt) { - var format = $(this).data('format'); - if (format === 'hex') { - $(this).text(""+obj).data('format','dec'); + var format = $(this).data('format') || "date"; + if (format === 'dec') { + $(this).text(""+obj).data('format','date'); + } else if ((format === 'date') && (obj.toString().length===13) && (obj<=2147483647000)) { + $(this).text((new Date(obj)).toISOString()).data('format','hex'); + } else if ((format === 'date') && (obj.toString().length===10) && (obj<=2147483647)) { + $(this).text((new Date(obj*1000)).toISOString()).data('format','hex'); } else { - $(this).text("0x"+(obj).toString(16)).data('format','hex'); + $(this).text("0x"+(obj).toString(16)).data('format','dec'); } evt.preventDefault(); });