Opened 19 months ago

Closed 19 months ago

Last modified 12 months ago

#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


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.

Attachments (0)

Change History (4)

comment:1 Changed 19 months ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to needsinfo
  • Status changed from new to closed

This is probably on purpose and not changeable in a backwards compatible way. See

If you tell me which function you're referring to, I'll take a look.

comment:2 Changed 19 months ago by mitar

I think about this lines:

Otherwise, such function used everywhere instead of .date() call would not really break backwards compatibility, I believe.

comment:3 Changed 19 months ago by aaugustin

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 Changed 12 months ago by mitar

I think you get this when you specify default value with call?

Add Comment

Modify Ticket

Change Properties
<Author field>
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.