Skip to content

Commit 1757e69

Browse files
author
Richard Jones
committed
merge from HEAD
1 parent b791ed5 commit 1757e69

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ are given with the most recent entry first.
33

44
2003-??-?? 0.6.4
55
Fixed:
6+
- fixed date arithmetic to not allow day-of-month == 0 (sf bug 853306)
7+
- fixed date arithmetic to limit hours-per-day to 24, not 60
68
- hard-coded python2.3-ism (socket.timeout) fixed
79
- fixed activity displaying as future because of Date arithmetic fix in 0.6.3
810
(sf bug 842027).

roundup/date.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: date.py,v 1.54.2.1 2003-11-04 12:39:54 anthonybaxter Exp $
18+
# $Id: date.py,v 1.54.2.2 2003-12-04 23:10:41 richard Exp $
1919

2020
__doc__ = """
2121
Date, time and time interval handling.
@@ -190,27 +190,27 @@ def addInterval(self, interval):
190190
# now cope with under- and over-flow
191191
# first do the time
192192
while (second < 0 or second > 59 or minute < 0 or minute > 59 or
193-
hour < 0 or hour > 59):
193+
hour < 0 or hour > 23):
194194
if second < 0: minute -= 1; second += 60
195195
elif second > 59: minute += 1; second -= 60
196196
if minute < 0: hour -= 1; minute += 60
197197
elif minute > 59: hour += 1; minute -= 60
198198
if hour < 0: day -= 1; hour += 24
199-
elif hour > 59: day += 1; hour -= 24
199+
elif hour > 23: day += 1; hour -= 24
200200

201201
# fix up the month so we're within range
202202
while month < 1 or month > 12:
203203
if month < 1: year -= 1; month += 12
204204
if month > 12: year += 1; month -= 12
205205

206206
# now do the days, now that we know what month we're in
207-
def get_mdays(year,month):
207+
def get_mdays(year, month):
208208
if month == 2 and calendar.isleap(year): return 29
209209
else: return calendar.mdays[month]
210-
211-
while month < 1 or month > 12 or day < 0 or day > get_mdays(year,month):
210+
211+
while month < 1 or month > 12 or day < 1 or day > get_mdays(year,month):
212212
# now to day under/over
213-
if day < 0:
213+
if day < 1:
214214
# When going backwards, decrement month, then increment days
215215
month -= 1
216216
day += get_mdays(year,month)

0 commit comments

Comments
 (0)