Skip to content

Commit

Permalink
IBX-8554: Added checks if flatpickrDate and this.flatpickrConfig.minD…
Browse files Browse the repository at this point in the history
…ate exists (#1305)

Co-authored-by: Mateusz Dębiński <[email protected]>
  • Loading branch information
mateuszdebinski and Mateusz Dębiński authored Aug 1, 2024
1 parent ddf157b commit 3680f12
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class DateTimePicker {
this.inputField = this.fieldWrapper.querySelector('.ibexa-date-time-picker__input');
this.actionsWrapper = this.fieldWrapper.querySelector('.ibexa-input-text-wrapper__actions');
this.calendarBtn = this.actionsWrapper.querySelector('.ibexa-input-text-wrapper__action-btn--calendar');
this.clearBtn = this.fieldWrapper.querySelector('.ibexa-input-text-wrapper__action-btn--clear');
this.customOnChange = config.onChange;

this.init = this.init.bind(this);
Expand Down Expand Up @@ -85,6 +84,10 @@ class DateTimePicker {
if (typeof value === 'number' && value >= 0) {
const flatpickrDate = this.flatpickrInstance.selectedDates[0];

if (flatpickrDate === undefined) {
return;
}

if (isMinute) {
flatpickrDate.setMinutes(value);
} else {
Expand Down

0 comments on commit 3680f12

Please sign in to comment.