commit - 28f4feeb85ad209945509a7ef793a5b38c78db63
commit + 2e86faee8413b57e5198319496dc07191021fa06
blob - 5108e2b76716a655a1dddcb1c3933c17f2419f42
blob + 45c5c6d65d2026d16b5c7751132ede23400bad67
--- src/display.rs
+++ src/display.rs
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", "▶")];
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()
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) {
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 {