#27306: Document relation between auto_now/auto_now_add and timezones
------------------------------------------------+------------------------
               Reporter:  Baptiste Mispelon     |          Owner:  nobody
                   Type:  Cleanup/optimization  |         Status:  new
              Component:  Documentation         |        Version:  1.10
               Severity:  Normal                |       Keywords:
           Triage Stage:  Unreviewed            |      Has patch:  0
    Needs documentation:  0                     |    Needs tests:  0
Patch needs improvement:  0                     |  Easy pickings:  0
                  UI/UX:  0                     |
------------------------------------------------+------------------------
 The documentation for `DateField.auto_now` states: "Automatically set the
 field to now every time the object is saved." [1]

 It achieves this by doing `value = datetime.date.today()`. However, as
 noted in the discussion on #27082 and #25181 this might not exactly be
 "now" (depending on what you think "now" means).

 I think the documentation should clarify how `auto_now` interracts with
 timezone settings, and in particular what we mean when we say "now". I
 also think there's a bug lurking in the usage of `datetime.date.today()`
 and we should use the new `timezone.localdate()` instead.

 [1]
 
https://docs.djangoproject.com/en/1.10/ref/models/fields/#django.db.models.DateField.auto_now

--
Ticket URL: <https://code.djangoproject.com/ticket/27306>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.c23abb69c8b24db6e0788adf60b9b8c2%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to