mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 10:16:11 +00:00
Catch error for dateutil
In the event the server has some weird date that can't be converted
This commit is contained in:
parent
67377922a4
commit
1942f05559
1 changed files with 9 additions and 4 deletions
|
@ -450,11 +450,16 @@ def convert_to_local(date):
|
|||
|
||||
''' Convert the local datetime to local.
|
||||
'''
|
||||
try:
|
||||
date = convert_str_to_date(date) if type(date) in (unicode, str) else date
|
||||
date = date.replace(tzinfo=tz.tzutc())
|
||||
date = date.astimezone(tz.tzlocal())
|
||||
|
||||
return date.strftime('%Y-%m-%dT%H:%M:%S')
|
||||
except Exception as error:
|
||||
LOG.error(error)
|
||||
|
||||
return str(date)
|
||||
|
||||
def convert_str_to_date(date):
|
||||
|
||||
|
|
Loading…
Reference in a new issue