Refactor utils and organize routes/schema
This commit is contained in:
13
utils/date.js
Normal file
13
utils/date.js
Normal file
@@ -0,0 +1,13 @@
|
||||
// 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;
|
||||
Reference in New Issue
Block a user