Message1068
From: ron_dagostino@ssga.com
>>> from roundup.date import Date
>>> now = Date('.')
>>> yesterday = Date('-1d')
>>> now.pretty()
' 3 December 2003'
>>> yesterday.pretty()
' 2 December 2003'
>>> d = yesterday - now
>>> d.pretty()
'yesterday'
>>> x = Date('-3d')
>>> d = x - now
>>> d.pretty()
'2 days ago' <<<<<<<<<<<<<<<<<<<
>>> x.pretty()
' 0 December 2003' <<<<<<<<<<<<<<<<
>>> x = Date('-4d')
>>> x.pretty()
'29 November 2003'
>>> d = x - now
>>> d.pretty()
'3 days ago'
>>>
Here is the fix in the addInterval() routine of date.py:
diff date.py~ date.py
192,194c192,194
< while (second < 0 or second > 59 or minute < 0
or minute > 59 or
< hour < 0 or hour > 59):
< if second < 0: minute -= 1; second += 60
---
> while (second < 1 or second > 59 or minute < 1
or minute > 59 or
> hour < 1 or hour > 59):
> if second < 1: minute -= 1; second += 60
196c196
< if minute < 0: hour -= 1; minute += 60
---
> if minute < 1: hour -= 1; minute += 60
198c198
< if hour < 0: day -= 1; hour += 24
---
> if hour < 1: day -= 1; hour += 24
211c211
< while month < 1 or month > 12 or day < 0 or
day > get_mdays(year,month):
---
> while month < 1 or month > 12 or day < 1 or
day > get_mdays(year,month):
213c213
< if day < 0:
---
> if day < 1:
bash-2.05b$ |
|
Date |
User |
Action |
Args |
2009-02-03 14:20:33 | admin | link | issue853306 messages |
2009-02-03 14:20:33 | admin | create | |
|