Add timezone-aware station lookup and formatting

These changes ensure displayed times respect the station's timezone. Something I mistakenly overlooked when creating this.

Luckily, my screenshot with Ashland isn't affected by this change.
This commit is contained in:
Tony Bark 2026-08-24 01:00:47 -04:00
parent fc45303761
commit dd50d7cd4a
3 changed files with 42 additions and 19 deletions

View file

@ -26,12 +26,12 @@ struct AmtrakDateFormatting {
return isoFormatter.date(from: isoString)
}
func time(from isoString: String?) -> String? {
func time(from isoString: String?, timeZone: TimeZone? = nil) -> String? {
guard let isoString, !isoString.isEmpty, let date = isoFormatter.date(
from: isoString) else {
return nil
}
timeFormatter.timeZone = timeZone
return timeFormatter.string(from: date)
}