common.js
590 Bytes
/**
*
* @author: jiangfeng<jeff.jiang@yoho.cn>
* @date: 16/7/22
*/
'use strict';
const moment = require('moment');
const common = {
getPayExpireMin(expire) {
let defaultValue = 120;
if (expire) {
let expireTime = moment(expire, 'YYYY-MM-DD HH:mm:ss');
let diff = expireTime.diff(moment());
if (diff > 0) {
return Math.floor(diff / 1000 / 60);
} else {
return defaultValue;
}
} else {
return defaultValue;
}
}
};
module.exports = common;