Files
kno-logic-api/utils/date.js
2021-05-19 20:08:04 -04:00

13 lines
378 B
JavaScript

// dateToEpoch(date) change the time of the date object to epoch
function dateToEpoch(d) {
console.log(d);
if (d) {
// When comparing js dates, the timezone does not matter
// ex. May 17 EDT == May 17 GMT, May 17 EDT != May 18 GMT
return d.setHours(0, 0, 0, 0);
} else {
return null;
}
}
module.exports.dateToEpoch = dateToEpoch;