Skip to content

Commit

Permalink
Exact datetime format
Browse files Browse the repository at this point in the history
  • Loading branch information
vov4uk committed Jun 27, 2024
1 parent fc57de5 commit 2df7c5d
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/Financier.Desktop/Helpers/MapperHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Financier.Desktop.Wizards;
using Financier.Desktop.Helpers.Model;
using static Financier.Desktop.Helpers.BankPdfHelperBase;
using System.Globalization;

namespace Financier.Desktop.Helpers
{
Expand Down Expand Up @@ -66,6 +67,20 @@ public static BankTransaction ToBankTransaction(Abank_Row item)
var operationAmount = GetDouble(item.OperationAmount);
var cardCurrencyAmount = GetDouble(item.CardCurrencyAmount);

DateTime dt;
if (!DateTime.TryParseExact(item.Date,
"dd.MM.yyyy HH:mm:ss",
CultureInfo.InvariantCulture,
DateTimeStyles.None,
out dt))
{
DateTime.TryParseExact(item.Date,
"dd.MM.yyyy HH:mm",
CultureInfo.InvariantCulture,
DateTimeStyles.None,
out dt);
};

return new BankTransaction
{
Balance = GetDouble(item.Balance),
Expand All @@ -77,7 +92,7 @@ public static BankTransaction ToBankTransaction(Abank_Row item)
CardCurrencyAmount = cardCurrencyAmount,
MCC = item.MCC,
Description = item.Details,
Date = Convert.ToDateTime(item.Date)
Date = dt
};
}
}
Expand Down

0 comments on commit 2df7c5d

Please sign in to comment.