summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorniemeyer <>2010-03-30 00:42:25 +0000
committerniemeyer <>2010-03-30 00:42:25 +0000
commite9f0b2450ce1073ecc7b78a6f8631187bc6d018a (patch)
tree4c53bcf7b529c00004d5b08f1f310c5dc9d1fa28
parent27bf3ec9d045b3b2ceee376f3b662f057836a76f (diff)
downloaddateutil-e9f0b2450ce1073ecc7b78a6f8631187bc6d018a.tar.gz
Adam Ryan reported a problem in the relativedelta implementation which
affected the yearday parameter in the month of January specifically. This has been unittested and fixed.
-rw-r--r--NEWS16
-rw-r--r--dateutil/relativedelta.py2
-rw-r--r--test.py5
3 files changed, 22 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index a56018a..8738e84 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,19 @@
+
+Version 1.5
+-----------
+
+- As reported by Mathieu Bridon, rrules were matching the bysecond rules
+ incorrectly against byminute in some circumstances when the SECONDLY
+ frequency was in use, due to a copy & paste bug. The problem has been
+ unittested and corrected.
+
+- Adam Ryan reported a problem in the relativedelta implementation which
+ affected the yearday parameter in the month of January specifically.
+ This has been unittested and fixed.
+
+- Updated timezone information.
+
+
Version 1.4.1
-------------
diff --git a/dateutil/relativedelta.py b/dateutil/relativedelta.py
index 562a7d3..6c722b2 100644
--- a/dateutil/relativedelta.py
+++ b/dateutil/relativedelta.py
@@ -190,7 +190,7 @@ Here is the behavior of operations with relativedelta:
if yday <= ydays:
self.month = idx+1
if idx == 0:
- self.day = ydays
+ self.day = yday
else:
self.day = yday-ydayidx[idx-1]
break
diff --git a/test.py b/test.py
index ed23c03..049fede 100644
--- a/test.py
+++ b/test.py
@@ -131,6 +131,11 @@ class RelativeDeltaTest(unittest.TestCase):
self.assertEqual(self.today+relativedelta(yearday=261),
date(2003, 9, 18))
+ def testYearDayBug(self):
+ # Tests a problem reported by Adam Ryan.
+ self.assertEqual(date(2010, 1, 1)+relativedelta(yearday=15),
+ date(2010, 1, 15))
+
def testNonLeapYearDay(self):
self.assertEqual(date(2003, 1, 1)+relativedelta(nlyearday=260),
date(2003, 9, 17))