Issue 1170119
Created on 2005-03-24 20:07 by anonymous, last changed 2005-03-25 09:15 by a1s.
msg1918 |
Author: [hidden] (anonymous) |
Date: 2005-03-24 20:07 |
|
The Full Date Format generated by Date() may work okay
for many things, but creates a serious usability issue
when generating trackers that use due dates or similar
things.
The date strings become disproportionally huge, in
combination with the active string they sometimes take
up lots of screen space, making the titles pretty much
unreadable.
Much of that is not necessary.
Hardly ever will roundup be used to coordinate things
by the second (does anyone really use seconds?) which
would save three characters (:00).
Also, the "." makes it impossible to linebreak.
And finally, the YYYY format will wrap around in 95
years, I know, but I think we can live with that for now.
So a short form would be very much appreciated.
|
msg1919 |
Author: [hidden] (anonymous) |
Date: 2005-03-24 21:13 |
|
Logged In: NO
Okay. Just fixed the problem for myself by introduction of a
"short" format.
This should do the trick for now. Patch included.
I would appreciate seeing this going into roundup. If you
need legal statement, contact greve@fsfeurope.org. Also, I
would still appreciate a shorter (visual?) form for
"Activity" which also wastes space...
Oh well. Won't do anything about that right now.
Hope this helps.
Georg
--- date.py.orig 2005-03-24 21:08:18.399146294 +0100
+++ date.py 2005-03-24 21:32:27.441344141 +0100
@@ -355,6 +355,10 @@ class Date:
return f%(self.year, self.month, self.day,
self.hour, self.minute,
self.second)
+ def short(self, offset=0):
+ f = '%04d-%02d-%02d %02d:%02d'%(self.year,
self.month, self.day, self.hour + offset, self.minute)
+ return f[2:]
+
def pretty(self, format='%d %B %Y'):
''' print up the date date using a pretty format...
--- cgi/templating.py.orig 2005-03-24 21:26:55.568646572 +0100
+++ cgi/templating.py 2005-03-24 21:32:48.095524732 +0100
@@ -1301,6 +1301,19 @@ class DateHTMLProperty(HTMLProperty):
value, anonymous=anonymous)
self._offset = offset
+ def short(self):
+ ''' Render a "short" representation of the property
+ '''
+ self.view_check()
+
+ if self._value is None:
+ return ''
+ if self._offset is None:
+ offset = self._db.getUserTimezone()
+ else:
+ offset = self._offset
+ return str(self._value.short(offset))
+
def plain(self):
''' Render a "plain" representation of the property
'''
|
msg1920 |
Author: [hidden] (a1s) |
Date: 2005-03-25 09:15 |
|
Logged In: YES
user_id=8719
in html templates you may get date in any form you want by
calling .pretty() with explicit format string.
|
msg1921 |
Author: [hidden] (richard) |
Date: 2005-03-25 13:02 |
|
Logged In: YES
user_id=6405
Please just use the pretty() method which allows you to
specify the date format.
|
|
Date |
User |
Action |
Args |
2005-03-24 20:07:31 | anonymous | create | |
|