Create new records with the date of the view model
This commit is contained in:
parent
38b1e62b60
commit
6394d89331
|
@ -176,9 +176,20 @@ impl DayDetailViewModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_time_distance(&self, activity: TimeDistanceActivity) -> Record<TimeDistance> {
|
pub fn new_time_distance(&self, activity: TimeDistanceActivity) -> Record<TimeDistance> {
|
||||||
|
let now = chrono::Local::now();
|
||||||
|
let base_time = now.time();
|
||||||
|
let tz = now.timezone();
|
||||||
|
let datetime = self
|
||||||
|
.date
|
||||||
|
.clone()
|
||||||
|
.and_time(base_time)
|
||||||
|
.and_local_timezone(tz)
|
||||||
|
.unwrap()
|
||||||
|
.into();
|
||||||
|
|
||||||
let id = RecordId::default();
|
let id = RecordId::default();
|
||||||
let workout = TimeDistance {
|
let workout = TimeDistance {
|
||||||
datetime: chrono::Local::now().into(),
|
datetime,
|
||||||
activity,
|
activity,
|
||||||
distance: None,
|
distance: None,
|
||||||
duration: None,
|
duration: None,
|
||||||
|
|
Loading…
Reference in New Issue