Skip to content

Commit

Permalink
Fix StopwatchForm.clean
Browse files Browse the repository at this point in the history
  • Loading branch information
Mortal committed Mar 2, 2017
1 parent 89e6365 commit dc8b27b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions stopwatch/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,13 @@ def __init__(self, *args, **kwargs):

def clean(self):
cleaned_data = super(StopwatchForm, self).clean()
start_time = cleaned_data['start_time']
if start_time < 0:
start_time += 2 ** 32
cleaned_data['start_time'] = (
datetime.datetime.utcfromtimestamp(
start_time).replace(tzinfo=timezone.utc))
if 'start_time' in cleaned_data:
start_time = cleaned_data['start_time']
if start_time < 0:
start_time += 2 ** 32
cleaned_data['start_time'] = (
datetime.datetime.utcfromtimestamp(
start_time).replace(tzinfo=timezone.utc))
return cleaned_data


Expand Down

0 comments on commit dc8b27b

Please sign in to comment.