Fix 0 PM time formatting

This commit is contained in:
Alexander Zinchuk 2021-11-10 23:13:27 +03:00
parent eac60f3cc7
commit 0df89e5b93

View File

@ -40,7 +40,7 @@ export function formatTime(datetime: number | Date, lang: LangFn) {
let marker = '';
if (timeFormat === '12h') {
marker = hours >= 12 ? ' PM' : ' AM';
hours %= 12;
hours = hours > 12 ? hours % 12 : hours;
}
return `${String(hours).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}${marker}`;