Fix RFM date range consistency
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m5s

This commit is contained in:
Cauê Faleiros
2026-06-15 10:48:00 -03:00
parent ac692b8e10
commit fc7a50fddf
8 changed files with 262 additions and 84 deletions

View File

@@ -3,6 +3,7 @@ import { Outlet, Link, useLocation } from 'react-router-dom';
import { LayoutDashboard, Users, BarChart3, ChevronLeft, ChevronRight, Package, Loader2, LogOut, Megaphone, Grid3X3 } from 'lucide-react';
import type { DateRange, OrderData, StockData } from '../types';
import { fetchData, fetchStock, logout } from '../dataService';
import { rangeForLastDays } from '../dateRanges';
const Layout = () => {
const location = useLocation();
@@ -20,10 +21,7 @@ const Layout = () => {
return { start: new Date(parsed.start), end: new Date(parsed.end) };
} catch (e) { console.error(e); }
}
const end = new Date();
const start = new Date();
start.setMonth(start.getMonth() - 1);
return { start, end };
return rangeForLastDays(30);
});
const [ordersData, setOrdersData] = useState<OrderData[]>([]);