Use 12-hour clock with AM/PM
Now we don't need the "clock" icon to indicate the wall clock vs the timer
This commit is contained in:
parent
ffa6fbd095
commit
1f8f23ef76
2 changed files with 3 additions and 6 deletions
|
|
@ -182,10 +182,6 @@ fn build_hud_content(state: SharedState) -> gtk4::Box {
|
|||
.spacing(4)
|
||||
.build();
|
||||
|
||||
let clock_icon = gtk4::Image::from_icon_name("preferences-system-time-symbolic");
|
||||
clock_icon.set_pixel_size(20);
|
||||
clock_box.append(&clock_icon);
|
||||
|
||||
let clock_label = gtk4::Label::new(Some("--:--"));
|
||||
clock_label.add_css_class("clock-label");
|
||||
clock_box.append(&clock_label);
|
||||
|
|
|
|||
|
|
@ -92,8 +92,9 @@ pub fn now() -> DateTime<Local> {
|
|||
}
|
||||
|
||||
/// Format a DateTime for display in the HUD clock.
|
||||
/// Always uses 12-hour format with AM/PM, ignoring system locale.
|
||||
pub fn format_clock_time(dt: &DateTime<Local>) -> String {
|
||||
dt.format("%H:%M").to_string()
|
||||
dt.format("%l:%M %p").to_string()
|
||||
}
|
||||
|
||||
/// Format a DateTime for display with full date and time.
|
||||
|
|
@ -396,7 +397,7 @@ mod tests {
|
|||
#[test]
|
||||
fn test_format_clock_time() {
|
||||
let dt = Local.with_ymd_and_hms(2025, 12, 25, 14, 30, 45).unwrap();
|
||||
assert_eq!(format_clock_time(&dt), "14:30");
|
||||
assert_eq!(format_clock_time(&dt), "02:30 PM");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Reference in a new issue