Sync the latest updates
This commit is contained in:
parent
f3831f6ed4
commit
f758d4c54c
1 changed files with 9 additions and 2 deletions
11
hyperdia.py
11
hyperdia.py
|
@ -1,5 +1,9 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
# SPDX-FileCopyrightText: 2021 Luca Beltrame <lbeltrame@kde.org>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
@ -196,13 +200,16 @@ def parse_station_time(element, year, month, day, start=True):
|
||||||
# Otherwise we get the only item
|
# Otherwise we get the only item
|
||||||
|
|
||||||
current_time = times[-1] if start else times[0]
|
current_time = times[-1] if start else times[0]
|
||||||
|
tz = pytz.timezone("Japan")
|
||||||
|
|
||||||
hour, minutes = current_time.split(":")
|
hour, minutes = current_time.split(":")
|
||||||
|
|
||||||
station_time = datetime(year, int(month), int(day),
|
station_time = datetime(year, int(month), int(day),
|
||||||
int(hour),
|
int(hour),
|
||||||
int(minutes),
|
int(minutes))
|
||||||
tzinfo=pytz.timezone("Japan"))
|
# Regular datetime with tzinfo screws things up, create a native time
|
||||||
|
# Then localize it with pytz (no DST, there's no such thing in Japan)
|
||||||
|
station_time = tz.localize(station_time, is_dst=False)
|
||||||
|
|
||||||
return station_time
|
return station_time
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue