mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-06-07 16:49:52 +08:00
统一处理低版本safari浏览器Date兼容性问题
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script lang="ts" setup>
|
||||
import { calculateTimeDifference } from '@/@core/utils'
|
||||
import { formatDateDifference } from '@/@core/utils/formatters'
|
||||
import api from '@/api'
|
||||
|
||||
// 系统环境变量
|
||||
@@ -62,7 +62,7 @@ async function queryAllRelease() {
|
||||
// 计算发布时间
|
||||
function releaseTime(releaseDate: string) {
|
||||
// 上一次更新时间
|
||||
return `${calculateTimeDifference(releaseDate)}前`
|
||||
return formatDateDifference(releaseDate)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
@@ -100,7 +100,7 @@ function compareTime(time1: string, time2: string) {
|
||||
return -1
|
||||
if (!time2)
|
||||
return 1
|
||||
return new Date(time1).getTime() - new Date(time2).getTime()
|
||||
return new Date(time1.replaceAll(/-/g, '/')).getTime() - new Date(time2.replaceAll(/-/g, '/')).getTime()
|
||||
}
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
|
||||
Reference in New Issue
Block a user