﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
27662	test suite fails in the last week of a leap year	Hartmut Goebel	nobody	"When running the test suite in the last week of a leap year, some tests fail. This is due to a subtle bug in timesince().

This bug **only** occurs if ""now"" is in a leap year and ""d"" (the date to be compared with now) is not. The test suite contains tests for comparing ""now"" with ""now+oneweek"", which is why this test fails only in the last week of a lead year.

This test-case test for this bug. Just add it to ""tests/utils_tests/test_timesince.py"":
{{{
    def test_year_boundry_current_is_leapyear(self):
        ""Current year is a leap year, and next week is in next year""
        today = datetime.date(2016, 12, 28) # within the last week of a leap year
        self.assertEqual(timeuntil(today + self.oneweek, today), '1\xa0week')
}}}

""today"" (2016) is in a leap year, while ""today+oneweek"" will be 2017-01-05 which is not in a leap year.

The bug is caused by django/utils/timesince.py, line 46:
{{{
   delta -= datetime.timedelta(calendar.leapdays(d.year, now.year))
}}}
"	Bug	closed	Utilities	1.10	Normal	duplicate			Unreviewed	0	0	0	0	0	0
