added sort by calculated release date

pull/5848/head
Robin Dadswell 4 years ago committed by Qstick
parent 600c7e3391
commit c28b62da2a

@ -74,6 +74,15 @@ function MovieIndexSortMenu(props) {
{translate('Year')} {translate('Year')}
</SortMenuItem> </SortMenuItem>
<SortMenuItem
name="releaseDate"
sortKey={sortKey}
sortDirection={sortDirection}
onPress={onSortSelect}
>
{translate('ReleaseDate')}
</SortMenuItem>
<SortMenuItem <SortMenuItem
name="inCinemas" name="inCinemas"
sortKey={sortKey} sortKey={sortKey}

@ -288,12 +288,14 @@ class MovieIndexPoster extends Component {
<MovieIndexPosterInfo <MovieIndexPosterInfo
qualityProfile={qualityProfile} qualityProfile={qualityProfile}
showQualityProfile={showQualityProfile} showQualityProfile={showQualityProfile}
showReleaseDate={showReleaseDate}
showRelativeDates={showRelativeDates} showRelativeDates={showRelativeDates}
shortDateFormat={shortDateFormat} shortDateFormat={shortDateFormat}
timeFormat={timeFormat} timeFormat={timeFormat}
inCinemas={inCinemas} inCinemas={inCinemas}
physicalRelease={physicalRelease} physicalRelease={physicalRelease}
digitalRelease={digitalRelease} digitalRelease={digitalRelease}
releaseDate={releaseDate}
{...otherProps} {...otherProps}
/> />

@ -10,10 +10,12 @@ function MovieIndexPosterInfo(props) {
studio, studio,
qualityProfile, qualityProfile,
showQualityProfile, showQualityProfile,
showReleaseDate,
added, added,
inCinemas, inCinemas,
digitalRelease, digitalRelease,
physicalRelease, physicalRelease,
releaseDate,
certification, certification,
path, path,
sizeOnDisk, 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 (
<div className={styles.info}>
{translate('releaseDate')}: {relativeReleaseDate}
</div>
);
}
if (sortKey === 'inCinemas' && inCinemas && !showReleaseDate) {
const inCinemasDate = getRelativeDate( const inCinemasDate = getRelativeDate(
inCinemas, inCinemas,
shortDateFormat, shortDateFormat,
@ -75,7 +95,7 @@ function MovieIndexPosterInfo(props) {
); );
} }
if (sortKey === 'digitalRelease' && digitalRelease) { if (sortKey === 'digitalRelease' && digitalRelease && !showReleaseDate) {
const digitalReleaseDate = getRelativeDate( const digitalReleaseDate = getRelativeDate(
digitalRelease, digitalRelease,
shortDateFormat, shortDateFormat,
@ -93,7 +113,7 @@ function MovieIndexPosterInfo(props) {
); );
} }
if (sortKey === 'physicalRelease' && physicalRelease) { if (sortKey === 'physicalRelease' && physicalRelease && !showReleaseDate) {
const physicalReleaseDate = getRelativeDate( const physicalReleaseDate = getRelativeDate(
physicalRelease, physicalRelease,
shortDateFormat, shortDateFormat,
@ -147,9 +167,11 @@ MovieIndexPosterInfo.propTypes = {
certification: PropTypes.string, certification: PropTypes.string,
digitalRelease: PropTypes.string, digitalRelease: PropTypes.string,
physicalRelease: PropTypes.string, physicalRelease: PropTypes.string,
releaseDate: PropTypes.string.isRequired,
path: PropTypes.string.isRequired, path: PropTypes.string.isRequired,
sizeOnDisk: PropTypes.number, sizeOnDisk: PropTypes.number,
sortKey: PropTypes.string.isRequired, sortKey: PropTypes.string.isRequired,
showReleaseDate: PropTypes.bool.isRequired,
showRelativeDates: PropTypes.bool.isRequired, showRelativeDates: PropTypes.bool.isRequired,
shortDateFormat: PropTypes.string.isRequired, shortDateFormat: PropTypes.string.isRequired,
timeFormat: PropTypes.string.isRequired timeFormat: PropTypes.string.isRequired

Loading…
Cancel
Save