From 5e7c664896f4c059590c3a07d73917b0171eab8e Mon Sep 17 00:00:00 2001 From: Catherine Renelle <32781029+catrenelle@users.noreply.github.com> Date: Sun, 8 Feb 2026 17:02:02 -0500 Subject: [PATCH] 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 --- src/Purrse.Api/Services/BankSyncService.cs | 2 +- src/Purrse.Plugins.BankSync/PlaidSyncProvider.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Purrse.Api/Services/BankSyncService.cs b/src/Purrse.Api/Services/BankSyncService.cs index 5ed106b..086f2f9 100644 --- a/src/Purrse.Api/Services/BankSyncService.cs +++ b/src/Purrse.Api/Services/BankSyncService.cs @@ -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, diff --git a/src/Purrse.Plugins.BankSync/PlaidSyncProvider.cs b/src/Purrse.Plugins.BankSync/PlaidSyncProvider.cs index ed7db71..c5fc046 100644 --- a/src/Purrse.Plugins.BankSync/PlaidSyncProvider.cs +++ b/src/Purrse.Plugins.BankSync/PlaidSyncProvider.cs @@ -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,