#2518 closed defect (worksforme)
Should not use datetime.today() to filter datetime field
Reported by: | anonymous | Owned by: | Adrian Holovaty |
---|---|---|---|
Component: | contrib.admin | Version: | 0.91 |
Severity: | normal | Keywords: | date time |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
datetime.today() does not consider time zone.
So if u use it to filter datetime filed, it does not work correctly.
Just like int tutorial
was_published_today should be written like this
def was_published_today(self)
return self.pub_date.date() == datetime.date(time.localtime[:3])
Change History (4)
comment:1 by , 18 years ago
Version: | → 0.91 |
---|
comment:2 by , 18 years ago
priority: | highest → normal |
---|---|
Severity: | critical → normal |
comment:3 by , 18 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Please reopen this with more information -- I can't replicate this.