fedimovies/src/utils/datetime.rs
2023-01-22 20:40:05 +00:00

12 lines
345 B
Rust

use chrono::{DateTime, Duration, NaiveDateTime, Utc};
pub fn get_min_datetime() -> DateTime<Utc> {
let native = NaiveDateTime::from_timestamp_opt(0, 0)
.expect("0 should be a valid argument");
DateTime::from_utc(native, Utc)
}
pub fn days_before_now(days: u32) -> DateTime<Utc> {
Utc::now() - Duration::days(days.into())
}