Fix start datetime of event

This commit is contained in:
Jan-Henrik 2024-01-09 23:34:11 +01:00
parent e555eb611e
commit 2bb5e84f7a

View file

@ -93,18 +93,15 @@ async fn convert(urls: &[&str], days: Option<&String>) -> Result<CustomCalendar>
vec!(start) vec!(start)
}; };
let mut found = false; let mut start = None;
for start_date in start_dates { for start_date in start_dates {
if start_date >= filter_start && start_date <= filter_end { if start_date >= filter_start && start_date <= filter_end {
found = true; start = Some(start_date);
break; break;
} }
} }
if !found { if let Some(start) = start {
continue;
}
let end = start + length; let end = start + length;
entries.push(CustomCalendarEntry { entries.push(CustomCalendarEntry {
@ -117,6 +114,7 @@ async fn convert(urls: &[&str], days: Option<&String>) -> Result<CustomCalendar>
isallday: start.time() == chrono::NaiveTime::from_hms_opt(0, 0, 0).unwrap() && end - start == chrono::Duration::days(1) // the event has a length of 24 hours and isallday: start.time() == chrono::NaiveTime::from_hms_opt(0, 0, 0).unwrap() && end - start == chrono::Duration::days(1) // the event has a length of 24 hours and
// starts at 00:00 // starts at 00:00
}); });
}
} }
} }