#31446: Annotate with ExpressionWrapper gives wrong result on date field.
-------------------------------------+-------------------------------------
Reporter: Gerben Morsink | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: 2.2
(models, ORM) |
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):
* status: new => closed
* resolution: => invalid
Comment:
I think you mixed field types. You cannot subtract an `IntegerField` from
the `DateField` because MySQL will implicitly cast a date to integer, as a
result you'll get `20200308999990.000000`. Using `DurationField` works as
expected and returns `2020-02-28 00:00:00`.
Closing per TicketClosingReasons/UseSupportChannels.
--
Ticket URL: <https://code.djangoproject.com/ticket/31446#comment:4>
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 view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.876f1d161ffd8fa4195d8f4d5d64a9ad%40djangoproject.com.