Open joegasewicz opened 3 years ago
I can do this.
By the way, this check and other like this will fail in the runtime and will lead to error because typescript check types only on compile / development stage - https://github.com/joegasewicz/react-bare-forms/blob/75966d93d7e374bbd0e52f5163e81370d4a89b0e/src/validators.ts#L205
@rustmn Please go ahead with this is issue #145, I will look into if (!fieldValue) {
btw this is a value check / cohesion to a boolean , not a type check (typeof).
Thanks
@joegasewicz ok, I'm about this - https://github.com/joegasewicz/react-bare-forms/blob/75966d93d7e374bbd0e52f5163e81370d4a89b0e/src/validators.ts#L203
You expect fieldValue to be a Date object, you check only if it's value is not null / undefined / false, and then interact with it as it were a Date object - https://github.com/joegasewicz/react-bare-forms/blob/75966d93d7e374bbd0e52f5163e81370d4a89b0e/src/validators.ts#L216
Some users may pass an empty object and it will not work as expected, I'll fix it.
@rustmn great , go ahead, thanks
https://github.com/joegasewicz/react-bare-forms/blob/75966d93d7e374bbd0e52f5163e81370d4a89b0e/src/validators.ts#L215
I expect this function to work like this: