#27082: Make timezone.localtime() default to timezone.now() when no value is 
given
-----------------------------+--------------------------------------
     Reporter:  bmispelon    |                    Owner:  nobody
         Type:  New feature  |                   Status:  new
    Component:  Utilities    |                  Version:  1.10
     Severity:  Normal       |               Resolution:
     Keywords:               |             Triage Stage:  Unreviewed
    Has patch:  0            |      Needs documentation:  0
  Needs tests:  0            |  Patch needs improvement:  0
Easy pickings:  0            |                    UI/UX:  0
-----------------------------+--------------------------------------

Comment (by aaugustin):

 To get the current date in the context of the active timezone, just use
 `datetime.date.today()`. Dates are always naive, so there's no reason to
 provide an alternate constructor such as `django.utils.timezone.now()` vs
 `datetime.datetime.(utc)now()`.

 `localtime()` is intended to be a conversion function, thus `value` is
 mandatory. It exists because the `datetime.astimezone` API isn't
 sufficient to implement conversions; pytz suggests a more complicated
 pattern which `localtime()` encapsulates.

 Please let me know if this addresses your needs or if you still think
 improvements are needed.

--
Ticket URL: <https://code.djangoproject.com/ticket/27082#comment:1>
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/067.e55fa45ad97ab1a6df62ca59d53a498d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to