From ae821d015e8dd4c92cbb51108cc184e847699263 Mon Sep 17 00:00:00 2001
From: "gpt-engineer-app[bot]"
<159125892+gpt-engineer-app[bot]@users.noreply.github.com>
Date: Fri, 24 Apr 2026 13:58:42 +0000
Subject: [PATCH 7/9] Changes
Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
---
src/routes/collections.$collectionId.tsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/routes/collections.$collectionId.tsx b/src/routes/collections.$collectionId.tsx
index 7e62441..5d0fcc4 100644
--- a/src/routes/collections.$collectionId.tsx
+++ b/src/routes/collections.$collectionId.tsx
@@ -38,7 +38,7 @@ import { CaseInvoicesTab } from "@/components/cases/invoices-tab";
import { CaseLitigationTab } from "@/components/cases/litigation-tab";
import { CaseCustomFieldsTab } from "@/components/cases/custom-fields-tab";
-import { formatDate } from "@/lib/format";
+import { formatDate, parseDateOnly } from "@/lib/format";
import {
ArrowLeft,
ArrowRight,
@@ -526,7 +526,7 @@ function CollectionDetailRoute() {
const overdue =
!t.done &&
t.due_date &&
- new Date(t.due_date) < new Date(new Date().toDateString());
+ parseDateOnly(t.due_date)! < new Date(new Date().toDateString());
return (
Date: Fri, 24 Apr 2026 13:58:59 +0000
Subject: [PATCH 8/9] Changes
Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
---
src/components/collections/payment-plans-panel.tsx | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/components/collections/payment-plans-panel.tsx b/src/components/collections/payment-plans-panel.tsx
index ec2ff75..cef9093 100644
--- a/src/components/collections/payment-plans-panel.tsx
+++ b/src/components/collections/payment-plans-panel.tsx
@@ -25,7 +25,7 @@ import {
} from "@/components/ui/select";
import { CalendarClock, Loader2, Plus, Trash2 } from "lucide-react";
import { toast } from "sonner";
-import { formatCurrency, formatDate } from "@/lib/format";
+import { formatCurrency, formatDate, parseDateOnly } from "@/lib/format";
type Frequency = "weekly" | "biweekly" | "monthly";
type PlanStatus = "active" | "completed" | "defaulted" | "cancelled";
@@ -200,7 +200,8 @@ export function PaymentPlansPanel({ collectionId }: { collectionId: string }) {
{ins.length > 0 && (
{ins.map((i) => {
- const overdue = !i.paid && new Date(i.due_date) < new Date(new Date().toDateString());
+ const overdue =
+ !i.paid && parseDateOnly(i.due_date)! < new Date(new Date().toDateString());
return (
Date: Fri, 24 Apr 2026 13:59:15 +0000
Subject: [PATCH 9/9] Changes
Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
---
src/lib/workflow-chain.ts | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/src/lib/workflow-chain.ts b/src/lib/workflow-chain.ts
index 660dedd..ea015b8 100644
--- a/src/lib/workflow-chain.ts
+++ b/src/lib/workflow-chain.ts
@@ -1,5 +1,17 @@
import { supabase } from "@/integrations/supabase/client";
-import { addDays, format } from "date-fns";
+import { addDays } from "date-fns";
+
+/**
+ * Format a Date as "YYYY-MM-DD" using its UTC components. We do this so that
+ * a `completed_at` UTC timestamp like 2026-04-24T02:00:00Z (which is still
+ * Apr 23 in US local time) doesn't shift the computed due_date back a day.
+ */
+function toUTCDateString(d: Date): string {
+ const y = d.getUTCFullYear();
+ const m = String(d.getUTCMonth() + 1).padStart(2, "0");
+ const day = String(d.getUTCDate()).padStart(2, "0");
+ return `${y}-${m}-${day}`;
+}
/**
* After a task is marked complete, spawn the next task from its workflow
@@ -48,7 +60,7 @@ export async function spawnNextWorkflowTask(taskId: string): Promise