diff options
author | niemeyer <> | 2010-03-30 00:42:25 +0000 |
---|---|---|
committer | niemeyer <> | 2010-03-30 00:42:25 +0000 |
commit | e9f0b2450ce1073ecc7b78a6f8631187bc6d018a (patch) | |
tree | 4c53bcf7b529c00004d5b08f1f310c5dc9d1fa28 | |
parent | 27bf3ec9d045b3b2ceee376f3b662f057836a76f (diff) | |
download | dateutil-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-- | NEWS | 16 | ||||
-rw-r--r-- | dateutil/relativedelta.py | 2 | ||||
-rw-r--r-- | test.py | 5 |
3 files changed, 22 insertions, 1 deletions
@@ -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 @@ -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)) |