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.
This commit is contained in:
2026-03-23 13:53:36 +01:00
parent 2360dc6b53
commit fd2e776181

View File

@@ -43,7 +43,9 @@ fn get_field(record: &csv::StringRecord, index: usize) -> &str {
impl Transaction {
pub fn from_record(record: &csv::StringRecord) -> Option<Self> {
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,