Skip to content

Commit

Permalink
Parse dateReceived
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Campbell committed Sep 9, 2020
1 parent 6966927 commit b522fe4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions api/ECNQueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def __init__(self, queue: str, number: int) -> None:
self.priority = self.__getMostRecentHeaderByType("Priority")
self.department = self.__getMostRecentHeaderByType("Department")
self.building = self.__getMostRecentHeaderByType("Building")
self.dateReceived = self.__getMostRecentHeaderByType("Date")
self.dateReceived = self.__getParsedDate(self.__getMostRecentHeaderByType("Date"))

self.jsonData = {
"queue": self.queue,
Expand Down Expand Up @@ -274,13 +274,13 @@ def __getFormattedDate(self, date: str) -> str:
str: Properly formatted date/time recieved or empty string.
"""
try:
objDateRecieved = parse(date)
parsedDate = parse(date)
except:
return ""

formattedDateRecieved = objDateRecieved.strftime("%Y-%m-%dT%H:%M:%S%z")
parsedDateString = parsedDate.strftime("%Y-%m-%dT%H:%M:%S%z")

return formattedDateRecieved
return parsedDateString

def toJson(self) -> dict:
"""Returns a JSON safe representation of the item.
Expand Down Expand Up @@ -362,4 +362,4 @@ def getQueues() -> list:
if isDirectory and isValid:
queues.append(Queue(file))

return queues
return queues

0 comments on commit b522fe4

Please sign in to comment.