summaryrefslogtreecommitdiff
path: root/src/utils/index.js
blob: 9704ff1260368aabc807e4f851be300a189fe52f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import Moment from 'moment'

// 定义时间戳 -> 日期
export function formatDate(value, fmt='YYYY-MM-DD') {
    if (!value || value === undefined) return '--'
    return Moment(value).format(fmt)
}

// 定义时间戳 -> 时间
export function formatTime(value) {
    if (!value || value === undefined) return '--'
    return Moment(value).format('YYYY-MM-DD HH:mm:ss')
}