React prop validation for date objects

Reactjs

Reactjs Problem Overview


What is the currently preferred way to validate a Date prop in react?

Right now I'm using: React.PropTypes.object

This, however, is now failing the forbid-prop-types lint rule. Should I use a shape or is there some better way?

Reactjs Solutions


Solution 1 - Reactjs

Pretty sure you could use PropTypes.instanceOf(Date)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDavid WeldonView Question on Stackoverflow
Solution 1 - ReactjsAlex McpView Answer on Stackoverflow