Since it takes a NaiveDate, don't lie

This commit is contained in:
Joshua Coles 2024-07-27 21:00:58 +01:00
parent cd3d14c7de
commit 29b2dbd69b

View File

@ -75,16 +75,16 @@ impl Worker {
pub async fn fetch_within( pub async fn fetch_within(
&mut self, &mut self,
start: DateTime<Utc>, start: NaiveDate,
end: DateTime<Utc>, end: NaiveDate,
) -> Result<(), AppError> { ) -> Result<(), AppError> {
let results = self let results = self
.toggl_api .toggl_api
.search( .search(
self.toggl_api.workspace_id, self.toggl_api.workspace_id,
TogglReportFilters { TogglReportFilters {
start_date: Some(start.date_naive()), start_date: Some(start),
end_date: Some(end.date_naive()), end_date: Some(end),
..Default::default() ..Default::default()
}, },
) )
@ -388,16 +388,10 @@ async fn main() {
worker.update_tags().await.unwrap(); worker.update_tags().await.unwrap();
let start = NaiveDate::from_ymd_opt(2024, 2, 1) let start = NaiveDate::from_ymd_opt(2024, 2, 1)
.expect("Invalid date") .expect("Invalid date");
.and_hms_opt(0, 0, 0)
.expect("Invalid time")
.and_utc();
let end = NaiveDate::from_ymd_opt(2024, 2, 2) let end = NaiveDate::from_ymd_opt(2024, 2, 2)
.expect("Invalid date") .expect("Invalid date");
.and_hms_opt(0, 0, 0)
.expect("Invalid time")
.and_utc();
worker worker
.fetch_within(start, end) .fetch_within(start, end)