Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
BrettMayson committed Mar 18, 2024
1 parent 3b8324d commit bb38180
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bin/calendar/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::net::SocketAddr;

use axum::{response::IntoResponse, routing::get, Router};
use chrono::{Duration, NaiveDateTime};
use chrono::{DateTime, Duration};
use icalendar::{Calendar, Component, Event, EventLike};
use synixe_events::missions::db::Response;
use synixe_proc::events_request_5;
Expand Down Expand Up @@ -38,7 +38,8 @@ async fn calendar() -> impl IntoResponse {
};
let mut calendar = Calendar::new();
for scheduled in schedule {
let start = NaiveDateTime::from_timestamp_opt(scheduled.start.unix_timestamp(), 0).unwrap();
let start =
DateTime::from_timestamp(scheduled.start.unix_timestamp(), 0).expect("valid timestamp");
let briefing = scheduled.briefing();
calendar.push(
Event::new()
Expand All @@ -51,12 +52,12 @@ async fn calendar() -> impl IntoResponse {
),
)
.starts(start)
.ends(start + chrono::Duration::minutes(150i64))
.ends(start + chrono::Duration::try_minutes(150i64).expect("duration valid"))
.done(),
);
}
calendar
.name("Synixe Contractors")
.ttl(&Duration::hours(1))
.ttl(&Duration::try_hours(1).expect("duration valid"))
.to_string()
}

0 comments on commit bb38180

Please sign in to comment.