Bug 511478

Summary: Lack leading zero when use 24H format
Product: [Plasma] plasmashell Reporter: xjlvpo6hn
Component: Digital Clock widgetAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED INTENTIONAL    
Severity: normal CC: nate
Priority: NOR    
Version First Reported In: 6.5.1   
Target Milestone: 1.0   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description xjlvpo6hn 2025-11-01 19:30:44 UTC
SUMMARY
Across all region defaults, there's usually a leading zero with 24H time format (maybe not all). But Digital Clock widget doesn't have one.

STEPS TO REPRODUCE
1. In System Settings - Region & Language - Time, select a 12H format, e.g. American English (United States)
2. In Digital Clock Settings - Appearance, set Time Display to 24-Hour

OBSERVED RESULT
There's no leading zero in hours.

EXPECTED RESULT
There should(?) be a leading zero when time is between 00~09

ADDITIONAL INFORMATION
In DigitalClock.qml, function timeFormatCorrection gets the system time format with `Qt.locale().timeFormat(Locale.ShortFormat))`, and when it's a region using 12H format the result is always `h:***`. When a user set Time Display to 24H in the widget settings, the format string (h:***) keeps.

Possible solutions:
1. View the 24-Hour option as an user-selected time format beyond the system settings. Force the format string to be "hh:mm".
2. Or, replace h to hh when 24-Hour is enabled.
3. Or, add options to allow user to custom time format, just like the custom date.
Comment 1 Nate Graham 2025-12-10 18:18:11 UTC
> e.g. American English (United States)
This region doesn't use a leading zero. If you want a leading zero, you'll have to use a locale that uses a leading zero. Overriding the locale to always force a leading zero isn't a great idea, so there's not much we can do without introducing a bunch of spaghetti code unless we find a way to implement Bug 340982.