Skip to content

Yup DateRange conditional validation #437

@bjnewman

Description

@bjnewman

🐛 Bug report

Current Behavior

dateRange.when() conditional validations throw errors after upgrading yup to v0.32.11 and availity/yup to v4.0.0

see for example this partial schema that worked with availity/yup v3.1.1 and yup v0.29.3
image

will now throw an error that looks like
image

which I believe is due to this.format being undefined in the conditional validation so that getValidDate fails

as seen here
image

Expected behavior

This example test added to dateRange.test.js should pass and we should be able to continue validating dateRanges conditionally

image

Reproducible example

See test above

Suggested solution(s)

Working on it

Additional context

I already pinged Chris and Jordan about this and I have a bit of time to look into this more today and tomorrow so will update this issue if I find out anything useful.

Your environment

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions