#26345: Unexpected DateRange behavior
----------------------------------+-----------------
Reporter: dbinetti | Owner:
Type: Bug | Status: new
Component: contrib.postgres | Version: 1.9
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+-----------------
Asked on #django to no response, so filing here.
When saving a postgres DateRange object to a DateRangeField, the `bounds`
are always changed to the default, even if a different bounds is
requested. The date payload (upper or lower), is also changed according
to the new bounds. This may be as designed, but it unexpected from my
perspective.
For instance, my users may enter data in a form to express a two day event
as Jan 1 2016 - Jan 2 2106, '[]' (inclusive lower and inclusive upper.)
However, this is translated in the database as Jan 1 2016 - Jan 3 2016
'[)' (inclusive lower *exclusive* upper with changed date) so if I then
try to render the upper date directly, it will do so as Jan 3, confusing
the user (and the developer :-) !)
Yes, I could accommodate this with some display logic, but that strikes me
as the wrong approach. I've included a repo with a test demonstrating
what I was expecting to see.
https://github.com/dbinetti/djangodaterange
--
Ticket URL: <https://code.djangoproject.com/ticket/26345>
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/051.f1d509aee1696d13f16c3e46d95606e1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.