# All files / components/DatePicker DateRangePicker.js

75% Statements 3/4
100% Branches 0/0
0% Functions 0/1
75% Lines 3/4

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47

    4x

    4x

    4x

     import React from 'react';
    import PropTypes from 'prop-types';
    import 'react-dates/initialize';
    import {
      DateRangePicker as LibDateRangePicker,
      DateRangePickerShape,
    } from 'react-dates';
    import Icon from '../Icon';
    import DateRangePickerWrapper from './styles/DateRangePickerWrapper';
    import DateRangePickerLineSeparator from './styles/DateRangePickerLineSeparator';

    const DateRangePicker = ({ Wrapper, LineSeparator, ...props }) => (
      <Wrapper>
        <LibDateRangePicker
          {...props}
          navPrev={<Icon name="back" size="12px" />}
          navNext={<Icon name="forward" size="12px" />}
          weekDayFormat="dd"
          displayFormat="MMM DD YYYY"
          customArrowIcon={<LineSeparator />}
          daySize={37}
          horizontalMargin={0}
        />
      </Wrapper>
    );

    DateRangePicker.propTypes = {
      ...DateRangePickerShape,
      startDateId: PropTypes.string,
      endDateId: PropTypes.string,
      /**
       * A component to wrap and control styles of the underlying react-dates DatePicker
       */
      Wrapper: PropTypes.func,
      /**
       * A component that renders the separator line between the two inputs
       */
      LineSeparator: PropTypes.func,
    };

    DateRangePicker.defaultProps = {
      Wrapper: DateRangePickerWrapper,
      LineSeparator: DateRangePickerLineSeparator,
    };

    export default DateRangePicker;