leafslug_time 0.4.1

Useful set of time-oriented functions, for my leafslug collection.
Documentation
//! Useful tools for semi-natural langauge processing of time, to be used by my other leafslug projects.
//!
//! ## WARNING:
//!
//! This crate is not intended to be used by others.
pub mod parser;
pub use parser::*;
use time::{Date, Duration, UtcOffset};

pub const DATE_DISPLAY_FORMATTING: &str = "%Y-%m-%d %H:%M:%S";

#[must_use]
pub fn today(offset: UtcOffset) -> Date {
    time::OffsetDateTime::now_utc().to_offset(offset).date()
}

#[must_use]
pub fn tomorrow(offset: UtcOffset) -> Date {
    day_from_today(offset, 1)
}

#[must_use]
pub fn day_from_today(offset: UtcOffset, n: i64) -> Date {
    today(offset).saturating_add(Duration::days(n))
}