diff --git a/src/timesheet/report.rs b/src/timesheet/report.rs index f96370d..8c405d8 100644 --- a/src/timesheet/report.rs +++ b/src/timesheet/report.rs @@ -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()) } }