scores

football-data.org terminal interface
Log | Files | Refs | README | LICENSE

commit 2e86faee8413b57e5198319496dc07191021fa06
parent 28f4feeb85ad209945509a7ef793a5b38c78db63
Author: mtmn <miro@haravara.org>
Date:   Fri, 10 Jul 2026 19:06:15 +0200

fix: use local timezone

Diffstat:
Msrc/display.rs | 15++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/display.rs b/src/display.rs @@ -1,5 +1,5 @@ use crate::models::{Match, StandingsResponse}; -use chrono::Utc; +use chrono::Local; use prettytable::{Cell, Row, Table, format}; const STATUS_ICONS: &[(&str, &str)] = &[("FINISHED", "✓"), ("SCHEDULED", "⏰"), ("IN_PLAY", "▶")]; @@ -11,11 +11,12 @@ pub fn filter_matches( team_filter: Option<&str>, show_all: bool, ) -> Vec<Match> { - let today_start = Utc::now() + let today_start = Local::now() .date_naive() .and_hms_opt(0, 0, 0) .unwrap() - .and_utc(); + .and_local_timezone(Local) + .unwrap(); matches .into_iter() @@ -90,7 +91,11 @@ pub fn display_table(matches: &[Match], show_competition: bool) { let date = m.utc_date.map_or_else( || "TBD".to_string(), - |dt| dt.format("%b %d, %Y %H:%M UTC").to_string(), + |dt| { + dt.with_timezone(&Local) + .format("%b %d, %Y %H:%M %:z") + .to_string() + }, ); let score = match (m.score.full_time.home, m.score.full_time.away) { @@ -181,7 +186,7 @@ pub fn display_standings(standings_response: StandingsResponse) { mod tests { use super::*; use crate::models::{Score, ScoreDetail, Team}; - use chrono::TimeZone; + use chrono::{TimeZone, Utc}; fn create_match(date: Option<chrono::DateTime<Utc>>, home: &str, away: &str) -> Match { Match {