Commits

Luke Plant  committed cdd5ad1

Correction to day end range for DateTimeFilter

  • Participants
  • Parent commits e2adfe6

Comments (0)

Files changed (2)

File django_easyfilters/filters.py

             if range_type is MONTH:
                 first, last = 1, 12
             elif range_type is DAY:
-                first, last = 1, (results[0][0] + relativedelta(months=1, days=-1)).day
+                first, last = 1, ((results[0][0] + relativedelta(day=1)) + relativedelta(months=1, days=-1)).day
             else:
                 first = results[0][0].year
                 last = results[-1][0].year

File django_easyfilters/tests/filterset.py

         self.assertEqual(choices[-1].label[-3:], "-30")
 
         # October
-        for i in range(1, 31):
+        for i in range(2, 31):
             Person.objects.create(name="Joe", date_of_birth=date(2011, 10, i))
 
         params = MultiValueDict({'date_of_birth':['2011-10']})