Bug 448985 - In Digital Clock 3.0 - Custom date format shows incorrect month - M01 instead of Jan
Summary: In Digital Clock 3.0 - Custom date format shows incorrect month - M01 instead...
Status: RESOLVED NOT A BUG
Alias: None
Product: plasmashell
Classification: Plasma
Component: Digital Clock (show other bugs)
Version: 5.23.5
Platform: openSUSE Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-01-22 23:21 UTC by Bruce Ferry
Modified: 2022-01-23 22:15 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Correctly displayed format. (308.29 KB, image/png)
2022-01-23 13:44 UTC, Viorel-Cătălin Răpițeanu
Details
Screenshot showing the config and what I see (967.10 KB, image/png)
2022-01-23 17:51 UTC, Bruce Ferry
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bruce Ferry 2022-01-22 23:21:25 UTC
SUMMARY
***
I've set a custom format in the widget - 'dddd dd-MMM'. It should show 'Sat 22-Jan' but shows 'Sat 22-M01' instead.
***


STEPS TO REPRODUCE
1.  Add a widget
2. Configure date format 'dddd dd-MMM'
3. Apply and observe the date shown

OBSERVED RESULT

See summary

EXPECTED RESULT

See summary

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 5.23.5-1.1
(available in About System)
KDE Plasma Version: 5.23.5-1.1
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Chris Holland 2022-01-23 01:39:02 UTC
dddd is Saturday not Sat
dd is 22
MMM is Jan
mmm is mmm since digitalclock uses Qt.formatDate() not Qt.formatDateTime()


Which locale?

❯ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
...
LC_ALL=
❯ date
Sat Jan 22 08:37:36 PM EST 2022
Comment 2 Viorel-Cătălin Răpițeanu 2022-01-23 13:44:52 UTC
Created attachment 145801 [details]
Correctly displayed format.

I tested this on the latest master branch and everything worked. Can someone retry this to see exactly how it works?
Comment 3 Bruce Ferry 2022-01-23 17:51:24 UTC
Created attachment 145810 [details]
Screenshot showing the config and what I see

Should have attached this before. 

I'm in the eastern US time zone if that matters.

I do remember that this used to work correctly but I'm not sure when it changed. I don't normally have the widget installed but I see exactly the same thing on the task bar clock.
Comment 4 Fabian Vogt 2022-01-23 18:38:32 UTC
This can happen if "MMM" gets parsed as "M" followed by "MM", e.g. with an invisible character in between.

It works fine here on Tumbleweed with en_US.UTF-8 locale and "ddd d-MMM" format.
Comment 5 Chris Holland 2022-01-23 18:52:49 UTC
So the `locale` command shows LC_TIME="en_US.UTF-8"? And you're also in EST. Good to know.

"M01" could be a legit "testing" locale for Jan. I've just never seen it before.

OpenSUSE Tumbleweed right?
What Qt version?  I have Qt 5.15.2+kde268-2.1

Qt uses CLDR for their locale database.
https://github.com/qt/qtbase/tree/dev/util/locale_database
https://cldr.unicode.org/index/downloads
https://unicode-org.github.io/cldr-staging/charts/40/
https://unicode-org.github.io/cldr-staging/charts/40/delta/en.html
https://www.google.com/search?hl=en&q=site%3Ahttps%3A%2F%2Funicode%2Dorg.github.io%2Fcldr%2Dstaging%2Fcharts%2F40%2F%20%22M01%22

Looks like the Sardinian [sc] v40 Delta has M01. Not sure what "delta" is though.
https://unicode-org.github.io/cldr-staging/charts/40/delta/sc.html

There's also Fulah [ff] which has M01.
https://unicode-org.github.io/cldr-staging/charts/40/summary/ff.html

Chinese locales tend to have numbers in the month names like: 1月, 2月 for Jan, Feb.
https://unicode-org.github.io/cldr-staging/charts/latest/verify/dates/zh.html

> This can happen if "MMM" gets parsed as "M" followed by "MM", e.g. with an invisible character in between.

Why would it output M=M instead of M=1? An invisible character would be equivalent to "M MM" which would be "1 01". You would need apostrophes to escape it like 'M'MM to get "M01".
Comment 6 Nate Graham 2022-01-23 19:26:05 UTC
.
Comment 7 Nate Graham 2022-01-23 21:39:56 UTC
"dddd dd-MMM" works for me with the en_US locale, FWIW.
Comment 8 Bruce Ferry 2022-01-23 22:15:33 UTC
Problem solved.

Locale showed 'LC_TIME="lv_US.UTF-8"'. Changing it to LC_TIME="en_US.UTF-8" resolved it. I have no idea how this might have gotten changed.

Thanks to all who pitched in their two cents