From fd2e776181540ba69b8fc2d96772cb3bf80b906f Mon Sep 17 00:00:00 2001 From: Jakob Date: Mon, 23 Mar 2026 13:53:36 +0100 Subject: [PATCH] Support quoted tab-separated input with US date format Parse dates in M/D/YYYY H:MM:SS AM/PM format in addition to the ISO format used in the cleaned-up test data. --- src/invoice_generator.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/invoice_generator.rs b/src/invoice_generator.rs index 1b485cd..c782e9c 100644 --- a/src/invoice_generator.rs +++ b/src/invoice_generator.rs @@ -43,7 +43,9 @@ fn get_field(record: &csv::StringRecord, index: usize) -> &str { impl Transaction { pub fn from_record(record: &csv::StringRecord) -> Option { let date_str = get_field(record, 0); - let date = NaiveDateTime::parse_from_str(date_str, "%Y-%m-%d %H:%M:%S").ok()?; + let date = NaiveDateTime::parse_from_str(date_str, "%m/%d/%Y %I:%M:%S %p") + .or_else(|_| NaiveDateTime::parse_from_str(date_str, "%Y-%m-%d %H:%M:%S")) + .ok()?; Some(Transaction { date,