Skip to content

Conversation

@adelbke
Copy link

@adelbke adelbke commented Jul 29, 2024

I tried to use the library in an app that tried to validate a date field, ensuring the date is in the past (before Date.now()).

It failed because the library tried to run toJSON() on a function and now I am trying to push a fix for that use case.
It just replaces the description of the field with this description Before a date computed dynamically.

Did the same for the MinDate decorator as well.

@adelbke
Copy link
Author

adelbke commented Nov 23, 2024

Any Updates on this @epiphone ?

],
}),
[cv.MIN_DATE]: (meta) => {
const description = typeof meta.constraints[0] === 'function' ? `After a date computed dynamically` : `After ${meta.constraints[0]}`;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const description = typeof meta.constraints[0] === 'function' ? `After a date computed dynamically` : `After ${meta.constraints[0]}`;
const description = typeof meta.constraints[0] === 'function' ? `After a date computed dynamically` : `After ${meta.constraints[0].toJSON()}`;

}
},
[cv.MAX_DATE]: (meta) => {
const description = typeof meta.constraints[0] === 'function' ? `Before a date computed dynamically` : `Before ${meta.constraints[0]}`;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const description = typeof meta.constraints[0] === 'function' ? `Before a date computed dynamically` : `Before ${meta.constraints[0]}`;
const description = typeof meta.constraints[0] === 'function' ? `Before a date computed dynamically` : `Before ${meta.constraints[0].toJSON()}`;

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.

2 participants