Opened 4 years ago
Last modified 4 years ago
#32320 closed Bug
DateField uses unlocalized function when auto_now is True — at Initial Version
Description ¶
Hi.
django.db.models.fields.DateField(auto_now=True)
sets date as datetime.date.today()
(see [here](https://github.com/django/django/blob/master/django/db/models/fields/__init__.py#L1246)). This date is not localized with django and can be different from django.utils.timezone.now()
used in DateTimeField
, if django and local timzeones differ.
Suggestion:
Change datetime.date.today()
to django.utils.timezone.now().date()
Note:
See TracTickets
for help on using tickets.