1- # $Id: date.py,v 1.6 2001-07-31 09:54:18 richard Exp $
1+ # $Id: date.py,v 1.7 2001-08-02 00:27:04 richard Exp $
22
33import time , re , calendar
44
@@ -302,8 +302,16 @@ def pretty(self, threshold=('d', 5)):
302302 < 1 day
303303 otherwise, return None (so a full date may be displayed)
304304 '''
305- if self .year or self .month or self . day > 5 :
305+ if self .year or self .month > 2 :
306306 return None
307+ if self .month :
308+ days = (self .month * 30 ) + self .day
309+ if days > 28 :
310+ return '%s months' % int (days / 30 )
311+ else :
312+ return '%s weeks' % int (days / 7 )
313+ if self .day > 7 :
314+ return '%s weeks' % self .day
307315 if self .day > 1 :
308316 return '%s days' % self .day
309317 if self .day == 1 or self .hour > 12 :
@@ -323,7 +331,7 @@ def pretty(self, threshold=('d', 5)):
323331 return '1 minute'
324332 if self .minute < 15 :
325333 return '%s minutes' % self .minute
326- quart = self .minute / 15
334+ quart = int ( self .minute / 15 )
327335 if quart == 2 :
328336 return '1/2 an hour'
329337 return '%s/4 hour' % quart
@@ -355,6 +363,9 @@ def test():
355363
356364#
357365# $Log: not supported by cvs2svn $
366+ # Revision 1.6 2001/07/31 09:54:18 richard
367+ # Fixed the 2.1-specific gmtime() (no arg) call in roundup.date. (Paul Wright)
368+ #
358369# Revision 1.5 2001/07/29 07:01:39 richard
359370# Added vim command to all source so that we don't get no steenkin' tabs :)
360371#
0 commit comments