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 dateTimeSchema NaN validation #283

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

Conversation

jshawl
Copy link

@jshawl jshawl commented Oct 20, 2024

This PR fixes an issue where the dateTimeSchema silently errors on NaN values in the start array:

const {error, value} = ics.createEvent({
  start: [NaN, 12, 1]
})
// error === {}
// value === null

This is because:

[1, 2, NaN, 4].indexOf(NaN) === -1

which then throws a TypeError in yup:

TypeError: lazy() functions must return a valid schema

but it was being caught here

return {error: Object.assign({}, error), value: undefined}

@jshawl jshawl changed the title fix dateTimeSchema NaN validation fix dateTimeSchema NaN validation Oct 20, 2024
@jshawl jshawl marked this pull request as ready for review October 20, 2024 12:57
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