Bug 511478 - Lack leading zero when use 24H format
Summary: Lack leading zero when use 24H format
Status: RESOLVED INTENTIONAL
Alias: None
Product: plasmashell
Classification: Plasma
Component: Digital Clock widget (other bugs)
Version First Reported In: 6.5.1
Platform: Arch Linux Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-11-01 19:30 UTC by xjlvpo6hn
Modified: 2025-12-10 18:18 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.