diff --git a/roundup/date.py b/roundup/date.py
index db197974a4589a89ba8de31b4aa69a170a5a650d..ef65d87f86fb7c1c099777fc8910f11f13094d26 100644 (file)
--- a/roundup/date.py
+++ b/roundup/date.py
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: date.py,v 1.10 2001-08-07 00:24:42 richard Exp $
+# $Id: date.py,v 1.13 2001-09-18 22:58:37 richard Exp $
import time, re, calendar
>>> Date("14:25", -5)
<Date 2000-06-25.19:25:00>
'''
- isDate = 1
-
def __init__(self, spec='.', offset=0):
"""Construct a date given a specification and a time zone offset.
1. an interval from this date to produce another date.
2. a date from this date to produce an interval.
"""
- if other.isDate:
+ if isinstance(other, Date):
# TODO this code will fall over laughing if the dates cross
# leap years, phases of the moon, ....
a = calendar.timegm((self.year, self.month, self.day, self.hour,
>>> Date(". + 2d") - Interval("3w")
<Date 2000-06-07.00:34:02>
'''
- isInterval = 1
-
def __init__(self, spec, sign=1):
"""Construct an interval given a specification."""
if type(spec) == type(''):
'''
if self.year or self.month > 2:
return None
- if self.month:
+ if self.month or self.day > 13:
days = (self.month * 30) + self.day
if days > 28:
- return '%s months'%int(days/30)
+ if int(days/30) > 1:
+ return '%s months'%int(days/30)
+ else:
+ return '1 month'
else:
return '%s weeks'%int(days/7)
if self.day > 7:
- return '%s weeks'%self.day
+ return '1 week'
if self.day > 1:
return '%s days'%self.day
if self.day == 1 or self.hour > 12:
#
# $Log: not supported by cvs2svn $
+# Revision 1.12 2001/08/17 03:08:11 richard
+# fixed prettification of intervals of 1 week
+#
+# Revision 1.11 2001/08/15 23:43:18 richard
+# Fixed some isFooTypes that I missed.
+# Refactored some code in the CGI code.
+#
+# Revision 1.10 2001/08/07 00:24:42 richard
+# stupid typo
+#
# Revision 1.9 2001/08/07 00:15:51 richard
# Added the copyright/license notice to (nearly) all files at request of
# Bizar Software.