You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to implement a date-range filter variant for dateOfBirth. I am using date from a rest api fetched using @tanstack/react-query library.
If I setup the accessorFn like below, filter functionality works fine, but in the table cell where the date of birth should be displayed no date is shown accessorFn: (originalRow: { applicant: { dateOfBirth: string | number | Date }; }) => { const date = new Date(originalRow?.user?.dateOfBirth); !isNaN(date.getTime()) ? date.toISOString() : ""; },
Otherwise, is I setup accessorFn the correctly with a return statement accessorFn: (originalRow: { applicant: { dateOfBirth: string | number | Date }; }) => { const date = new Date(originalRow?.user?.dateOfBirth); return !isNaN(date.getTime()) ? date.toISOString() : ""; },
table cell displays the correct date of birth but the date-range filter does not work anymore. The table displays absolutely no rows, but the date is passed correctly to the table (for example pagination calculates correctly the number of pages when the filter values are changed, but the table shows 0 rows).
I also tried filterVariant: "custom" but with the very same behaviour: works with the accessorFn setup like in the first example, does not works when accessorFn has a return statement.
Minimal, Reproducible Example - (Optional, but Recommended)
n/a
Screenshots or Videos (Optional)
No response
Do you intend to try to help solve this bug with your own PR?
None
Terms
I understand that if my bug cannot be reliably reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
The text was updated successfully, but these errors were encountered:
mantine-react-table version
2.0.0-beta.6
react & react-dom versions
18.2.0
Describe the bug and the steps to reproduce it
I tried to implement a date-range filter variant for dateOfBirth. I am using date from a rest api fetched using @tanstack/react-query library.
If I setup the accessorFn like below, filter functionality works fine, but in the table cell where the date of birth should be displayed no date is shown
accessorFn: (originalRow: { applicant: { dateOfBirth: string | number | Date }; }) => { const date = new Date(originalRow?.user?.dateOfBirth); !isNaN(date.getTime()) ? date.toISOString() : ""; },
Otherwise, is I setup accessorFn the correctly with a return statement
accessorFn: (originalRow: { applicant: { dateOfBirth: string | number | Date }; }) => { const date = new Date(originalRow?.user?.dateOfBirth); return !isNaN(date.getTime()) ? date.toISOString() : ""; },
table cell displays the correct date of birth but the date-range filter does not work anymore. The table displays absolutely no rows, but the date is passed correctly to the table (for example pagination calculates correctly the number of pages when the filter values are changed, but the table shows 0 rows).
I also tried filterVariant: "custom" but with the very same behaviour: works with the accessorFn setup like in the first example, does not works when accessorFn has a return statement.
Minimal, Reproducible Example - (Optional, but Recommended)
n/a
Screenshots or Videos (Optional)
No response
Do you intend to try to help solve this bug with your own PR?
None
Terms
The text was updated successfully, but these errors were encountered: