@metamask/keyring-snap-sdk
Version:
MetaMask Keyring Snap SDK
22 lines • 596 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.toUnixTimestamp = toUnixTimestamp;
exports.getCurrentUnixTimestamp = getCurrentUnixTimestamp;
/**
* Convert a date to its UNIX timestamp equivalent.
*
* @param date - The date object to convert.
* @returns A UNIX timestamp.
*/
function toUnixTimestamp(date) {
return Math.floor(date.getTime() / 1000);
}
/**
* Get the current UNIX timestamp.
*
* @returns The current UNIX timestamp.
*/
function getCurrentUnixTimestamp() {
return toUnixTimestamp(new Date());
}
//# sourceMappingURL=time.cjs.map