Changed default datepicker date to today instead of epoch start

This commit is contained in:
Franklin 2023-05-10 11:54:06 -04:00
parent 1bb67835f3
commit cae68235cf

View File

@ -1,6 +1,6 @@
use std::str::FromStr;
use chrono::NaiveDate;
use chrono::{NaiveDate, Utc};
use yew::prelude::*;
use crate::components::textfield::get_value_from_input_event;
@ -28,7 +28,7 @@ pub fn datepicker(props: &DatePickerProps) -> Html {
<div class={if props.required {"textfield-label-required"} else {"textfield-label"}}>{props.label.clone()}</div>
<input class={"datepicker"} type="date" oninput={cb} value={match (*date_handle).clone() {
Some(date) => date.to_string(),
None => NaiveDate::default().to_string()
None => Utc::now().date_naive().to_string()
}}/>
</div>
}