diff --git a/Cargo.lock b/Cargo.lock index f124313..e072aca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -297,7 +297,7 @@ dependencies = [ [[package]] name = "etradeTaxReturnHelper" -version = "0.2.5" +version = "0.2.6" dependencies = [ "calamine", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 5e1c168..0d300cd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "etradeTaxReturnHelper" -version = "0.2.5" +version = "0.2.6" edition = "2021" description = "Parses etrade financial documents for transaction details (income, tax paid, cost basis) and compute total income and total tax paid according to chosen tax residency (currency)" license = "BSD-3-Clause" diff --git a/src/transactions.rs b/src/transactions.rs index e19aca8..c52f3e2 100644 --- a/src/transactions.rs +++ b/src/transactions.rs @@ -57,7 +57,7 @@ pub fn reconstruct_sold_transactions( // to diffreences in roudings in PDF and XLSX documents let (acquisition_date, _, cost_basis, _, _) = gains_and_losses.iter().find(|(_, tr_date, _,_, inc)|{ - let tr_date = chrono::NaiveDate::parse_from_str(&tr_date, "%m/%d/%y").unwrap().format("%m/%d/%y").to_string(); + let tr_date = chrono::NaiveDate::parse_from_str(&tr_date, "%m/%d/%Y").unwrap().format("%m/%d/%y").to_string(); let incs = (inc*100.0).round(); let incomes = (income*100.0).round(); log::info!("Key tr_date: {}, inc: {}, trade_date: {}, income: {}",tr_date,incs,*trade_date,incomes); @@ -304,15 +304,15 @@ mod tests { let parsed_gains_and_losses: Vec<(String, String, f32, f32, f32)> = vec![ ( - "01/01/19".to_string(), - "06/01/21".to_string(), + "01/01/2019".to_string(), + "06/01/2021".to_string(), 10.0, 10.0, 24.8, ), ( - "01/01/21".to_string(), - "03/01/21".to_string(), + "01/01/2021".to_string(), + "03/01/2021".to_string(), 20.0, 20.0, 19.8,