use local timezone where appropriate and fix tests between 0 and 1 o'clock
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
use std::ops::DerefMut;
|
||||
|
||||
use chrono::{Datelike, NaiveDateTime, Utc};
|
||||
use chrono::{Datelike, Local, NaiveDateTime};
|
||||
use rocket::FromForm;
|
||||
use serde::Serialize;
|
||||
use sqlx::{FromRow, Sqlite, SqlitePool, Transaction};
|
||||
@ -259,7 +259,7 @@ ORDER BY departure DESC
|
||||
}
|
||||
|
||||
pub async fn completed(db: &SqlitePool) -> Vec<LogbookWithBoatAndRowers> {
|
||||
let year = chrono::Utc::now().year();
|
||||
let year = chrono::Local::now().year();
|
||||
let logs = sqlx::query_as(
|
||||
&format!("
|
||||
SELECT id, boat_id, shipmaster, steering_person, shipmaster_only_steering, departure, arrival, destination, distance_in_km, comments, logtype
|
||||
@ -504,7 +504,7 @@ ORDER BY departure DESC
|
||||
if arr.timestamp() <= dep.timestamp() {
|
||||
return Err(LogbookUpdateError::ArrivalNotAfterDeparture);
|
||||
}
|
||||
let today = Utc::now().date_naive();
|
||||
let today = Local::now().date_naive();
|
||||
let day_diff = today - arr.date();
|
||||
let day_diff = day_diff.num_days();
|
||||
if day_diff >= 7 && !user.has_role_tx(db, "admin").await {
|
||||
|
Reference in New Issue
Block a user