diff --git a/src/components/cards/MediaCard.vue b/src/components/cards/MediaCard.vue index 18d86afd..5a78ad81 100644 --- a/src/components/cards/MediaCard.vue +++ b/src/components/cards/MediaCard.vue @@ -378,6 +378,21 @@ function getSeasonPoster(posterPath: string) { return '' return `https://image.tmdb.org/t/p/w500${posterPath}` } + +// 将yyyy-mm-dd转换为yyyy年mm月dd日 +function formatAirDate(airDate: string) { + if (!airDate) + return '' + const date = new Date(airDate) + return `${date.getFullYear()}年${date.getMonth() + 1}月${date.getDate()}日` +} +// 从yyyy-mm-dd中提取年份 +function getYear(airDate: string) { + if (!airDate) + return '' + const date = new Date(airDate) + return date.getFullYear() +}