第一次提交
This commit is contained in:
18
utils/utils.js
Normal file
18
utils/utils.js
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* date转化为hh:mm
|
||||
*/
|
||||
export function dateToStr(date) {
|
||||
if (typeof date !== 'number') {
|
||||
return ''
|
||||
}
|
||||
date = new Date(date)
|
||||
let hh = date.getHours()
|
||||
let mm = date.getMinutes()
|
||||
if (hh<10) {
|
||||
hh = '0' + hh
|
||||
}
|
||||
if (mm<10) {
|
||||
mm = '0' + mm
|
||||
}
|
||||
return hh + ':' + mm
|
||||
}
|
||||
Reference in New Issue
Block a user