diff --git a/src/components/FieldDateInput/DateInput.js b/src/components/FieldDateInput/DateInput.js index 89d9eb30..7b52d131 100644 --- a/src/components/FieldDateInput/DateInput.js +++ b/src/components/FieldDateInput/DateInput.js @@ -5,7 +5,7 @@ * N.B. *isOutsideRange* in defaultProps is defining what dates are available to booking. */ import React, { Component } from 'react'; -import { bool, func, instanceOf, shape, string } from 'prop-types'; +import { bool, func, instanceOf, shape, string, arrayOf } from 'prop-types'; import { SingleDatePicker, isInclusivelyAfterDay, @@ -16,6 +16,7 @@ import { intlShape, injectIntl } from 'react-intl'; import classNames from 'classnames'; import moment from 'moment'; import config from '../../config'; +import { propTypes } from '../../util/types'; import NextMonthIcon from './NextMonthIcon'; import PreviousMonthIcon from './PreviousMonthIcon'; @@ -161,7 +162,7 @@ class DateInputComponent extends Component { ? day => { return !timeSlots.find(timeSlot => isSameDay(day, moment(timeSlot.attributes.start))); } - : null; + : () => false; const placeholder = placeholderText || intl.formatMessage({ id: 'FieldDateInput.placeholder' }); @@ -203,6 +204,7 @@ DateInputComponent.defaultProps = { className: null, useMobileMargins: false, ...defaultProps, + timeSlots: null, }; DateInputComponent.propTypes = { @@ -226,6 +228,7 @@ DateInputComponent.propTypes = { value: shape({ date: instanceOf(Date), }), + timeSlots: arrayOf(propTypes.timeSlot), }; export default injectIntl(DateInputComponent); diff --git a/src/components/FieldDateInput/FieldDateInput.example.js b/src/components/FieldDateInput/FieldDateInput.example.js index f0dce21c..19431f79 100644 --- a/src/components/FieldDateInput/FieldDateInput.example.js +++ b/src/components/FieldDateInput/FieldDateInput.example.js @@ -21,6 +21,7 @@ const FormComponent = props => ( {...props} render={fieldRenderProps => { const { + style, form, handleSubmit, onChange, @@ -36,6 +37,7 @@ const FormComponent = props => ( return (