diff --git a/src/Financier.Desktop/Helpers/MapperHelper.cs b/src/Financier.Desktop/Helpers/MapperHelper.cs index aa1c6d9..04e882d 100644 --- a/src/Financier.Desktop/Helpers/MapperHelper.cs +++ b/src/Financier.Desktop/Helpers/MapperHelper.cs @@ -67,10 +67,7 @@ public static BankTransaction ToBankTransaction(Abank_Row item) var operationAmount = GetDouble(item.OperationAmount); var cardCurrencyAmount = GetDouble(item.CardCurrencyAmount); - DateTime dt; - var formats = new[] { "dd.MM.yyyy HH:mm:ss", "dd.MM.yyyy HH:mm", "dd.MM.yyyy h:mm:ss", "dd.MM.yyyy h:mm" }; - DateTime.TryParseExact(item.Date, formats, CultureInfo.InvariantCulture, DateTimeStyles.None, out dt); return new BankTransaction { @@ -83,8 +80,18 @@ public static BankTransaction ToBankTransaction(Abank_Row item) CardCurrencyAmount = cardCurrencyAmount, MCC = item.MCC, Description = item.Details, - Date = dt + Date = ParseDateTime(item.Date) }; } + + public static DateTime ParseDateTime(string dateTime) + { + DateTime dt; + + var formats = new[] { "dd.MM.yyyy H:mm:ss", "dd.MM.yyyy H:mm"}; + DateTime.TryParseExact(dateTime, formats, CultureInfo.InvariantCulture, DateTimeStyles.None, out dt); + + return dt; + } } } diff --git a/src/Financier.Desktop/Helpers/PireusHelper.cs b/src/Financier.Desktop/Helpers/PireusHelper.cs index 2521f5c..cc4aca3 100644 --- a/src/Financier.Desktop/Helpers/PireusHelper.cs +++ b/src/Financier.Desktop/Helpers/PireusHelper.cs @@ -50,7 +50,7 @@ protected override IEnumerable ParseTransactionsTable(IEnumerab OperationAmount = operationAmount, CardCurrencyAmount = cardCurrencyAmount, Description = item.Details.Replace("(", Space).Replace(")", Space), - Date = Convert.ToDateTime(item.Date) + Date = MapperHelper.ParseDateTime(item.Date) }; transactions.Add(bt);