#28410: query filter on date portion of datetime creates wrong parameters for
mysql
CONVERT_TZ function and returns no results
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
donaldinho |
Type: Bug | Status: new
Component: Database | Version: 1.11
layer (models, ORM) | Keywords: timezone date
Severity: Normal | filter
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
I am setting the timezone
{{{
tz = timezone.get_fixed_timezone(-300)
timezone.activate(tz)
}}}
then I apply the filter. search_date is just a string submitted by the
client
{{{
matches = query.filter(startDateTime__date=datetime.strptime(search_date,
'%Y-%m-%d').date())
}}}
the where clause that is produced is
{{{
DATE(CONVERT_TZ(`central_soccer_match`.`startDateTime`, 'UTC', '-0500')) =
'2017-07-18'
}}}
where as it should be
{{{
DATE(CONVERT_TZ(`central_soccer_match`.`startDateTime`, 'UTC', '-05:00'))
= '2017-07-18'
}}}
note the colon in the timezone we are converting to.
--
Ticket URL: <https://code.djangoproject.com/ticket/28410>
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/053.3b6c7333d643672ce857b052f7102079%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.