You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
488 B
16 lines
488 B
9 years ago
|
# -*- coding: utf-8 -*-
|
||
|
from __future__ import unicode_literals
|
||
|
# Erik Stein <code@classlibrary.net>, 2015
|
||
|
|
||
|
from django.utils import timezone
|
||
|
|
||
|
|
||
|
def smart_default_tz(datetime_value):
|
||
|
"""
|
||
|
Returns the give datetime with the default timezone applied.
|
||
|
"""
|
||
|
if timezone.is_naive(datetime_value):
|
||
|
datetime_value = timezone.make_aware(datetime_value, timezone=timezone.get_default_timezone())
|
||
|
return timezone.localtime(datetime_value, timezone.get_default_timezone())
|
||
|
|