Bug 162368

Summary: Digital clock widget cannot display date in custom format
Product: [Unmaintained] plasma4 Reporter: disclosed <k_b0000>
Component: widget-clockAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: wishlist CC: abresch, Arfrever.FTA, emdeck, h.doernhoff, joekowalski, kde-2011.08, kde-bugzilla, kde, kde, kdebugs, kde_bugzilla_2, krange, psychonaut, skrrytch, stefan, tyrerj, x, xdmx
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: the problem
Screen Shot showing "ShortDate" format
Screen Shot with Short date format set to YYYY-MM-DD in SS
plasma-4.2.4-use_ISO_8601_in_digital_clock.patch
Horizontal Panel ShortDate with WeekDay and TimeZone
Horizontal Panel ShortDate with WeekDay
Horizontal Panel ShortDate
Clock made with vertical Panel, WeekDay and TimeZone
Clock made with vertical Panel, WeekDay
Clock made with vertical Panel
EXPERIMENTAL Patch
EXPERIMENTAL Patch for KDE-4.4

Description disclosed 2008-05-20 19:03:54 UTC
Version:            (using KDE 4.0.3)
Installed from:    Fedora RPMs
OS:                Linux

the digital clock widget in KDE 4.0.3 cannot display the date in a custom format.
for example it is not possible to configure the widget to use the following format YYYY-MM-DD.

in kde 3.5.x this was configurable.

please add it back.
Comment 1 Tristan Miller 2008-11-24 23:39:18 UTC
*** This bug has been confirmed by popular vote. ***
Comment 2 Michał D. (Emdek) 2008-11-30 15:01:20 UTC
You can try to use this plasmoid:
http://kde-look.org/content/show.php/Adjustable+Clock?content=92825
Partially similar bug report: #172175.
Comment 3 Tim Middleton 2008-11-30 20:34:33 UTC
I also used KDE3's ability to adjust this setting, and am annoyed by my new KDE4 desktop not being able to configure this (among other things). The reason custom configuration is needed here (in my view) is that the time/date display on the task bar has very limited space, and one wants to customize the time display to fit it optimally, which may not be the same as one's locale settings.
Comment 4 Joe Kowalski 2009-01-15 08:16:16 UTC
I don't see why the date format in the plasma clocks can't simply refer back to how the date is formatted under the Country/Region & Language settings module. The time is formatted according to how the time format is specified on the Time & Date tab of the Country/Region  & Settings config modules. The date format setting there should be applied globally and it is rather inconsistent that it is not in this case.
Comment 5 Bert Speckels 2009-01-30 09:18:06 UTC
Same request but different motivation: I'd like to have time and date (including the most important day-of-week) displayed side by side or completely seperated from each other. That can be nicely done with the solution described in this request.

An extreme but useful configuration: Three digital clocks on my desktop: Current time at default location in the bottom panel, a digital clock plasmoid with the current date on the desktop, and in my top panel another digital clock displaying the day-of-week (Friday, ...), which I often forget. 

Well "digital clock" is not the right name then. "Adjustable Clock" is better like the one in kde-look. But that one is very unstable and not officially a kde4-plasmoid! It shouldn't be much work to enhance the default digital clock in that way ... does it?
Comment 6 xdmx 2009-02-02 12:09:44 UTC
it would be nice to be able to adjust the time and date font, it set itself automatically based on the panel height... but i've the date which is bigger than the time, by which logic? i mean, i think everyone checks more times per day the time, and not the date, so is the time which should have a bigger font...
Comment 7 xdmx 2009-02-02 12:16:13 UTC
Created attachment 30866 [details]
the problem
Comment 8 Stephan Sokolow 2009-02-11 02:27:42 UTC
I wouldn't mind this so much if the clock actually took its date from the regional settings panel as it's claimed to.

As it is, here's how things stand on my system:

Date format: February 10, 2009
Short date format: 2009-02-10
Clock date format: Tue, 10 Feb 2009 (without the day of the week, it's still "10 Feb 2009")

I'd happily change my date format to be a duplicate of the short date format (so all system dates are ISO 8601's YYYY-MM-DD) if it would actually have an effect.
Comment 9 Holger Dörnhoff 2009-05-17 20:27:13 UTC
Still not possible in version 4.2.85 (KDE 4.3 Beta1)
Comment 10 Daniel Hahler 2009-05-24 16:24:32 UTC
@xdmx: the font setting is another issue, see bug 185588.
Please keep different things in separate bug reports. Thanks.. :)
Comment 11 Christoph Feck 2009-05-28 04:15:53 UTC
*** Bug 172175 has been marked as a duplicate of this bug. ***
Comment 12 Adrian Jadic 2009-06-03 18:10:30 UTC
I will add myself on this long list.
The clock seems to respect KDE's Regional & Language settings for time format but stubbornly refuses to change the format of the date.

