From c28b62da2a7aef0b4653f61dd97626bc87fcd933 Mon Sep 17 00:00:00 2001 From: Robin Dadswell Date: Mon, 11 Jan 2021 13:51:33 +0000 Subject: [PATCH] added sort by calculated release date --- .../Movie/Index/Menus/MovieIndexSortMenu.js | 9 ++++++ .../Movie/Index/Posters/MovieIndexPoster.js | 2 ++ .../Index/Posters/MovieIndexPosterInfo.js | 28 +++++++++++++++++-- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/frontend/src/Movie/Index/Menus/MovieIndexSortMenu.js b/frontend/src/Movie/Index/Menus/MovieIndexSortMenu.js index c2132fcee..9c0f6c612 100644 --- a/frontend/src/Movie/Index/Menus/MovieIndexSortMenu.js +++ b/frontend/src/Movie/Index/Menus/MovieIndexSortMenu.js @@ -74,6 +74,15 @@ function MovieIndexSortMenu(props) { {translate('Year')} + + {translate('ReleaseDate')} + + diff --git a/frontend/src/Movie/Index/Posters/MovieIndexPosterInfo.js b/frontend/src/Movie/Index/Posters/MovieIndexPosterInfo.js index 7871f2b2b..ce236c567 100644 --- a/frontend/src/Movie/Index/Posters/MovieIndexPosterInfo.js +++ b/frontend/src/Movie/Index/Posters/MovieIndexPosterInfo.js @@ -10,10 +10,12 @@ function MovieIndexPosterInfo(props) { studio, qualityProfile, showQualityProfile, + showReleaseDate, added, inCinemas, digitalRelease, physicalRelease, + releaseDate, certification, path, sizeOnDisk, @@ -57,7 +59,25 @@ function MovieIndexPosterInfo(props) { ); } - if (sortKey === 'inCinemas' && inCinemas) { + if (sortKey === 'releaseDate' && !showReleaseDate) { + const relativeReleaseDate = getRelativeDate( + releaseDate, + shortDateFormat, + showRelativeDates, + { + timeFormat, + timeForToday: false + } + ); + + return ( +
+ {translate('releaseDate')}: {relativeReleaseDate} +
+ ); + } + + if (sortKey === 'inCinemas' && inCinemas && !showReleaseDate) { const inCinemasDate = getRelativeDate( inCinemas, shortDateFormat, @@ -75,7 +95,7 @@ function MovieIndexPosterInfo(props) { ); } - if (sortKey === 'digitalRelease' && digitalRelease) { + if (sortKey === 'digitalRelease' && digitalRelease && !showReleaseDate) { const digitalReleaseDate = getRelativeDate( digitalRelease, shortDateFormat, @@ -93,7 +113,7 @@ function MovieIndexPosterInfo(props) { ); } - if (sortKey === 'physicalRelease' && physicalRelease) { + if (sortKey === 'physicalRelease' && physicalRelease && !showReleaseDate) { const physicalReleaseDate = getRelativeDate( physicalRelease, shortDateFormat, @@ -147,9 +167,11 @@ MovieIndexPosterInfo.propTypes = { certification: PropTypes.string, digitalRelease: PropTypes.string, physicalRelease: PropTypes.string, + releaseDate: PropTypes.string.isRequired, path: PropTypes.string.isRequired, sizeOnDisk: PropTypes.number, sortKey: PropTypes.string.isRequired, + showReleaseDate: PropTypes.bool.isRequired, showRelativeDates: PropTypes.bool.isRequired, shortDateFormat: PropTypes.string.isRequired, timeFormat: PropTypes.string.isRequired