Skip to content

Commit 1643419

Browse files
committed
refactor(DatePicker, DateRangePicker): improve mobile support
1 parent 37a9bb3 commit 1643419

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

js/src/date-range-picker.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ class DateRangePicker extends BaseComponent {
476476
ariaNavPrevMonthLabel: this._config.ariaNavPrevMonthLabel,
477477
ariaNavPrevYearLabel: this._config.ariaNavPrevYearLabel,
478478
calendarDate: this._calendarDate,
479-
calendars: this._config.calendars,
479+
calendars: this._mobile ? 1 : this._config.calendars,
480480
disabledDates: this._config.disabledDates,
481481
endDate: this._endDate,
482482
firstDayOfWeek: this._config.firstDayOfWeek,
@@ -672,12 +672,12 @@ class DateRangePicker extends BaseComponent {
672672
})
673673

674674
if (this._config.timepicker) {
675-
if (this._mobile || (this._range && this._config.calendars === 1)) {
675+
if ((this._mobile && this._config.range) || (this._config.range && this._config.calendars === 1)) {
676676
const timePickerStartEl = document.createElement('div')
677677
timePickerStartEl.classList.add(CLASS_NAME_TIME_PICKER)
678678
this._timePickerStart = new TimePicker(timePickerStartEl, this._getTimePickerConfig(true))
679679

680-
calendarEl.append(timePickerStartEl)
680+
this._timepickers.append(timePickerStartEl)
681681

682682
EventHandler.on(timePickerStartEl, 'timeChange.coreui.time-picker', event => {
683683
this._changeStartDate(event.date, true)

0 commit comments

Comments
 (0)