aoc-toolkit 0.1.0-alpha.2

A toolkit for solving Advent of Code problems
Documentation
use chrono::{Datelike, FixedOffset, Utc};

#[derive(Debug, Clone, Copy)]
pub(crate) struct CalendarDate {
    pub year: usize,
    pub month: u32,
    pub day: usize,
}

impl CalendarDate {
    pub(crate) fn today() -> Self {
        let offset = FixedOffset::west_opt(5 * 3600).expect("UTC-5 is a valid offset");

        let now = Utc::now().with_timezone(&offset);

        Self {
            year: usize::try_from(now.year()).expect("Expected a positive calendar year"),
            month: now.month(),
            day: now.day() as usize,
        }
    }
}