summaryrefslogtreecommitdiff
path: root/server/szurubooru/func/util.py
diff options
context:
space:
mode:
authorrr- <rr-@sakuya.pl>2016-07-03 14:46:15 +0200
committerrr- <rr-@sakuya.pl>2016-07-03 14:46:28 +0200
commitac23067fdfd6289e537ec10d82e3828736ea7a79 (patch)
tree3b2dcee718d138c618115ddf64d968b561a53590 /server/szurubooru/func/util.py
parent1f413763bdd010da6b5c03aa13489231fbc9b6cd (diff)
server/general: use UTC time stamps
Diffstat (limited to 'server/szurubooru/func/util.py')
-rw-r--r--server/szurubooru/func/util.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/server/szurubooru/func/util.py b/server/szurubooru/func/util.py
index 65fc196..ff6c385 100644
--- a/server/szurubooru/func/util.py
+++ b/server/szurubooru/func/util.py
@@ -74,7 +74,7 @@ class dotdict(dict): # pylint: disable=invalid-name
__setattr__ = dict.__setitem__
__delattr__ = dict.__delitem__
-def parse_time_range(value, timezone=datetime.timezone(datetime.timedelta())):
+def parse_time_range(value):
''' Return tuple containing min/max time for given text representation. '''
one_day = datetime.timedelta(days=1)
one_second = datetime.timedelta(seconds=1)
@@ -84,14 +84,14 @@ def parse_time_range(value, timezone=datetime.timezone(datetime.timedelta())):
raise errors.ValidationError('Empty date format.')
if value == 'today':
- now = datetime.datetime.now(tz=timezone)
+ now = datetime.datetime.utcnow()
return (
datetime.datetime(now.year, now.month, now.day, 0, 0, 0),
datetime.datetime(now.year, now.month, now.day, 0, 0, 0) \
+ one_day - one_second)
if value == 'yesterday':
- now = datetime.datetime.now(tz=timezone)
+ now = datetime.datetime.utcnow()
return (
datetime.datetime(now.year, now.month, now.day, 0, 0, 0) - one_day,
datetime.datetime(now.year, now.month, now.day, 0, 0, 0) \