Skip to content

Commit

Permalink
isObject should return false for Date as well as File, null, and Array
Browse files Browse the repository at this point in the history
Without this, assigning dates to the form's value instead merges them with a default value for objects of `{}` (in mergeDefaultsWithFormData), which stops them being dates.
  • Loading branch information
BenBeattieHood committed Dec 12, 2022
1 parent e5e80bb commit 78e4c10
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/utils/src/isObject.ts
Expand Up @@ -8,5 +8,8 @@ export default function isObject(thing: any) {
if (typeof File !== "undefined" && thing instanceof File) {
return false;
}
if (typeof Date !== "undefined" && thing instanceof Date) {
return false;
}
return typeof thing === "object" && thing !== null && !Array.isArray(thing);
}

0 comments on commit 78e4c10

Please sign in to comment.