1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-12 11:02:21 -05:00

Fixes date timezone issues

This commit is contained in:
echel0n 2014-05-15 21:15:49 -07:00
parent a39c881cb3
commit b0f1f2c91e
2 changed files with 5 additions and 3 deletions

View File

@ -271,7 +271,7 @@
#end if
$epResult["name"]
</td>
<td align="center" class="nowrap">#if int($epResult["airdate"]) == 1 then "never" else $sbdatetime.sbdatetime.sbfdate($network_timezones.parse_date_time($epResult["airdate"],$show.airs,$show.network))#</td>
<td align="center" class="nowrap">#if int($epResult["airdate"]) == 1 then "never" else $sbdatetime.sbdatetime.sbfdate($network_timezones.parse_date_time($epResult["airdate"],$show.airs,$show.network,True))#</td>
<td class="filename"><small>
#if $epLoc and $show._location and $epLoc.lower().startswith($show._location.lower()):
#set $epLoc = os.path.basename($epLoc[len($show._location)+1:])

View File

@ -225,7 +225,7 @@ def get_network_timezone(network, network_dict):
# parse date and time string into local time
def parse_date_time(d, t, network):
def parse_date_time(d, t, network, local=False):
if network_dict is None:
load_network_dict()
mo = time_regex.search(t)
@ -261,7 +261,9 @@ def parse_date_time(d, t, network):
foreign_timezone = get_network_timezone(network, network_dict)
foreign_naive = datetime.datetime(te.year, te.month, te.day, hr, m, tzinfo=foreign_timezone)
try:
if local:
return foreign_naive.replace(tzinfo=sb_timezone).astimezone(sb_timezone)
return foreign_naive.astimezone(sb_timezone)
except (ValueError):
return foreign_naive