@@ -34,6 +34,10 @@ const defaultRanges = {
3434 from : dayjs ( ) . subtract ( 2 , "day" ) . startOf ( "day" ) . toDate ( ) ,
3535 to : dayjs ( ) . endOf ( "day" ) . toDate ( ) ,
3636 } ,
37+ last7Days : {
38+ from : dayjs ( ) . subtract ( 7 , "day" ) . startOf ( "day" ) . toDate ( ) ,
39+ to : dayjs ( ) . endOf ( "day" ) . toDate ( ) ,
40+ } ,
3741 lastMonth : {
3842 from : dayjs ( ) . subtract ( 1 , "month" ) . startOf ( "day" ) . toDate ( ) ,
3943 to : dayjs ( ) . endOf ( "day" ) . toDate ( ) ,
@@ -64,6 +68,7 @@ export function DatePickerWithRange({
6468 yesterday : isEqualDateRange ( value , defaultRanges . yesterday ) ,
6569 last14Days : isEqualDateRange ( value , defaultRanges . last14Days ) ,
6670 last2Days : isEqualDateRange ( value , defaultRanges . last2Days ) ,
71+ last7Days : isEqualDateRange ( value , defaultRanges . last7Days ) ,
6772 lastMonth : isEqualDateRange ( value , defaultRanges . lastMonth ) ,
6873 allTime : isEqualDateRange ( value , defaultRanges . allTime ) ,
6974 } ;
@@ -76,6 +81,7 @@ export function DatePickerWithRange({
7681 if ( isActive . lastMonth ) return "Last Month" ;
7782 if ( isActive . last14Days ) return "Last 14 Days" ;
7883 if ( isActive . last2Days ) return "Last 2 Days" ;
84+ if ( isActive . last7Days ) return "Last 7 Days" ;
7985 if ( isActive . yesterday ) return "Yesterday" ;
8086 if ( isActive . today ) return "Today" ;
8187
@@ -88,12 +94,11 @@ export function DatePickerWithRange({
8894 const [ calendarOpen , setCalendarOpen ] = useState ( false ) ;
8995
9096 const updateRangeAndClose = ( range : DateRange ) => {
91- setCalendarOpen ( false ) ;
9297 onChange ?.( range ) ;
9398 } ;
9499
95100 const debouncedOnChange = useMemo ( ( ) => {
96- return onChange ? debounce ( onChange , 300 ) : undefined ;
101+ return onChange ? debounce ( onChange , 500 ) : undefined ;
97102 } , [ onChange ] ) ;
98103
99104 const handleOnSelect = ( range ?: DateRange ) => {
0 commit comments