Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,19 @@ exports.currentTimezone = process.env.TZ;
*/

exports.time = bindings.time;
exports.localtime = bindings.localtime;
exports.mktime = bindings.mktime;

/**
* Check if the first argument is NaN and just return in case it is.
*/
exports.localtime = function localtime() {
if ((arguments[0] !== undefined) && isNaN(arguments[0])) {
return { invalid: true };
} else {
return bindings.localtime.apply(null, arguments);
}
};

/**
* A "hack" of sorts to force getting our own Date instance.
* Otherwise, in normal cases, the global Natives are shared between
Expand Down