quentinsf / icsv2ledger

Interactive importing of CSV files to Ledger
196 stars 70 forks source link

Strip spaces from date string before parsing #130

Closed riclage closed 5 years ago

riclage commented 5 years ago

Problem Some csv files can have an extra space after or before the date. For example:

10 Dec 2018 ; To John Doe  ; 20.75 ;  ;  ;  ; 48.35; transfers; groceries

Setting the csv_date_format to %d %b %Y won't work because the date has this extra space in the end: "10 Dec 2018 ".

Solution We use .strip() on the date string before parsing it.