From 268fc46ef769fbc7ff8e2055529aaf7eb7c6756a Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Sat, 1 Feb 2020 22:47:34 +0100 Subject: [PATCH] Fixed: Representation of episode start time when not starting at the full hour in am/pm notation --- frontend/src/Utilities/Date/formatTime.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/src/Utilities/Date/formatTime.js b/frontend/src/Utilities/Date/formatTime.js index 89c908d1f..226b0cd97 100644 --- a/frontend/src/Utilities/Date/formatTime.js +++ b/frontend/src/Utilities/Date/formatTime.js @@ -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;