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,