fix: use robust date parsing utility to handle varying n8n date formats
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 2m26s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 2m26s
This commit is contained in:
@@ -2,6 +2,7 @@ import { useMemo, useState } from 'react';
|
||||
import { Link, useOutletContext } from 'react-router-dom';
|
||||
import { Search, ChevronRight, Filter } from 'lucide-react';
|
||||
import type { OrderData } from '../types';
|
||||
import { parseOrderDate } from '../dataService';
|
||||
|
||||
type SortOption = 'recent' | 'spent_desc' | 'spent_asc' | 'items_desc' | 'items_asc';
|
||||
|
||||
@@ -26,8 +27,7 @@ const Clients = () => {
|
||||
clientMap[clientName].totalItems += order.Quantidade;
|
||||
clientMap[clientName].uniqueOrders.add(`${order.Data_Pedido}_${order.Valor_Pedido}`);
|
||||
|
||||
const [day, month, year] = order.Data_Pedido.split('-').map(Number);
|
||||
const orderTime = new Date(year, month - 1, day).getTime();
|
||||
const orderTime = parseOrderDate(order.Data_Pedido).getTime();
|
||||
|
||||
if (orderTime > clientMap[clientName].lastPurchase) {
|
||||
clientMap[clientName].lastPurchase = orderTime;
|
||||
|
||||
Reference in New Issue
Block a user