aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2019-09-26 12:09:46 -0700
committerGravatar MarkKoz <[email protected]>2019-09-26 12:09:46 -0700
commita4018055f055230e6259c3054b9e1767ec36b864 (patch)
tree9fa20f4102c9b703723f76c406cad7b8c75da352
parentUse format_infaction datetime util in talentpool (diff)
Parse timestamps with dateutil for watch channels
-rw-r--r--bot/cogs/watchchannels/watchchannel.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/bot/cogs/watchchannels/watchchannel.py b/bot/cogs/watchchannels/watchchannel.py
index f706ff634..122e3dfe8 100644
--- a/bot/cogs/watchchannels/watchchannel.py
+++ b/bot/cogs/watchchannels/watchchannel.py
@@ -1,5 +1,4 @@
import asyncio
-import datetime
import logging
import re
import textwrap
@@ -8,6 +7,7 @@ from collections import defaultdict, deque
from dataclasses import dataclass
from typing import Optional
+import dateutil.parser
import discord
from discord import Color, Embed, HTTPException, Message, Object, errors
from discord.ext.commands import BadArgument, Bot, Cog, Context
@@ -321,10 +321,7 @@ class WatchChannel(metaclass=CogABCMeta):
@staticmethod
def _get_time_delta(time_string: str) -> str:
"""Returns the time in human-readable time delta format."""
- date_time = datetime.datetime.strptime(
- time_string,
- "%Y-%m-%dT%H:%M:%S.%fZ"
- ).replace(tzinfo=None)
+ date_time = dateutil.parser.isoparse(time_string).replace(tzinfo=None)
time_delta = time_since(date_time, precision="minutes", max_units=1)
return time_delta