summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1957038)
raw | patch | inline | side by side (parent: 1957038)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Mon, 9 Dec 2002 02:43:21 +0000 (02:43 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Mon, 9 Dec 2002 02:43:21 +0000 (02:43 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1392 57a73879-2fb5-44c3-a270-3262357dd7e2
roundup/date.py | patch | blob | history | |
test/test_dates.py | patch | blob | history |
diff --git a/roundup/date.py b/roundup/date.py
index 54265d170431c02edbb610749a3487a55f3e6515..aee9acd3f4abd584f53055f55347c399a25fc0ae 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.36 2002-10-12 23:10:36 richard Exp $
+# $Id: date.py,v 1.37 2002-12-09 02:43:21 richard Exp $
__doc__ = """
Date, time and time interval handling.
return '<Date %s>'%self.__str__()
def local(self, offset):
- """Return this date as yyyy-mm-dd.hh:mm:ss in a local time zone."""
- t = (self.year, self.month, self.day, self.hour + offset, self.minute,
- self.second, 0, 0, 0)
- self.year, self.month, self.day, self.hour, self.minute, \
- self.second, x, x, x = time.gmtime(calendar.timegm(t))
+ """ Return this date as yyyy-mm-dd.hh:mm:ss in a local time zone.
+ """
+ return Date((self.year, self.month, self.day, self.hour + offset,
+ self.minute, self.second, 0, 0, 0))
def get_tuple(self):
return (self.year, self.month, self.day, self.hour, self.minute,
diff --git a/test/test_dates.py b/test/test_dates.py
index 88accdba2c34de7d61039762391bd881d1caeb71..10cc10cafeb9a7a1db50ded71fd8a1aee593eec1 100644 (file)
--- a/test/test_dates.py
+++ b/test/test_dates.py
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: test_dates.py,v 1.14 2002-10-11 01:25:40 richard Exp $
+# $Id: test_dates.py,v 1.15 2002-12-09 02:43:21 richard Exp $
import unittest, time
date = Date('2001-03-01.00:00:00') - Interval('00:00:3661')
ae(str(date), '2001-02-28.22:58:59')
+ # local()
+ date = Date("02:42:20")
+ date = date.local(10)
+ ae(str(date), '%s-%02d-%02d.12:42:20'%(y, m, d))
+
def testInterval(self):
ae = self.assertEqual
ae(str(Interval('3y')), '+ 3y')