2018-06-19 18:48:14 -04:00
|
|
|
const numeral = require('numeral');
|
2018-08-13 05:50:28 -04:00
|
|
|
const moment = require('moment');
|
2018-06-19 18:48:14 -04:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
|
|
|
|
/**
|
2018-07-18 02:55:09 -04:00
|
|
|
* @param {Integer} number
|
2018-06-19 18:48:14 -04:00
|
|
|
* @returns {String}
|
|
|
|
*/
|
|
|
|
niceNumber: function (number) {
|
|
|
|
return numeral(number).format('0,0');
|
2018-08-13 05:50:28 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {String|Number} date
|
|
|
|
* @param {String} format
|
|
|
|
* @returns {String}
|
|
|
|
*/
|
|
|
|
formatDbDate: function (date, format) {
|
|
|
|
if (typeof date === 'number') {
|
|
|
|
return moment.unix(date).format(format);
|
|
|
|
}
|
|
|
|
|
|
|
|
return moment(date).format(format);
|
2018-06-19 18:48:14 -04:00
|
|
|
}
|
|
|
|
};
|