Skip to content

Commit

Permalink
update for dpy2
Browse files Browse the repository at this point in the history
fixes internal server error, Merge whenever dev gets merged into master for modmail
  • Loading branch information
lorenzo132 authored Nov 21, 2021
1 parent 31a91bb commit 2689902
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from datetime import datetime
from datetime import datetime, timezone
import dateutil.parser

from sanic import response
Expand All @@ -13,7 +13,7 @@ def __init__(self, app, data):
self.key = data["key"]
self.open = data["open"]
self.created_at = dateutil.parser.parse(data["created_at"])
self.human_created_at = duration(self.created_at, now=datetime.utcnow())
self.human_created_at = duration(self.created_at, now=datetime.now(timezone.utc))
self.closed_at = (
dateutil.parser.parse(data["closed_at"]) if not self.open else None
)
Expand All @@ -35,7 +35,7 @@ def system_avatar_url(self):

@property
def human_closed_at(self):
return duration(self.closed_at, now=datetime.utcnow())
return duration(self.closed_at, now=datetime.now(timezone.utc))

@property
def message_groups(self):
Expand Down Expand Up @@ -166,7 +166,7 @@ class Message:
def __init__(self, data):
self.id = int(data["message_id"])
self.created_at = dateutil.parser.parse(data["timestamp"])
self.human_created_at = duration(self.created_at, now=datetime.utcnow())
self.human_created_at = duration(self.created_at, now=datetime.now(timezone.utc))
self.raw_content = data["content"]
self.content = self.format_html_content(self.raw_content)
self.attachments = [Attachment(a) for a in data["attachments"]]
Expand Down

0 comments on commit 2689902

Please sign in to comment.