File tree 2 files changed +11
-0
lines changed
packages/ra-ui-materialui/src/list/filter
2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -152,10 +152,13 @@ describe('<FilterForm />', () => {
152
152
nestedToClear : { nestedValue : 'def' } ,
153
153
classicUpdated : 'ghi' ,
154
154
nestedUpdated : { nestedValue : 'jkl' } ,
155
+ published_at : new Date ( '2022-01-01T03:00:00.000Z' ) ,
156
+ clearedDateValue : null ,
155
157
} ;
156
158
const newFilterValues = {
157
159
classicUpdated : 'ghi2' ,
158
160
nestedUpdated : { nestedValue : 'jkl2' } ,
161
+ published_at : '2022-01-01T03:00:00.000Z' ,
159
162
} ;
160
163
161
164
expect (
@@ -165,6 +168,8 @@ describe('<FilterForm />', () => {
165
168
nestedToClear : { nestedValue : '' } ,
166
169
classicUpdated : 'ghi2' ,
167
170
nestedUpdated : { nestedValue : 'jkl2' } ,
171
+ published_at : '2022-01-01T03:00:00.000Z' ,
172
+ clearedDateValue : '' ,
168
173
} ) ;
169
174
} ) ;
170
175
} ) ;
Original file line number Diff line number Diff line change @@ -237,9 +237,15 @@ const getInputValue = (
237
237
key : string ,
238
238
filterValues : Record < string , any >
239
239
) => {
240
+ if ( formValues [ key ] === undefined || formValues [ key ] === null ) {
241
+ return '' ;
242
+ }
240
243
if ( Array . isArray ( formValues [ key ] ) ) {
241
244
return lodashGet ( filterValues , key , '' ) ;
242
245
}
246
+ if ( formValues [ key ] instanceof Date ) {
247
+ return lodashGet ( filterValues , key , '' ) ;
248
+ }
243
249
if ( typeof formValues [ key ] === 'object' ) {
244
250
return Object . keys ( formValues [ key ] ) . reduce ( ( acc , innerKey ) => {
245
251
acc [ innerKey ] = getInputValue (
You can’t perform that action at this time.
0 commit comments