parse dates instead of cringe string manipulation

This commit is contained in:
adrifcastr 2023-06-21 12:50:41 +02:00
parent 430486a9b9
commit 984d215312

View File

@ -54,7 +54,7 @@ export function formatTMDBMetaResult(
title: movie.title, title: movie.title,
object_type: mediaTypeToTMDB(type), object_type: mediaTypeToTMDB(type),
poster: movie.poster_path ?? undefined, poster: movie.poster_path ?? undefined,
original_release_year: Number(movie.release_date?.split("-")[0]), original_release_year: new Date(movie.release_date).getFullYear(),
}; };
} }
if (type === MWMediaType.SERIES) { if (type === MWMediaType.SERIES) {
@ -69,7 +69,7 @@ export function formatTMDBMetaResult(
title: v.name, title: v.name,
})), })),
poster: (details as TMDBMovieData).poster_path ?? undefined, poster: (details as TMDBMovieData).poster_path ?? undefined,
original_release_year: Number(show.first_air_date?.split("-")[0]), original_release_year: new Date(show.first_air_date).getFullYear(),
}; };
} }