| Summary: | Don't require that input time's time format match the local time zone's time format | ||
|---|---|---|---|
| Product: | [Plasma] krunner | Reporter: | Nate Graham <nate> |
| Component: | datetime | Assignee: | Natalie Clarius <natalie_clarius> |
| Status: | ASSIGNED --- | ||
| Severity: | wishlist | CC: | alexander.lohnau, natalie_clarius |
| Priority: | NOR | Keywords: | usability |
| Version First Reported In: | master | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Nate Graham
2023-03-05 16:58:31 UTC
I had the same thought, but haven't found a satisfactory solution. This is all the valid short time formats (ignoring dates) across locales: > 'Kl'. H.mm > AP 'ga' h:mm > AP h.mm > AP h:mm > APh:mm > B H:mm > H.mm > H:m > H:mm > H:mm 'hodź'. > H:mm 'ч'. > HH 'h' mm > HH.mm > HH:mm > HH:mm:ss > h:mm AP > hh:mm AP > ཆུ་ཚོད་ h སྐར་མ་ mm AP Note that these don't uniquely map to the possible strings, e.g. "h" means with or without leading zero and "AP" is the A.M./P.M. affix to be spelled out. See https://doc.qt.io/qt-6/qtime.html#toString. Initially I tried with a regex, but that became monstrous rather quickly and only introduces bugs like we already had in the night color KCM so I don't think that's a viable alternative. Iterating through all locales would be possible but costly performance-wise, and would introduce problems with multiple valid interpretations of dates (d/m/y vs m/d/y format). We could settle on a few selected formats, like C, en_US and the system locale, and hope that that covers most use cases. Depending on how poor the performance of iterating through all locales is, it might not even be noticeable. If that's the case, I think it could be the winning solution. It would become a nested loop, though it may well be that it's still not noticeable. I'll play around with it. A possibly relevant merge request was started @ https://invent.kde.org/plasma/kdeplasma-addons/-/merge_requests/354 |