From 01c3f44026c2b52c7485a7efb490e5eb1e257c01 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Fri, 19 Jul 2024 10:00:48 +0200 Subject: [PATCH] fix(modeshow): force all segments of the time to have 2 digits --- src/clock/ui.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/clock/ui.rs b/src/clock/ui.rs index 0aa3ebd..3fd8480 100644 --- a/src/clock/ui.rs +++ b/src/clock/ui.rs @@ -155,8 +155,12 @@ pub fn timebarw_label<'a>( // example with `-o` #17 .checked_add_signed(len.into()) .expect("could not calculate when the countdown finishes"); - let timestamp_until: String = - format!("{}:{}:{}", until.hour(), until.minute(), until.second()); + let timestamp_until: String = format!( + "{:02}:{:02}:{:02}", + until.hour(), + until.minute(), + until.second() + ); Paragraph::new(format!("{time_now} / {len} ({timestamp_until})")) .alignment(Alignment::Center) .block(