From df110912b81f7466bd0f594e10ff544508578c5a Mon Sep 17 00:00:00 2001 From: riefive Date: Sun, 9 Nov 2025 19:08:58 +0700 Subject: [PATCH] feat(filter): update date range to use current date and one month ago for filtering --- app/components/pub/my-ui/nav-header/filter.vue | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/components/pub/my-ui/nav-header/filter.vue b/app/components/pub/my-ui/nav-header/filter.vue index 01b1ab55..ab28620b 100644 --- a/app/components/pub/my-ui/nav-header/filter.vue +++ b/app/components/pub/my-ui/nav-header/filter.vue @@ -34,9 +34,18 @@ const df = new DateFormatter('en-US', { dateStyle: 'medium', }) +// Get current date +const today = new Date() +const todayCalendar = new CalendarDate(today.getFullYear(), today.getMonth() + 1, today.getDate()) + +// Get date 1 month ago +const oneMonthAgo = new Date(today) +oneMonthAgo.setMonth(today.getMonth() - 1) +const oneMonthAgoCalendar = new CalendarDate(oneMonthAgo.getFullYear(), oneMonthAgo.getMonth() + 1, oneMonthAgo.getDate()) + const value = ref({ - start: new CalendarDate(2022, 1, 20), - end: new CalendarDate(2022, 1, 20).add({ days: 20 }), + start: oneMonthAgoCalendar, + end: todayCalendar, }) as Ref function onFilterClick() {