| | |
| | | return time_str; |
| | | } |
| | | // 出院/入院天数计算 |
| | | export function Daycount(dateString1, dateString2){ |
| | | // 将日期字符串转换为日期对象 |
| | | var date1 = new Date(dateString1); |
| | | var date2 = new Date(dateString2); |
| | | |
| | | // 计算时间差(毫秒) |
| | | var timeDifference = date2 - date1; |
| | | |
| | | // 将时间差转换为天数 |
| | | var daysDifference = Math.ceil(timeDifference / (1000 * 3600 * 24)); |
| | | |
| | | return daysDifference; |
| | | export function daysBetween(dateString) { |
| | | // 将输入的日期字符串转换为Date对象 |
| | | var startDate = new Date(dateString); |
| | | // 获取当前日期 |
| | | var currentDate = new Date(); |
| | | // 计算两个日期之间的时间差(毫秒) |
| | | var differenceInTime = currentDate - startDate; |
| | | // 将时间差转换为天数 |
| | | var differenceInDays = differenceInTime / (1000 * 3600 * 24); |
| | | // 返回天数,四舍五入到最接近的整数 |
| | | return Math.round(differenceInDays); |
| | | } |
| | | // 过滤器 |
| | | export function formatTime(val) { |