I have even tried to change the system's locale to en_DK which sets the date to an ISO 8601 format but the clock widget did not budge.

One would ask: what good is to have a general user setting in your KDE desktop if the apps choose to ignore it?
Comment 13 Adrian Jadic 2009-06-03 18:17:21 UTC
Could we change the severity to normal here? It is really beyond wishlist....
We are talking about an *essential* app which is does not play by the rules of the KDE desktop.
Comment 14 Pino Toscano 2009-06-10 02:37:56 UTC
*** Bug 195837 has been marked as a duplicate of this bug. ***
Comment 15 James Richard Tyrer 2009-06-10 04:47:10 UTC
Re: Comment #14

Thanks.  Bugzilla's search didn't find this when I filed 195837.  This leads to the obvious suggestion that the title of this bug could be improved to make it easier to find.

The issue isn't really about a "custom" format.  In KDE-3.5, the Clock uses the (time and) date string set in the Locale KCM.  In 3.5 it is the "Short Date Format" string is used.  OTOH, the KDE-4.x.y Digital Clock Displays the Month with a word which would correspond to the "Date Format" string.

So, the first issue is that the title of bug 195837

Digital Clock date does not conform to SS locale setting:

SystemSettings Locale Date Format set to:

WEEKDAY MONTH dD YYYY

and the Digital Clock says:

Tue, 9 Jun 2009

With the above string, the Digital Clock should say:

TUESDAY JUNE 9 2009

Since using the locale string is the correct way to to this, it appears that this is a bug and not a wish list item.

The most egregious problem being that order of the month and date is not controlled by the locale string.  With a US locale, it is:

9 Jun

when it clearly should be:

Jun 9

This certainly indicates that there is a bug.

While it is OK for the Digital Clock Settings to modify the string set in
SystemSettings -- to remove WEEKDAY or YYYY -- it does need to start with
the locale string set in SystemSettings.

After these issues (which are bugs) are resolved, there are feature request items which we might want to address:

I would rather have the "Short Date Format" for the Digital Clock.  Perhaps this should be an option.  In that case, the "Show year" option should only apply to the "Date Format" while the "Show day of the week" option would also apply to the "Short Date Format" but with a different effect.
Comment 16 FiNeX 2009-06-16 13:48:55 UTC
*** Bug 196679 has been marked as a duplicate of this bug. ***
Comment 17 James Richard Tyrer 2009-07-03 08:36:04 UTC
Please see:

http://bugsfiles.kde.org/attachment.cgi?id=35009

This is a real screen shot, not a mock up.

