Correctly calculate the number of days pending for orders

Update the dashboard to use `plannedDate` instead of `createdAt` for calculating days pending in order cards.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: f2b9c241-9fdd-4abd-9041-720afc8b27d6
Replit-Commit-Checkpoint-Type: full_checkpoint
This commit is contained in:
michaelschal committed 2025-09-02 08:52:24 +00:00
1 parent 3b54c6fbdb
commit 814132fd17
2 files changed
+2 -2

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

+2 -2
View File
@@ -447,8 +447,8 @@ export default function Dashboard() {
</CardHeader>
<CardContent className="space-y-3 p-6 max-h-96 overflow-y-auto">
{pendingOrders.length > 0 ? pendingOrders.map((order: any) => {
// Calculer le nombre de jours en attente
const orderDate = safeDate(order.createdAt);
// Calculer le nombre de jours en attente depuis la date prévue
const orderDate = safeDate(order.plannedDate);
const daysPending = orderDate ? Math.floor((new Date().getTime() - orderDate.getTime()) / (1000 * 60 * 60 * 24)) : 0;
const isOverdue = daysPending > 10;