Parse time zone

main2
Bob Mottram 2019-10-11 17:54:55 +01:00
parent f70d482478
commit 1811298962
2 changed files with 3 additions and 5 deletions

View File

@ -164,7 +164,7 @@ def inboxPermittedMessage(domain: str,messageJson: {},federationList: []) -> boo
return True
def validPublishedDate(published) -> bool:
def validPublishedDate(published: str) -> bool:
currTime=datetime.datetime.utcnow()
pubDate=datetime.datetime.strptime(published,"%Y-%m-%dT%H:%M:%SZ")
daysSincePublished = (currTime - pubTime).days
@ -1378,9 +1378,7 @@ def inboxUpdateCalendar(baseDir: str,handle: str,postJsonObject: {}) -> None:
if not tagDict.get('startTime'):
continue
# get the year and month from the event
eventTime= \
datetime.datetime.strptime(tagDict['startTime'], \
"%Y-%m-%dT%H:%M:%SZ")
eventTime=datetime.datetime.strptime(tagDict['startTime'],"%Y-%m-%dT%H:%M:%S%z")
eventYear=int(eventTime.strftime("%Y"))
eventMonthNumber=int(eventTime.strftime("%m"))

View File

@ -2785,7 +2785,7 @@ def getCalendarEvents(baseDir: str,nickname: str,domain: str,year: int,monthNumb
if tag.get('startTime'):
eventTime= \
datetime.strptime(tag['startTime'], \
"%Y-%m-%dT%H:%M:%SZ")
"%Y-%m-%dT%H:%M:%S%z")
if int(eventTime.strftime("%Y"))==year and \
int(eventTime.strftime("%m"))==monthNumber:
dayOfMonth=str(int(eventTime.strftime("%d")))