Skip to content

Commit

Permalink
Fix PireusHelper
Browse files Browse the repository at this point in the history
  • Loading branch information
vov4uk committed Jun 27, 2024
1 parent 5627f41 commit b266228
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 11 additions & 4 deletions src/Financier.Desktop/Helpers/MapperHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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;
}
}
}
2 changes: 1 addition & 1 deletion src/Financier.Desktop/Helpers/PireusHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected override IEnumerable<BankTransaction> 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);
Expand Down

0 comments on commit b266228

Please sign in to comment.