1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
use chrono::{Local, NaiveDate, NaiveDateTime};

pub trait DateTimeNow {
    fn now() -> NaiveDateTime;
}

impl DateTimeNow for NaiveDateTime {
    fn now() -> NaiveDateTime {
        let dt = Local::now();
        dt.naive_local()
    }
}