Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix date parsing to match docs and support timestamps #2057

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Jul 12, 2023

  1. Fix date parsing to match docs and support timestamps

    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.
    pgjones committed Jul 12, 2023
    Configuration menu
    Copy the full SHA
    97a3d59 View commit details
    Browse the repository at this point in the history