Skip to main content

ex_cli/util/
time.rs

1#[cfg(test)]
2pub mod tests {
3    use chrono::{DateTime, TimeZone, Utc};
4
5    pub fn create_date(
6        year: i32,
7        month: u32,
8        day: u32,
9    ) -> Option<DateTime<Utc>> {
10        Utc.with_ymd_and_hms(year, month, day, 0, 0, 0).latest()
11    }
12
13    pub fn create_time(
14        year: i32,
15        month: u32,
16        day: u32,
17        hour: u32,
18        minute: u32,
19        second: u32,
20    ) -> Option<DateTime<Utc>> {
21        Utc.with_ymd_and_hms(year, month, day, hour, minute, second).latest()
22    }
23}