Code layout change.
[wolnelektury.git] / src / wolnelektury / utils.py
1 # -*- coding: utf-8 -*-
2 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
4 #
5 import pytz
6 from django.utils import timezone
7 from django.conf import settings
8
9 tz = pytz.timezone(settings.TIME_ZONE)
10
11 def localtime_to_utc(localtime):
12     return timezone.utc.normalize(
13         tz.localize(localtime)
14     )
15
16 def utc_for_js(dt):
17     return dt.strftime('%Y/%m/%d %H:%M:%S UTC')