时间

58 阅读1分钟

moment的使用

Pasted Graphic 1.tiff

Pasted Graphic 2.tiff

moment().toDate()   === new Date()
moment().valueOf() ==== Date.now() === new Date().getTime()

moment(item.startTime).format('hh:mm:ss')

 大小写敏感

{ startTime: '00:00', endTime: '23:59' }

{ startTime: moment().hour(0).minute(0), endTime: moment().hour(8).minute(0) },

Pasted Graphic 3.tiff

timer-piker 可以用date类型的时间也可以用字符串时间

image.png

image.png

pickerOptions: {
    disabledDate(time) {
    return time.getTime() > moment().subtract(3,'day').valueOf() || time.getTime() < moment().subtract(6,'month').valueOf();
    },
},