| 1234567891011121314151617181920212223 |
- import { LocalDateTime } from '@/api/types'
- export const timeLength = function(
- start: LocalDateTime,
- end: LocalDateTime
- ): string {
- const s = new Date(start).getTime()
- const e = new Date(end).getTime()
- const t = e - s
- let hour = Math.floor(t / 3600000)
- let min = Math.floor((t - hour * 3600000) / 60000)
- let format = ''
- if (hour > 0) {
- format = `${hour}小时${min}分`
- }
- if (hour <= 0) {
- format = `${min}分`
- }
- return format
- }
|