5

I'm using antd calendar RangePicker for my react app.i want to show only one month of calendar dropdown upon selection, instead of two months default.

<div className="DatePickerBar">
   <RangePicker format="YYYY-MM-DD"
     className="DateInput"
     value={[moment(dateRange.from), moment(dateRange.to)]}
     onChange={this.onRangeChange}
     allowClear={false}
    />
</div>

3 Answers3

3

For antd@4 it can be possible using this CSS

.ant-picker-panels > *:first-child button.ant-picker-header-next-btn {
  visibility: visible !important;
}

.ant-picker-panels > *:first-child button.ant-picker-header-super-next-btn {
  visibility: visible !important;
}

.ant-picker-panels > *:last-child {
  display: none !important;
}

.ant-picker-panel-container, .ant-picker-footer {
  width: 280px !important;
}

.ant-picker-footer-extra > div {
  flex-wrap: wrap !important; 
}
heberuriegas
  • 356
  • 1
  • 9
1

You can always use css for the 2nd column

.ant-picker-time-panel {
  display:none !important;
}
Munei Nengwenani
  • 113
  • 2
  • 10
0

First thing that comes to my mind is using the showTime feature, but re-formatting to exclude hour and minute selection(default), i.e.:

<div className="DatePickerBar">
   <RangePicker format="YYYY-MM-DD"
     className="DateInput"
     value={[moment(dateRange.from), moment(dateRange.to)]}
     onChange={this.onRangeChange}
     allowClear={false}
     showTime
     format="YYYY/MM/DD"
    />
</div>
gqstav
  • 1,984
  • 1
  • 12
  • 18