From 984d215312d5cb616af0c03a5c7e76e4d0e9284b Mon Sep 17 00:00:00 2001 From: adrifcastr Date: Wed, 21 Jun 2023 12:50:41 +0200 Subject: [PATCH] parse dates instead of cringe string manipulation --- src/backend/metadata/getmeta.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/metadata/getmeta.ts b/src/backend/metadata/getmeta.ts index 8010c89a..4548a436 100644 --- a/src/backend/metadata/getmeta.ts +++ b/src/backend/metadata/getmeta.ts @@ -54,7 +54,7 @@ export function formatTMDBMetaResult( title: movie.title, object_type: mediaTypeToTMDB(type), 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) { @@ -69,7 +69,7 @@ export function formatTMDBMetaResult( title: v.name, })), 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(), }; }