Open bminer opened 9 years ago
Constructing a Date like this...
var time = require("time"); var d = new time.Date();
... results in an Object that has a bunch of enumerable instance methods...
{ Mon, 23 Mar 2015 16:16:00 GMT getTimezone: [Function: getTimezone], getDate: [Function: getDate], getDay: [Function: getDay], getYear: [Function: getYear], getFullYear: [Function: getFullYear], getHours: [Function: getHours], getMinutes: [Function: getMinutes], getMonth: [Function: getMonth], getSeconds: [Function: getSeconds], getTimezoneOffset: [Function: getTimezoneOffset], getTimezoneAbbr: [Function: getTimezoneAbbr], setAllDateFields: [Function: setAllDateFields], setDate: [Function: setDate], setFullYear: [Function: setFullYear], setHours: [Function: setHours], setMilliseconds: [Function: setMilliseconds], setMinutes: [Function: setMinutes], setMonth: [Function: setMonth], setSeconds: [Function: setSeconds], setTime: [Function: setTime], setUTCDate: [Function: setUTCDate], setUTCFullYear: [Function: setUTCFullYear], setUTCHours: [Function: setUTCHours], setUTCMilliseconds: [Function: setUTCMillseconds], setUTCMinutes: [Function: setUTCMinutes], setUTCMonth: [Function: setUTCMonth], setUTCSeconds: [Function: setUTCSeconds], toDateString: [Function: toDateString], toTimeString: [Function: toTimeString], toString: [Function: toString], toLocaleDateString: [Function: toLocaleDateString], toLocaleTimeString: [Function: toLocaleTimeString], toLocaleString: [Function: toString] }
This is not very desirable... can Object.defineProperty be used to fix this issue?
Object.defineProperty
I should also mention here that Date.prototype.inspect could be implemented to solve this problem...
Date.prototype.inspect
See more here: https://nodejs.org/api/util.html#util_custom_inspect_function_on_objects
Constructing a Date like this...
... results in an Object that has a bunch of enumerable instance methods...
This is not very desirable... can
Object.defineProperty
be used to fix this issue?