Should not use datetime.today() to filter datetime field
|Reported by:||anonymous||Owned by:||adrian|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
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
return self.pub_date.date() == datetime.date(time.localtime[:3])
Change History (4)
comment:2 Changed 9 years ago by adrian
- priority changed from highest to normal
- Severity changed from critical to normal
comment:3 Changed 9 years ago by adrian
- Resolution set to worksforme
- Status changed from new to closed