New: Include time for episode/season/series history
This commit is contained in:
parent
4440aa3cac
commit
05edd44ed6
|
@ -15,6 +15,7 @@ class RelativeDateCell extends PureComponent {
|
||||||
className,
|
className,
|
||||||
date,
|
date,
|
||||||
includeSeconds,
|
includeSeconds,
|
||||||
|
includeTime,
|
||||||
showRelativeDates,
|
showRelativeDates,
|
||||||
shortDateFormat,
|
shortDateFormat,
|
||||||
longDateFormat,
|
longDateFormat,
|
||||||
|
@ -39,7 +40,7 @@ class RelativeDateCell extends PureComponent {
|
||||||
title={formatDateTime(date, longDateFormat, timeFormat, { includeSeconds, includeRelativeDay: !showRelativeDates })}
|
title={formatDateTime(date, longDateFormat, timeFormat, { includeSeconds, includeRelativeDay: !showRelativeDates })}
|
||||||
{...otherProps}
|
{...otherProps}
|
||||||
>
|
>
|
||||||
{getRelativeDate(date, shortDateFormat, showRelativeDates, { timeFormat, includeSeconds, timeForToday: true })}
|
{getRelativeDate(date, shortDateFormat, showRelativeDates, { timeFormat, includeSeconds, includeTime, timeForToday: true })}
|
||||||
</Component>
|
</Component>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -49,6 +50,7 @@ RelativeDateCell.propTypes = {
|
||||||
className: PropTypes.string.isRequired,
|
className: PropTypes.string.isRequired,
|
||||||
date: PropTypes.string,
|
date: PropTypes.string,
|
||||||
includeSeconds: PropTypes.bool.isRequired,
|
includeSeconds: PropTypes.bool.isRequired,
|
||||||
|
includeTime: PropTypes.bool.isRequired,
|
||||||
showRelativeDates: PropTypes.bool.isRequired,
|
showRelativeDates: PropTypes.bool.isRequired,
|
||||||
shortDateFormat: PropTypes.string.isRequired,
|
shortDateFormat: PropTypes.string.isRequired,
|
||||||
longDateFormat: PropTypes.string.isRequired,
|
longDateFormat: PropTypes.string.isRequired,
|
||||||
|
@ -60,6 +62,7 @@ RelativeDateCell.propTypes = {
|
||||||
RelativeDateCell.defaultProps = {
|
RelativeDateCell.defaultProps = {
|
||||||
className: styles.cell,
|
className: styles.cell,
|
||||||
includeSeconds: false,
|
includeSeconds: false,
|
||||||
|
includeTime: false,
|
||||||
component: TableRowCell
|
component: TableRowCell
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,8 @@ class EpisodeHistoryRow extends Component {
|
||||||
|
|
||||||
<RelativeDateCellConnector
|
<RelativeDateCellConnector
|
||||||
date={date}
|
date={date}
|
||||||
|
includeSeconds={true}
|
||||||
|
includeTime={true}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<TableRowCell className={styles.actions}>
|
<TableRowCell className={styles.actions}>
|
||||||
|
|
|
@ -14,7 +14,7 @@ function SeriesHistoryModal(props) {
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
isOpen={isOpen}
|
isOpen={isOpen}
|
||||||
size={sizes.EXTRA_LARGE}
|
size={sizes.EXTRA_EXTRA_LARGE}
|
||||||
onModalClose={onModalClose}
|
onModalClose={onModalClose}
|
||||||
>
|
>
|
||||||
<SeriesHistoryModalContentConnector
|
<SeriesHistoryModalContentConnector
|
||||||
|
|
|
@ -135,6 +135,8 @@ class SeriesHistoryRow extends Component {
|
||||||
|
|
||||||
<RelativeDateCellConnector
|
<RelativeDateCellConnector
|
||||||
date={date}
|
date={date}
|
||||||
|
includeSeconds={true}
|
||||||
|
includeTime={true}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<TableRowCell className={styles.actions}>
|
<TableRowCell className={styles.actions}>
|
||||||
|
|
|
@ -5,16 +5,18 @@ import isToday from 'Utilities/Date/isToday';
|
||||||
import isTomorrow from 'Utilities/Date/isTomorrow';
|
import isTomorrow from 'Utilities/Date/isTomorrow';
|
||||||
import isYesterday from 'Utilities/Date/isYesterday';
|
import isYesterday from 'Utilities/Date/isYesterday';
|
||||||
import translate from 'Utilities/String/translate';
|
import translate from 'Utilities/String/translate';
|
||||||
|
import formatDateTime from './formatDateTime';
|
||||||
|
|
||||||
function getRelativeDate(date, shortDateFormat, showRelativeDates, { timeFormat, includeSeconds = false, timeForToday = false } = {}) {
|
function getRelativeDate(date, shortDateFormat, showRelativeDates, { timeFormat, includeSeconds = false, timeForToday = false, includeTime = false } = {}) {
|
||||||
if (!date) {
|
if (!date) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const isTodayDate = isToday(date);
|
const isTodayDate = isToday(date);
|
||||||
|
const time = formatTime(date, timeFormat, { includeMinuteZero: true, includeSeconds });
|
||||||
|
|
||||||
if (isTodayDate && timeForToday && timeFormat) {
|
if (isTodayDate && timeForToday && timeFormat) {
|
||||||
return formatTime(date, timeFormat, { includeMinuteZero: true, includeSeconds });
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!showRelativeDates) {
|
if (!showRelativeDates) {
|
||||||
|
@ -22,22 +24,26 @@ function getRelativeDate(date, shortDateFormat, showRelativeDates, { timeFormat,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isYesterday(date)) {
|
if (isYesterday(date)) {
|
||||||
return translate('Yesterday');
|
return includeTime ? translate('YesterdayAt', { time } ): translate('Yesterday');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isTodayDate) {
|
if (isTodayDate) {
|
||||||
return translate('Today');
|
return includeTime ? translate('TodayAt', { time } ): translate('Today');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isTomorrow(date)) {
|
if (isTomorrow(date)) {
|
||||||
return translate('Tomorrow');
|
return includeTime ? translate('TomorrowAt', { time } ): translate('Tomorrow');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isInNextWeek(date)) {
|
if (isInNextWeek(date)) {
|
||||||
return moment(date).format('dddd');
|
const day = moment(date).format('dddd');
|
||||||
|
|
||||||
|
return includeTime ? translate('DayOfWeekAt', { day, time }) : day;
|
||||||
}
|
}
|
||||||
|
|
||||||
return moment(date).format(shortDateFormat);
|
return includeTime ?
|
||||||
|
formatDateTime(date, shortDateFormat, timeFormat, { includeSeconds }) :
|
||||||
|
moment(date).format(shortDateFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getRelativeDate;
|
export default getRelativeDate;
|
||||||
|
|
|
@ -308,6 +308,7 @@
|
||||||
"Date": "Date",
|
"Date": "Date",
|
||||||
"Dates": "Dates",
|
"Dates": "Dates",
|
||||||
"Day": "Day",
|
"Day": "Day",
|
||||||
|
"DayOfWeekAt": "{day} at {time}",
|
||||||
"Debug": "Debug",
|
"Debug": "Debug",
|
||||||
"Default": "Default",
|
"Default": "Default",
|
||||||
"DefaultCase": "Default Case",
|
"DefaultCase": "Default Case",
|
||||||
|
@ -1949,10 +1950,12 @@
|
||||||
"Title": "Title",
|
"Title": "Title",
|
||||||
"Titles": "Titles",
|
"Titles": "Titles",
|
||||||
"Today": "Today",
|
"Today": "Today",
|
||||||
|
"TodayAt": "Today at {time}",
|
||||||
"ToggleMonitoredSeriesUnmonitored ": "Cannot toggle monitored state when series is unmonitored",
|
"ToggleMonitoredSeriesUnmonitored ": "Cannot toggle monitored state when series is unmonitored",
|
||||||
"ToggleMonitoredToUnmonitored": "Monitored, click to unmonitor",
|
"ToggleMonitoredToUnmonitored": "Monitored, click to unmonitor",
|
||||||
"ToggleUnmonitoredToMonitored": "Unmonitored, click to monitor",
|
"ToggleUnmonitoredToMonitored": "Unmonitored, click to monitor",
|
||||||
"Tomorrow": "Tomorrow",
|
"Tomorrow": "Tomorrow",
|
||||||
|
"TomorrowAt": "Tomorrow at {time}",
|
||||||
"TorrentBlackhole": "Torrent Blackhole",
|
"TorrentBlackhole": "Torrent Blackhole",
|
||||||
"TorrentBlackholeSaveMagnetFiles": "Save Magnet Files",
|
"TorrentBlackholeSaveMagnetFiles": "Save Magnet Files",
|
||||||
"TorrentBlackholeSaveMagnetFilesExtension": "Save Magnet Files Extension",
|
"TorrentBlackholeSaveMagnetFilesExtension": "Save Magnet Files Extension",
|
||||||
|
@ -2074,5 +2077,6 @@
|
||||||
"Year": "Year",
|
"Year": "Year",
|
||||||
"Yes": "Yes",
|
"Yes": "Yes",
|
||||||
"YesCancel": "Yes, Cancel",
|
"YesCancel": "Yes, Cancel",
|
||||||
"Yesterday": "Yesterday"
|
"Yesterday": "Yesterday",
|
||||||
|
"YesterdayAt": "Yesterday at {time}"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue