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

This commit is contained in:
Cauê Faleiros
2026-05-06 09:58:10 -03:00
parent 4ffe97ede8
commit 940b2113cc
6 changed files with 36 additions and 11 deletions

View File

@@ -4,6 +4,7 @@ import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContaine
import { DollarSign, ShoppingCart, TrendingUp } from 'lucide-react';
import DateRangePicker from '../components/DateRangePicker';
import type { OrderData, DateRange } from '../types';
import { parseOrderDate } from '../dataService';
const COLORS = [
'#10b981', '#3b82f6', '#8b5cf6', '#f43f5e', '#f97316',
@@ -16,8 +17,7 @@ const Dashboard = () => {
const filteredData = useMemo(() => {
const orders = ordersData;
return orders.filter(order => {
const [day, month, year] = order.Data_Pedido.split('-').map(Number);
const orderDate = new Date(year, month - 1, day);
const orderDate = parseOrderDate(order.Data_Pedido);
return orderDate >= dateRange.start && orderDate <= dateRange.end;
});
}, [dateRange, ordersData]);