Enable leading zeros in Clock Desklet

Bug #805673 reported by Danny Trunk
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gDesklets
Fix Committed
Wishlist
Bjoern Koch

Bug Description

Be able to use format like %y-%02m-%02d to get format like: 2011-07-04
I added this functionality (not the clean way) by doing:
        out = date_format.replace("%y", `y`) \
                         .replace("%m", `m`) \
                         .replace("%d", `d`) \
                         .replace("%02m", `m`.zfill(2)) \
                         .replace("%02d", `d`.zfill(2))

Maybe there's a better way?!
Just a suggestion...

Revision history for this message
Bjoern Koch (h.humpel) wrote :

Thanks for the hint/code.
I'll take a look at it and will try to implement it in the upcoming version of the Clock Desklet which should be shipped with gDesklets 0.36.4 ;).

Changed in gdesklets:
assignee: nobody → Bjoern Koch (h.humpel)
importance: Undecided → Wishlist
milestone: none → release-of-0.36.4
status: New → In Progress
Revision history for this message
Bjoern Koch (h.humpel) wrote :

Just changed the Clock Desklet to use the "strftime" output provided by Python's time module:
http://docs.python.org/library/time.html#time.strftime
I think/guess this is the way it should be done.

The new version of the Clock Desklet (v0.55) can be found in rev. #65 of the desklets-basic branch.

To be able to use this new feature the Clock Desklet needs an updated version of the ITime Control (ITime:cod6a75eyg1gl9rqbjlx967cu-2). This can be found in rev. #182 of the 0.3x branch.

Both will be released with the upcoming release of gDesklets 0.36.4.

Changed in gdesklets:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.