From e0448f7213d14077e1ce3f51b8400872989d3463 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Mon, 29 May 2023 23:26:57 +0300 Subject: [PATCH] Fixed: (UI) Show release dates when enabled --- .../Movie/Index/Posters/MovieIndexPoster.tsx | 37 +++++++++++++++++++ .../Index/Posters/MovieIndexPosterInfo.tsx | 6 +-- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/frontend/src/Movie/Index/Posters/MovieIndexPoster.tsx b/frontend/src/Movie/Index/Posters/MovieIndexPoster.tsx index 27aa69033..7f7325142 100644 --- a/frontend/src/Movie/Index/Posters/MovieIndexPoster.tsx +++ b/frontend/src/Movie/Index/Posters/MovieIndexPoster.tsx @@ -16,6 +16,7 @@ import MovieIndexPosterSelect from 'Movie/Index/Select/MovieIndexPosterSelect'; import MoviePoster from 'Movie/MoviePoster'; import { executeCommand } from 'Store/Actions/commandActions'; import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector'; +import getRelativeDate from 'Utilities/Date/getRelativeDate'; import translate from 'Utilities/String/translate'; import createMovieIndexItemSelector from '../createMovieIndexItemSelector'; import MovieIndexPosterInfo from './MovieIndexPosterInfo'; @@ -125,6 +126,20 @@ function MovieIndexPoster(props: MovieIndexPosterProps) { height: `${posterHeight}px`, }; + let releaseDate = ''; + let releaseDateType = ''; + if (physicalRelease && digitalRelease) { + releaseDate = + physicalRelease < digitalRelease ? physicalRelease : digitalRelease; + releaseDateType = physicalRelease < digitalRelease ? 'Released' : 'Digital'; + } else if (physicalRelease && !digitalRelease) { + releaseDate = physicalRelease; + releaseDateType = 'Released'; + } else if (digitalRelease && !physicalRelease) { + releaseDate = digitalRelease; + releaseDateType = 'Digital'; + } + return (
@@ -214,6 +229,28 @@ function MovieIndexPoster(props: MovieIndexPosterProps) {
{qualityProfile.name}
) : null} + {showCinemaRelease && inCinemas ? ( +
+ {' '} + {getRelativeDate(inCinemas, shortDateFormat, showRelativeDates, { + timeFormat, + timeForToday: false, + })} +
+ ) : null} + + {showReleaseDate && releaseDate ? ( +
+ {' '} + {getRelativeDate(releaseDate, shortDateFormat, showRelativeDates, { + timeFormat, + timeForToday: false, + })} +
+ ) : null} +