refactor: use chrono for month names
All checks were successful
Continuous Integration / Lint, Check & Test (push) Successful in 1m20s
Continuous Integration / Build Package (push) Successful in 1m40s

This commit is contained in:
Konstantin Fickel 2026-04-02 18:18:48 +02:00
parent d11a35c157
commit a8c41ec833
Signed by: kfickel
GPG key ID: A793722F9933C1A5

View file

@ -154,22 +154,10 @@ impl MonthReport {
}
/// Get the month name.
pub fn month_name(&self) -> &'static str {
match self.month {
1 => "January",
2 => "February",
3 => "March",
4 => "April",
5 => "May",
6 => "June",
7 => "July",
8 => "August",
9 => "September",
10 => "October",
11 => "November",
12 => "December",
_ => "Unknown",
}
pub fn month_name(&self) -> String {
NaiveDate::from_ymd_opt(self.year, self.month, 1)
.map(|d| d.format("%B").to_string())
.unwrap_or_else(|| "Unknown".to_string())
}
}