Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update utils.py #756

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion jellyfin_kodi/helper/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import sys
import re
import unicodedata
import datetime
import time
from uuid import uuid4
from distutils.version import LooseVersion

Expand Down Expand Up @@ -481,7 +483,11 @@ def convert_to_local(date):
try:
date = parser.parse(date) if isinstance(date, string_types) else date
date = date.replace(tzinfo=tz.tzutc())
date = date.astimezone(tz.tzlocal())
#date = date.astimezone(tz.tzlocal())
# thanks: jfs via https://stackoverflow.com/a/3168394
local_utc_offset = -time.timezone
# thanks: Ignacio Vazquez-Abrams via https://stackoverflow.com/a/22082178
date = date + datetime.timedelta(seconds=local_utc_offset)
# Bad metadata defaults to date 1-1-1. Catch it and don't throw errors
if date.year == 1:
return str(date)
Expand Down