nginx-proxy-manager-zh/src/frontend/js/lib/helpers.js
2018-08-13 19:50:28 +10:00

29 lines
589 B
JavaScript

'use strict';
const numeral = require('numeral');
const moment = require('moment');
module.exports = {
/**
* @param {Integer} number
* @returns {String}
*/
niceNumber: function (number) {
return numeral(number).format('0,0');
},
/**
* @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);
}
};