Skip to content

Conversation

@pgjones
Copy link

@pgjones pgjones commented Jul 12, 2023

The yup documentation states

The default cast logic of date is pass the value to the Date
constructor, failing that, it will attempt to parse the date as an
ISO date string.

which wasn't true and would manifest for timestamps i.e.

const schema = yup.date();
schema.validateSync(1411500325000) // Failed to validate

as the cast logic would try Date.parse(1411500325000) which would return an invalid date.

The yup documentation states

    The default cast logic of date is pass the value to the Date
    constructor, failing that, it will attempt to parse the date as an
    ISO date string.

which wasn't true and would manifest for timestamps i.e.

    const schema = yup.date();
    schema.validateSync(1411500325000) // Failed to validated

as the cast logic would try Date.parse(1411500325000) which would
return an invalid date.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant