From 3a7d17b3e557b3d4ff194ff4dfa54a59d54f677c Mon Sep 17 00:00:00 2001 From: chpark Date: Thu, 14 May 2026 00:42:02 +0900 Subject: [PATCH] =?UTF-8?q?feat(orders):=20=EC=B6=9C=EA=B3=A0=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20=EA=B8=B0=EB=B3=B8=20=EB=82=A0=EC=A7=9C=20=ED=95=9C?= =?UTF-8?q?=20=EB=8B=AC=20=EC=A0=84=20~=20=EC=98=A4=EB=8A=98=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/(main)/m/admin/orders/page.tsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/app/(main)/m/admin/orders/page.tsx b/src/app/(main)/m/admin/orders/page.tsx index ada1512..9163bd5 100644 --- a/src/app/(main)/m/admin/orders/page.tsx +++ b/src/app/(main)/m/admin/orders/page.tsx @@ -51,17 +51,22 @@ const todayStr = () => { const d = new Date(); return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`; }; +const oneMonthAgoStr = () => { + const d = new Date(); + d.setMonth(d.getMonth() - 1); + return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`; +}; export default function AdminOrdersPage() { const [orders, setOrders] = useState([]); // URL 쿼리 우선: dateFrom/dateTo 키가 있으면 그 값 사용 (빈 문자열도 명시적 = 전체 기간). - // 키가 없을 때만 기본값(오늘 ~ 오늘) + // 키가 없을 때 기본값 — 한 달 전 ~ 오늘 const initial = (() => { - if (typeof window === "undefined") return { status: "", dateFrom: todayStr(), dateTo: todayStr(), keyword: "" }; + if (typeof window === "undefined") return { status: "", dateFrom: oneMonthAgoStr(), dateTo: todayStr(), keyword: "" }; const q = new URLSearchParams(window.location.search); return { status: q.get("status") ?? "", - dateFrom: q.has("dateFrom") ? (q.get("dateFrom") ?? "") : todayStr(), + dateFrom: q.has("dateFrom") ? (q.get("dateFrom") ?? "") : oneMonthAgoStr(), dateTo: q.has("dateTo") ? (q.get("dateTo") ?? "") : todayStr(), keyword: q.get("keyword") ?? "", }; @@ -271,8 +276,8 @@ export default function AdminOrdersPage() { className="h-8 sm:h-9 px-3 rounded bg-slate-800 text-white text-xs sm:text-sm font-bold hover:bg-slate-900 disabled:opacity-50"> 조회 - {(dateFrom !== todayStr() || dateTo !== todayStr() || status || keyword) && ( -