From eadcbc0aed87d5a038b2465e4960fc892c888438 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Mon, 11 Nov 2024 15:58:11 +0000 Subject: [PATCH] widget: fix time12 when it's 12pm fixes #552 --- src/renderer/widgets/IWidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/widgets/IWidget.cpp b/src/renderer/widgets/IWidget.cpp index bdcb462..7f2ddd4 100644 --- a/src/renderer/widgets/IWidget.cpp +++ b/src/renderer/widgets/IWidget.cpp @@ -138,7 +138,7 @@ static std::string getTime12h() { const auto HRS = hhmmss.hours().count(); const auto MINS = hhmmss.minutes().count(); - return (HRS % 12 < 10 ? "0" : "") + std::to_string(HRS % 12) + ":" + (MINS < 10 ? "0" : "") + std::to_string(MINS) + (HRS < 12 ? " AM" : " PM"); + return (HRS == 12 ? "12" : (HRS % 12 < 10 ? "0" : "") + std::to_string(HRS % 12)) + ":" + (MINS < 10 ? "0" : "") + std::to_string(MINS) + (HRS < 12 ? " AM" : " PM"); } IWidget::SFormatResult IWidget::formatString(std::string in) {