#16023: Range query on a datetime is NOT inclusive with dates
------------------------------------+-------------------------------
Reporter: jodym@… | Owner: nobody
Type: Bug | Status: new
Milestone: | Component: Documentation
Version: 1.3 | Severity: Normal
Resolution: | Keywords:
Triage Stage: Accepted | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
------------------------------------+-------------------------------
Comment (by Jody McIntyre <jodym@…>):
Replying to [comment:1 aaugustin]:
> In Python and many other languages, `i in range(n)` means `0 <= i < n`.
If I want all transactions from April, I'd use:
>
> {{{
> start_date = datetime.date(2011, 4, 1)
> end_date = datetime.date(2011, 5, 1)
> }}}
That will give all transactions between 2011-04-01 00:00:00 and 2011-05-01
00:00:00 inclusive, which isn't quite the same thing (it will include
transactions dated exactly 2011-05-01 00:00:00.)
What's worse is that if start_date and end_date are DateField(), you'll
get all transactions on 2011-05-01, which is inconsistent with the
behaviour if it's a DateTimeField().
--
Ticket URL: <https://code.djangoproject.com/ticket/16023#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.