Skip to content

Commit 77c0d24

Browse files
committed
fix(DateRangePicker): correct handling of the update method
1 parent c8ccd81 commit 77c0d24

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

js/src/date-range-picker.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,14 @@ class DateRangePicker extends Picker {
189189

190190
update(config) {
191191
this._config = this._getConfig(config)
192-
this._element.innerHTML = ''
192+
this._calendarDate = this._convertStringToDate(this._config.calendarDate || this._config.date || this._config.startDate || new Date())
193+
this._startDate = this._convertStringToDate(this._config.date || this._config.startDate)
194+
this._endDate = this._convertStringToDate(this._config.endDate)
195+
this._selectEndDate = this._config.selectEndDate
196+
197+
this._dropdownToggleEl.innerHTML = ''
198+
this._dropdownMenuEl.innerHTML = ''
199+
193200
this._createDateRangePicker()
194201
this._createCalendars()
195202
this._addEventListeners()
@@ -214,8 +221,6 @@ class DateRangePicker extends Picker {
214221
parseISO(event.target.value) :
215222
getLocalDateFromString(event.target.value, this._config.locale, this._config.timepicker)
216223

217-
// eslint-disable-next-line no-console
218-
console.log(parseISO(event.target.value))
219224
if (date instanceof Date && date.getTime()) {
220225
this._startDate = date
221226
this._calendarDate = date

0 commit comments

Comments
 (0)