TimeShape.ts 477 B

12345678910111213141516171819
  1. import PropTypes from 'prop-types';
  2. const PlainTimeShape = [PropTypes.string, PropTypes.number, PropTypes.instanceOf(Date)];
  3. /**
  4. * Can be
  5. * - 12:00:12
  6. * - \[12:00:12]
  7. * - \[12:00:12, 12:21:12]
  8. * - \[[12:00:12, 12:21:12], [12:11:12, 12:32:12]]
  9. */
  10. const TimeShape = PropTypes.oneOfType([
  11. ...PlainTimeShape,
  12. PropTypes.arrayOf(PropTypes.string),
  13. PropTypes.arrayOf(PropTypes.number),
  14. PropTypes.arrayOf(PropTypes.instanceOf(Date)),
  15. ]);
  16. export { TimeShape };