https://bugs.kde.org/show_bug.cgi?id=195837#c6
Comment 18 Dotan Cohen 2009-07-03 17:26:50 UTC
James, has that code been committed?
Comment 19 James Richard Tyrer 2009-07-03 18:20:54 UTC
(In reply to comment #18)
> James, has that code been committed?

No, this is just experimental.
Comment 20 James Richard Tyrer 2009-07-04 03:50:56 UTC
Created attachment 35026 [details]
Screen Shot showing "ShortDate" format

More experimental code:

Is this what we want?

Yes, I know that the date is too small, but the sizing code doesn't work correctly.  Actually worse than that as it seems to work backwards.

This is the "Short date format" so you can change this by setting it in System Settings.
Comment 21 Dotan Cohen 2009-07-04 13:46:56 UTC
> Is this what we want?

If that is how the short format is formatted on your system, then yes this is what we want! Can you post a screenshot of the YYYY-MM-DD format just to calm us non-Americans who cannot use a system where the least significant unit is in the middle?

Thanks, James!
Comment 22 Arfrever Frehtes Taifersar Arahesis 2009-07-04 14:09:25 UTC
(In reply to comment #20)

Please attach the patch for source code so that it could be reviewed.
Comment 23 James Richard Tyrer 2009-07-04 14:33:36 UTC
Created attachment 35038 [details]
Screen Shot with Short date format set to YYYY-MM-DD in SS

OK, so I tried what is called the scientific date format in the USA.

I would presume that any legal Qt time format string would work here.

As the nagging message says, I had to restart KDE for this change to take effect.  But, that is a general issue with any change to the Locale settings.

BTW: the Liquid Crystal effect for the time is achieved using the free font called "Quartz".
Comment 24 Dotan Cohen 2009-07-04 15:33:37 UTC
> OK, so I tried what is called the scientific
> date format in the USA.

Thanks, I did not know what you call it. We just call it "the date" :)
Comment 25 Stephan Sokolow 2009-07-04 18:09:21 UTC
Heh. I'm Canadian, so we're supposed to be using DD/MM/YY (easily confused with the U.S.'s MM/DD/YY when the day is less than 13) but I also stick to YYYY-MM-DD whenever possible.

I just refer to it as "shortened ISO 8601 form". (The full ISO 8601 form specifies the timezone)
Comment 26 Arfrever Frehtes Taifersar Arahesis 2009-07-04 18:23:04 UTC
Created attachment 35040 [details]
plasma-4.2.4-use_ISO_8601_in_digital_clock.patch

Personally I use this patch.
Comment 27 Dotan Cohen 2009-07-04 19:17:24 UTC
YYYY-MM-DD is great, it makes everyone equally unhappy! Seriously, 
though, it is all in keeping with the digital watch's HH:MM:SS format of 
most significant unit on the left. This is great for organising files, too.

Have a great week.
Comment 28 James Richard Tyrer 2009-07-05 14:46:18 UTC
(In reply to comment #26)
> Personally I use this patch.

This does not address:

https://bugs.kde.org/show_bug.cgi?id=195837

I am using the code:

    dateString = KGlobal::locale()->formatDate(m_date, m_dateFormat);

to generate the date string.

The header file needs to have:

    KLocale::DateFormat m_dateFormat;

and you need to set "m_dateFormat" to ShortDate or LongDate

It appears to me that some additions need to be made to:

KLocale::formatDate

Specifically to add a bool option for showDayOfWeek and showYear which would be valid only for:

KLocale::DateFormat.LongDate and KLocale::DateFormat.FancyLongDate

It should be much easier to add this to KDELibs rather than reinventing the wheel in the DigitalClock widget.
Comment 29 Tristan Miller 2009-07-06 12:35:07 UTC
@Stephan Sokolow:  Actually, Canada recently adopted ISO 8601, so the official date format there is now YYYY-MM-DD, not DD/MM/YYYY.
Comment 30 Stephan Sokolow 2009-07-07 05:36:11 UTC
*sigh* Apparently yet another way in which the Ontario student loans office is always behind-schedule.
Comment 31 James Richard Tyrer 2009-07-13 23:48:14 UTC
Created attachment 35293 [details]
Horizontal Panel ShortDate with WeekDay and TimeZone
Comment 32 James Richard Tyrer 2009-07-13 23:50:03 UTC
Created attachment 35294 [details]
Horizontal Panel ShortDate with WeekDay
Comment 33 James Richard Tyrer 2009-07-13 23:51:51 UTC
Created attachment 35295 [details]
Horizontal Panel ShortDate
Comment 34 James Richard Tyrer 2009-07-13 23:54:36 UTC
Created attachment 35296 [details]
Clock made with vertical Panel, WeekDay and TimeZone

This is a vertical panel.  However it is only for the clock and therefore only tall enough to hold the clock.
Comment 35 James Richard Tyrer 2009-07-13 23:56:24 UTC
Created attachment 35297 [details]
Clock made with vertical Panel, WeekDay

This is similar to what I have on KDE-3.5.
Comment 36 James Richard Tyrer 2009-07-13 23:59:06 UTC
Created attachment 35298 [details]
Clock made with vertical Panel

These three vertical Panel examples will look better when the font size is fixed.  Also it would probably be a good idea to adjust the Panel Height and the spacer sized based on which options (WeedDay &/| TimeZone) are being used.
Comment 37 James Richard Tyrer 2009-07-14 00:00:48 UTC
Created attachment 35299 [details]
EXPERIMENTAL Patch

This is a work in progress, but it will work for you if _all_ you want is the ShortDate format.
Comment 38 Stefan Endrullis 2009-08-31 15:15:19 UTC
IMO it would be enough to provide a menu item "data & time format..." which opens the Locale KCM where the user can edit the global format (like in KDE3). But if you implement a more flexible solution, of course I'm fine with it as well.
Comment 39 John Layt 2009-10-18 00:32:55 UTC
*** Bug 197776 has been marked as a duplicate of this bug. ***
Comment 40 John Layt 2009-10-18 00:36:34 UTC
*** Bug 195837 has been marked as a duplicate of this bug. ***
Comment 41 James Richard Tyrer 2010-05-08 10:45:08 UTC
Created attachment 43362 [details]
EXPERIMENTAL Patch for KDE-4.4

The same code changes work with KDE-4.4 but due to large changes, the patch didn't work.
Comment 42 Teo Mrnjavac 2011-01-04 23:03:29 UTC
SVN commit 1211756 by mrnjavac:

Obey locale KCM settings for date format in the Digital Clock Plasma applet.
BUG:195837
BUG:247277
BUG:162368

 M  +5 -1      CMakeLists.txt  
 M  +61 -37    clock.cpp  
 M  +2 -3      clock.h  
 M  +44 -173   clockConfig.ui  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1211756
Comment 43 Benjamin Eikel 2011-04-28 09:22:04 UTC
Hello,

for me your fix does not work. I have installed KDE 4.6.2 from Debian experimental. I cannot change the format of the date shown by the digital clock by changing KDE's system settings. No matter if I change the short form date format or the long form date format the date shown by the clock stays the same 
(e.g. the clock shows 28 Apr 2011 but I configured it to be 2011-04-28).

Kind regards,
Benjamin