Opened 10 years ago

Closed 10 years ago

Last modified 7 years ago

#23668 closed New feature (fixed)

make_aware() and make_naive() should default to the current timezone

Reported by: Jon Dufresne Owned by: nobody
Component: Utilities Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Currently, the timezone utility functions make_aware() and make_naive() require two arguments, a datetime object and a timezone. With make_aware(), frequently the user will need to convert a naive datetime object to the current (or default) timezone. As this appears to be the most common usage of make_aware() it ought to be the default. Therefore the function will be easier to use and will "do the right thing" by default.

Pull request <https://github.com/django/django/pull/3377>

Change History (4)

comment:1 by Tim Graham, 10 years ago

Has patch: set
Triage Stage: UnreviewedAccepted

comment:2 by Tim Graham, 10 years ago

Triage Stage: AcceptedReady for checkin

comment:3 by Tim Graham <timograham@…>, 10 years ago

Resolution: fixed
Status: newclosed

In 59026bfbf957cd31c659bdfac36d992816eba114:

Fixed #23668 -- Changed make_aware() and make_naive() to use the current timezone by default

Thanks Aymeric Augustin for review.

comment:4 by Tim Graham <timograham@…>, 7 years ago

In 3c34452a:

Refs #23668 -- Removed passing default argument of current TZ to make_aware()/naive.

Note: See TracTickets for help on using tickets.
Back to Top