-
Notifications
You must be signed in to change notification settings - Fork 581
Open
Description
I find myself in the situation where I need to parse ISO weeks quite frequently. Especially when it comes to "manufacturing dates", which are very often given as iso weeks like 2024-W30
or even 202430
.
My current workaround is to go through a NaiveDate
first:
fn parse_iso_week(s: &str) -> ParseResult<IsoWeek> {
let date = NaiveDate::parse_from_str(&format!("{s} 1"), "%G-W%V %u").unwrap();
Ok(date.iso_week())
}
// parse_iso_week("2024-W30")
Do you think it would make sense to add this feature natively to chrono? Unfortunately the Parsed::to_naive_date
implementation is quite daunting, otherwise I would've already created a proof of concept PR.
Metadata
Metadata
Assignees
Labels
No labels