#19055 closed Uncategorized (needsinfo)
DateField uses date() which might not be correct in timezone aware situations
| Reported by: | Mitar | Owned by: | nobody |
|---|---|---|---|
| Component: | Forms | Version: | 1.4 |
| Severity: | Normal | Keywords: | |
| Cc: | mmitar@… | Triage Stage: | Unreviewed |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
DateField uses date() to convert to date, which might not be correct in timezone aware situations. At least according to documentation, a more precise handling should be made.
Change History (4)
comment:1 by , 13 years ago
| Resolution: | → needsinfo |
|---|---|
| Status: | new → closed |
comment:2 by , 13 years ago
I think about this lines:
Otherwise, such function used everywhere instead of .date() call would not really break backwards compatibility, I believe.
comment:3 by , 13 years ago
My personal opinion is that DateField shouldn't accept datetime objects. However it did long before I started using Django :)
My advice is not to mix dates and datetimes.
Could you clarify why you need to feed a datetime into a DateField?
comment:4 by , 13 years ago
I think you get this when you specify default value with timezone.now() call?
This is probably on purpose and not changeable in a backwards compatible way. See http://groups.google.com/group/django-developers/browse_thread/thread/cf0423bbb85b1bbf
If you tell me which function you're referring to, I'll take a look.