Fix Unspecified DateTime kind for PostgreSQL timestamptz columns
DateOnly.ToDateTime() produces Kind=Unspecified which Npgsql rejects for timestamptz. Specify UTC kind on Plaid transaction dates and add a safety net in BankSyncService for all parsed dates. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -442,7 +442,7 @@ public class BankSyncService : IBankSyncService
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
AccountId = linkedAccount.AccountId!.Value,
|
||||
Date = parsed.Date,
|
||||
Date = DateTime.SpecifyKind(parsed.Date, DateTimeKind.Utc),
|
||||
Amount = parsed.Amount,
|
||||
PayeeId = matchedPayee?.Id,
|
||||
PayeeName = parsed.PayeeName,
|
||||
|
||||
@@ -168,7 +168,7 @@ public class PlaidSyncProvider : IAccountSyncProvider
|
||||
Success = true,
|
||||
Transactions = allTransactions.Select(t => new ParsedTransaction
|
||||
{
|
||||
Date = t.Date?.ToDateTime(TimeOnly.MinValue) ?? DateTime.UtcNow,
|
||||
Date = DateTime.SpecifyKind(t.Date?.ToDateTime(TimeOnly.MinValue) ?? DateTime.UtcNow, DateTimeKind.Utc),
|
||||
Amount = (decimal)(t.Amount ?? 0) * -1, // Plaid uses positive for debits
|
||||
PayeeName = t.MerchantName ?? t.Name,
|
||||
Memo = t.Name,
|
||||
|
||||
Reference in New Issue
Block a user