alertmon/alertmonUtils.js

26 lines
835 B
JavaScript

var moment = require('moment-timezone');
exports.getLocTimeFromUTC = function(utcDtTm) {
var localTm = moment.utc(new Date(utcDtTm));
localTm = moment(localTm).tz('America/New_York').format('h:mm:ss a');
return localTm;
};
exports.getLocDateFromUTC = function(utcDtTm) {
var localDt = moment.utc(new Date(utcDtTm));
localDt = moment(localDt).tz('America/New_York').format('MM-DD-YYYY');
return localDt;
};
// This returned undefined, it probably won't work w/out some fancy dependency injection stuff.
//exports.getCoreNameFromCoreId = function(db, coreId) {
//db.all('SELECT coreName FROM Cores WHERE coreId = ? LIMIT 1;', coreId, function(err, rows){
//if (err !== null) {
//console.log(err);
//} else {
//return rows.coreName;
//}
//}
//);
//};