Skip to content

Commit

Permalink
Use UTC as default for tzinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
gunthercox committed Nov 19, 2018
1 parent f6cace3 commit 114dff9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions chatterbot/conversation.py
@@ -1,3 +1,4 @@
from pytz import UTC
from datetime import datetime
from dateutil import parser as date_parser

Expand Down Expand Up @@ -73,6 +74,10 @@ def __init__(self, text, in_response_to=None, **kwargs):
if not isinstance(self.created_at, datetime):
self.created_at = date_parser.parse(self.created_at)

# Set timezone to UTC if no timezone was provided
if not self.created_at.tzinfo:
self.created_at = self.created_at.replace(tzinfo=UTC)

# This is the confidence with which the chat bot believes
# this is an accurate response. This value is set when the
# statement is returned by the chat bot.
Expand Down

0 comments on commit 114dff9

Please sign in to comment.