From 063d587dc5e588dcd279cf8478225e30d8a6370a Mon Sep 17 00:00:00 2001 From: Vesa Luusua Date: Fri, 5 Jan 2018 14:30:30 +0200 Subject: [PATCH] Day picking mode needs minumumNights to be 0 --- src/components/DateRangeInputField/DateRangeInput.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/DateRangeInputField/DateRangeInput.js b/src/components/DateRangeInputField/DateRangeInput.js index 4cec7396..e6d59bf4 100644 --- a/src/components/DateRangeInputField/DateRangeInput.js +++ b/src/components/DateRangeInputField/DateRangeInput.js @@ -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 {day.format('D')}; }, - minimumNights: 1, + minimumNights: IS_DAY_PICKER ? 0 : 1, enableOutsideDays: false, isDayBlocked: () => false,