﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
17992	Public API for localtime	Bradley Ayers <bradley.ayers@…>	nobody	"I think there should be a public API for converting timezone aware datetime objects to current timezone versions. This actually existed in django.utils.timezone as localtime, but was made private and removed from the documentation in https://code.djangoproject.com/changeset/17642

The current options for converting a datetime to the current timezone are:

1. Use Python's datetime.astimezone in conjunction with django.utils.timezone helpers:

{{{
from django.utils import timezone
local = dt.astimezone(timezone.get_current_timezone())
}}}

2. Use the public API for the localtime template filter via the privatish module django.template.defaultfilters:

{{{
from django.template.defaultfilters import localtime
local = localtime(dt)
}}}

While (2) is much cleaner, I'd argue it's dirty to import from defaultfilters.

I propose re-publicising django.utils.timezone.localtime as a public API.

My use-case is generating PDFs that have datetimes in their content."	New feature	new	Core (Other)	1.4	Normal		timezone localtime		Unreviewed	0	0	0	0	0	0
