From 98e61db21619228e55453eeaab8bb59a3f8eb914 Mon Sep 17 00:00:00 2001 From: Mark Hansen Date: Mon, 15 Feb 2010 01:11:59 +1300 Subject: sys.inspect(Date) now shows the date value --- lib/sys.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/sys.js') diff --git a/lib/sys.js b/lib/sys.js index 581af38dfe..65badcdc05 100644 --- a/lib/sys.js +++ b/lib/sys.js @@ -59,6 +59,11 @@ exports.inspect = function (obj, showHidden) { } } + // Dates without properties can be shortcutted + if (value instanceof Date && keys.length === 0) { + return value.toUTCString(); + } + var base, type, braces; // Determine the object type if (value instanceof Array) { @@ -75,6 +80,11 @@ exports.inspect = function (obj, showHidden) { } else { base = ""; } + + // Make dates with properties first say the date + if (value instanceof Date) { + base = ' ' + value.toUTCString(); + } seen.push(value); -- cgit v1.2.3