Fixed: Representation of episode start time when not starting at the full hour in am/pm notation

Signed-off-by: Robin Dadswell <robin@dadswell.email>
This commit is contained in:
Taloth Saldono
2020-02-01 22:47:34 +01:00
committed by Qstick
parent 7e00dd731c
commit 3a5752f3cc

View File

@@ -5,15 +5,17 @@ function formatTime(date, timeFormat, { includeMinuteZero = false, includeSecond
return '';
}
const time = moment(date);
if (includeSeconds) {
timeFormat = timeFormat.replace(/\(?:mm\)?/, ':mm:ss');
} else if (includeMinuteZero) {
} else if (includeMinuteZero || time.minute() !== 0) {
timeFormat = timeFormat.replace('(:mm)', ':mm');
} else {
timeFormat = timeFormat.replace('(:mm)', '');
}
return moment(date).format(timeFormat);
return time.format(timeFormat);
}
export default formatTime;