#34828: DateTimeField breaks when given datetime that would be invalid in UTC
-------------------------------------+-------------------------------------
Reporter: Denis Cornehl | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: 4.2
(models, ORM) |
Severity: Normal | Resolution: wontfix
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 David Sanders):
* status: new => closed
* resolution: => wontfix
Comment:
Yep so essentially when going to the database it is a valid datetime, when
coming out of the database it isn't.
I believe the workaround in this case is to temporarily set `USE_TZ =
False` for scenarios where you expect to be retrieving negative dates that
were converted from positive dates. For validation one could check
whether the timestamp is within 24 hours (or your timezone) of the year 0
🤷♂️
The decision as to whether or not Django should validate & detect things
going into the database that would be converted to negative timestamps is
probably more something to raise on the Django forum. If that's something
you'd like to raise please feel free to start a thread:
https://www.djangoproject.com/community/ The process from here is to mark
the ticket wontfix and if the forum decides yes then we reopen this
ticket.
Hope that helps 🤷♂️🙂
--
Ticket URL: <https://code.djangoproject.com/ticket/34828#comment:5>
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/0107018a840e66e7-40d574ae-f11b-480a-819e-7b1044b009d9-000000%40eu-central-1.amazonses.com.