diff --git a/src/main.rs b/src/main.rs index e50f1af..878d3a4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,6 +2,7 @@ mod api; mod client; mod video; +use chrono::Local; use std::env::args; use std::error::Error; @@ -25,7 +26,12 @@ async fn main() -> Result<(), Box> { response_to_videos(response).expect("Failed to determine videos from the response."); for video in videos { - println!("{}: {} ({})", video.id, video.title, video.scheduled_at); + println!( + "{}: {} ({})", + video.id, + video.title, + video.scheduled_at.with_timezone(&Local) + ); } Ok(()) diff --git a/src/video.rs b/src/video.rs index 489742c..6c06289 100644 --- a/src/video.rs +++ b/src/video.rs @@ -1,7 +1,9 @@ +use chrono::{DateTime, Utc, TimeZone}; + pub struct Video { pub id: String, pub title: String, - pub scheduled_at: u64, + pub scheduled_at: DateTime, } impl Video { @@ -9,7 +11,7 @@ impl Video { Self { id: String::from(id), title: String::from(title), - scheduled_at, + scheduled_at: Utc.timestamp(scheduled_at as i64, 0), } } }