Files
medicine_app/utils/utils.js
2024-05-22 13:42:15 +08:00

18 lines
278 B
JavaScript

/**
* 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
}