Time format

main
Bob Mottram 2021-03-18 22:16:01 +00:00
parent e65ad80d59
commit 014aacedc1
1 changed files with 13 additions and 1 deletions

View File

@ -461,6 +461,18 @@ def _desktopGetBoxPostObject(boxJson: {}, index: int) -> {}:
return None return None
def _formatPublished(published: str) -> str:
"""Formats the published time for display on timeline
"""
dateStr = published.split('T')[0]
monthStr = dateStr.split('-')[1]
dayStr = dateStr.split('-')[2]
timeStr = published.split('T')[1]
hourStr = timeStr.split(':')[0]
minStr = timeStr.split(':')[1]
return monthStr + '-' + dayStr + ' ' + hourStr + ':' + minStr + 'Z'
def _desktopShowBoxJson(boxName: str, boxJson: {}, def _desktopShowBoxJson(boxName: str, boxJson: {},
screenreader: str, systemLanguage: str, espeak, screenreader: str, systemLanguage: str, espeak,
pageNumber=1, pageNumber=1,
@ -502,7 +514,7 @@ def _desktopShowBoxJson(boxName: str, boxJson: {},
continue continue
if not postJsonObject['object'].get('content'): if not postJsonObject['object'].get('content'):
continue continue
published = postJsonObject['published'].replace('T', ' ') published = _formatPublished(postJsonObject['published'])
posStr = str(ctr) posStr = str(ctr)
while len(posStr) < 2: while len(posStr) < 2:
posStr += ' ' posStr += ' '