Fix PM being AM

Fixes https://github.com/vector-im/riot-web/issues/4043

Signed-off-by: Travis Ralston <travpc@gmail.com>
This commit is contained in:
Travis Ralston 2017-05-26 13:43:01 -06:00 committed by GitHub
parent 32207bd058
commit 65dd2d4db1

View file

@ -54,7 +54,7 @@ function pad(n) {
function twelveHourTime(date) { function twelveHourTime(date) {
let hours = date.getHours() % 12; let hours = date.getHours() % 12;
const minutes = pad(date.getMinutes()); const minutes = pad(date.getMinutes());
const ampm = hours >= 12 ? 'PM' : 'AM'; const ampm = date.getHours() >= 12 ? 'PM' : 'AM';
hours = pad(hours ? hours : 12); hours = pad(hours ? hours : 12);
return `${hours}:${minutes} ${ampm}`; return `${hours}:${minutes} ${ampm}`;
} }