const moment = require('moment-timezone');
const one_minute = 60000; // 1000 * 60
const one_day = 86400000; // 1000 * 60 * 60 * 24
function local_time(time) {
return moment(time).tz("America/New_York");
}
function toString(time) {
return (time || local_time()).format("dddd MMM Do hh:mm:ss:SSSS a z");
}
function toShortString(time) {
return (time || local_time()).format("hh:mm:ss:SSSS a z");
}
function toDateString(time) {
// ISO 8601 ride or die
return (time || local_time()).format("YYYY-MM-DD");
}
module.exports = {
toString: toString,
toShortString: toShortString,
toDateString: toDateString,
now: local_time,
one_minute: one_minute,
one_day: one_day
};