How to use the react-dates.DateRangePicker function in react-dates

To help you get started, we’ve selected a few react-dates examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CRUKorg / cruk-searchkit / lib / components / search / date / CRUKSearchkitDateRange.js View on Github external
var numberOfMonths = isMobile ? 1 : 2;

      if (this.noArgs && argState[this.props.id] !== undefined && Object.keys(argState[this.props.id]).length > 0) {
        if (_typeof(argState[this.props.id].min) !== undefined) {
          startDate = (0, _moment2.default)(argState[this.props.id].min);
          initialVisibleMonth = function initialVisibleMonth() {
            return startDate;
          };
        }
        endDate = _typeof(argState[this.props.id].max) !== undefined ? (0, _moment2.default)(argState[this.props.id].max) : null;
      }

      return _react2.default.createElement(
        'div',
        { className: focusedInput ? 'cr-daterange-wrapper cr-daterange-wrapper--focused' : 'cr-daterange-wrapper' },
        _react2.default.createElement(_reactDates.DateRangePicker, _extends({}, this.props, {
          onDatesChange: this.onDatesChange,
          onFocusChange: this.onFocusChange,
          focusedInput: focusedInput,
          startDate: startDate,
          endDate: endDate,
          initialVisibleMonth: initialVisibleMonth,
          displayFormat: 'DD/MM/YYYY',
          numberOfMonths: numberOfMonths
        }))
      );
    }
  }]);