hcong
2024-11-21 2f8efde07d3ecba6065635874126360b3ea82fd1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import dayjs from "dayjs";
 
export default {
  format(date, template) {
    return dayjs(date).format(template)
  },
 
  formatH(date){
    if (date) {
      return this.format(date, 'HH:mm:ss')
    } else {
      return '--:--:--'
    }
  },
 
  formatYM(date){
    if (date) {
      return this.format(date, 'YYYY-MM')
    } else {
      return '----/--'
    }
  },
 
  formatYMD(date){
    if (date) {
      return this.format(date, 'YYYY-MM-DD')
    } else {
      return '----/--/--'
    }
  },
 
  formatYMDH(date){
    if (date) {
      return this.format(date, 'YYYY-MM-DD HH:mm:ss')
    } else {
      return '----/--/-- --:--:--'
    }
  },
}