#34828: DateTimeField breaks when given datetime that would be invalid in UTC
-------------------------------------+-------------------------------------
Reporter: Denis Cornehl | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 4.2
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by David Sanders):
> But shouldn't then the DateTimeField fail and not accept this datetime?
Or is it expected behaviour like this?
I don't think it's necessarily "expected" but it's a reasonable exception
to be getting given the -1 year. In this case `func()` is a psycopg2
(that's what I tested with) function – since Python's datetime min year is
1 then this is where errors will be thrown when it attempts to convert it
to a Python type.
I'm not sure what you mean by DateTimeField failing but fields don't
validate data from the database 🤔 Is there something you had in mind?
--
Ticket URL: <https://code.djangoproject.com/ticket/34828#comment:3>
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/0107018a83f3ab23-76546122-c3a5-4de8-b311-7afe951f50df-000000%40eu-central-1.amazonses.com.