统一处理低版本safari浏览器Date兼容性问题

This commit is contained in:
Allen
2024-04-24 10:06:32 +08:00
parent 72088dff2e
commit e1524c26cd
6 changed files with 18 additions and 15 deletions
+2 -2
View File
@@ -423,14 +423,14 @@ function getSeasonPoster(posterPath: string) {
function formatAirDate(airDate: string) {
if (!airDate)
return ''
const date = new Date(airDate)
const date = new Date(airDate.replaceAll(/-/g, '/'))
return `${date.getFullYear()}${date.getMonth() + 1}${date.getDate()}`
}
// 从yyyy-mm-dd中提取年份
function getYear(airDate: string) {
if (!airDate)
return ''
const date = new Date(airDate)
const date = new Date(airDate.replaceAll(/-/g, '/'))
return date.getFullYear()
}
</script>