|
|
let Vue = require('yoho-vue');
|
|
|
const moment = require('moment');
|
|
|
|
|
|
/**
|
|
|
* 替换参数
|
...
|
...
|
@@ -118,6 +117,23 @@ Vue.filter('convertTime', (value) => { |
|
|
/**
|
|
|
* 格式化时间
|
|
|
*/
|
|
|
Vue.filter('formatUnixTime', (value, format) => {
|
|
|
return moment.unix(value).format(format || 'YYYY-MM-DD HH:mm:ss');
|
|
|
Vue.filter('formatUnixTime', (value) => {
|
|
|
// return moment.unix(value).format(format || 'YYYY-MM-DD HH:mm:ss');
|
|
|
|
|
|
if (typeof value === 'undefined') {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
let date = new Date(parseFloat(value) * 1000);
|
|
|
|
|
|
// let Y = date.getFullYear() + '-';
|
|
|
let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1);
|
|
|
let D = (date.getDate() + 1 < 10 ? '0' + (date.getDate() + 1) : date.getDate() + 1);
|
|
|
let h = date.getHours();
|
|
|
let m = date.getMinutes();
|
|
|
|
|
|
// let s = date.getSeconds();
|
|
|
|
|
|
// return M + '.' + D + ' ' + h + ' ' + ' ' + m + ' ' + s;
|
|
|
return `${M}.${D} ${h}:${m}`;
|
|
|
}); |
...
|
...
|
|