use chrono::{Datelike, DateTime, Local};

pub fn human_datetime(datetime: &DateTime<Local>) -> String {
    format!(
        "{day} {month} {year}",
        day = datetime.day(),
        month = human_month(datetime.month()),
        year = datetime.year()
    )
}

fn human_month<'a>(month: u32) -> &'a str {
    match month {
        1 => "Jan.",
        2 => "Feb.",
        3 => "Mar.",
        4 => "Avr.",
        5 => "Mai",
        6 => "Juin",
        7 => "Juillet",
        8 => "Août",
        9 => "Sept.",
        10 => "Oct.",
        11 => "Nov.",
        12 => "Dec.",
        _ => "Invalide"
    }
}