How to get the last date of a month with chrono::NaiveDate. I try to search the manual but can't found anything useful.
use chrono::{NaiveDate, Datelike};
// from January to December m = 1 - 12
for m in 1..=12 {
let end = ..... ??
let start_date = NaiveDate::from_ymd(year, m, 1); /// each month starts with 1
let end_date = NaiveDate::from_ymd(year, m, end); /// here's the problem
container.push((start_date, end_date));
}
the closest would be to use Datelike::day https://docs.rs/chrono/0.4.6/chrono/trait.Datelike.html#tymethod.day0
and subtract 1 day from it, but I don't know how to do that with NaiveDate. I'm open to any suggestion. Thanks in advance.