@wernfried/daterangepicker 5.8.0 → 5.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -882,11 +882,29 @@ var DateRangePicker = (function(exports, luxon2) {
882
882
  * @param {sting|external:DateTime|Date} month - The month to be shown, if null then current month is selected.
883
883
  */
884
884
  clearDate(month) {
885
- const initialMonth = this.parseDate(month ?? this.#startDate.startOf("month"));
885
+ if (this.#startDate == null && this.#endDate == null)
886
+ return;
887
+ const monthChange = month !== void 0 && !this.parseDate(month).hasSame(this.#startDate, "month");
888
+ if (monthChange)
889
+ this.#startDate = this.parseDate(month);
890
+ this.updateMonthsInView();
886
891
  this.oldStartDate = this.#startDate;
887
892
  this.oldEndDate = this.#endDate;
888
893
  this.#startDate = null;
889
894
  this.#endDate = null;
895
+ this.updateCalendars(monthChange);
896
+ this.setApplyBtnState();
897
+ if (this.timePicker) {
898
+ this.triggerEvent(this.#events.onBeforeRenderTimePicker);
899
+ this.renderTimePicker("start");
900
+ this.renderTimePicker("end");
901
+ this.container.querySelectorAll(".calendar-time.end-time select").forEach((el) => {
902
+ el.disabled = !this.#endDate;
903
+ });
904
+ this.container.querySelectorAll(".calendar-time.end-time select").forEach((el) => {
905
+ el.classList.toggle("disabled", !this.#endDate);
906
+ });
907
+ }
890
908
  if (this.isInputText)
891
909
  this.element.value = "";
892
910
  if (!this.singleDatePicker)
@@ -899,7 +917,6 @@ var DateRangePicker = (function(exports, luxon2) {
899
917
  this.altInput[1].value = "";
900
918
  }
901
919
  }
902
- this.updateView(!initialMonth.hasSame(this.oldStartDate, "month"));
903
920
  }
904
921
  /**
905
922
  * Parse date value