Day picking mode needs minumumNights to be 0

This commit is contained in:
Vesa Luusua 2018-01-05 14:30:30 +02:00
parent 6449a8205d
commit 063d587dc5

View file

@ -11,6 +11,7 @@ import { DateRangePicker, isInclusivelyAfterDay, isInclusivelyBeforeDay } from '
import classNames from 'classnames';
import moment from 'moment';
import { START_DATE, END_DATE } from '../../util/dates';
import * as propTypes from '../../util/propTypes';
import config from '../../config';
import NextMonthIcon from './NextMonthIcon';
@ -29,6 +30,9 @@ export const ANCHOR_LEFT = 'left';
// value and moves on to another input within this component.
const BLUR_TIMEOUT = 100;
// Minumum nights count depends on bookingUnitType (day vs night)
const IS_DAY_PICKER = config.bookingUnitType === propTypes.LINE_ITEM_DAY;
// Possible configuration options of React-dates
const defaultProps = {
initialDates: null, // Possible initial date passed for the component
@ -76,7 +80,7 @@ const defaultProps = {
renderDay: day => {
return <span className="renderedDay">{day.format('D')}</span>;
},
minimumNights: 1,
minimumNights: IS_DAY_PICKER ? 0 : 1,
enableOutsideDays: false,
isDayBlocked: () => false,