This commit is contained in:
Raja Oktafrianto
2025-05-14 20:15:43 +07:00
parent 824c40c475
commit 02fed7c67f

View File

@ -5,11 +5,6 @@ import { useCallback, useEffect, useState } from 'react';
import { toast } from 'sonner';
import { DateRangePicker } from '@/pages/dashboards/home/blocks';
const getOneMonthsAgo = () => {
const today = new Date();
return new Date(today.getFullYear(), today.getMonth() - 1, today.getDate());
};
const formatDate = (date: Date): string => date.toISOString().split('T')[0];
const ListToolBar = () => {
@ -68,6 +63,15 @@ const ListToolBar = () => {
}, 0);
};
useEffect(() => {
try {
table.getColumn('created_at')?.setFilterValue(dateRange);
} catch (error) {
toast.error('Error applying date filter');
console.error('Date filter error:', error);
}
}, [dateRange]);
useEffect(() => {
const checkNewDay = () => {
const now = new Date();