@wernfried/daterangepicker 5.2.5 → 5.2.6

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.
@@ -66,8 +66,7 @@ var DateRangePicker = (function(exports, luxon2) {
66
66
  };
67
67
  if (this.element == null)
68
68
  return;
69
- this.callback = function() {
70
- };
69
+ this.callback = null;
71
70
  this.isShowing = false;
72
71
  this.leftCalendar = {};
73
72
  this.rightCalendar = {};
@@ -880,6 +879,8 @@ var DateRangePicker = (function(exports, luxon2) {
880
879
  * @returns {string} - Formatted date string
881
880
  */
882
881
  formatDate(date, format = this.locale.format) {
882
+ if (date === null)
883
+ return null;
883
884
  if (typeof format === "object") {
884
885
  return date.toLocaleString(format);
885
886
  } else {
@@ -1656,8 +1657,10 @@ var DateRangePicker = (function(exports, luxon2) {
1656
1657
  this.#startDate = this.oldStartDate;
1657
1658
  this.#endDate = this.oldEndDate;
1658
1659
  }
1659
- if (!this.#startDate.equals(this.oldStartDate ?? luxon2.DateTime) || !this.#endDate.equals(this.oldEndDate ?? luxon2.DateTime))
1660
- this.callback(this.startDate, this.endDate, this.chosenLabel);
1660
+ if (typeof this.callback === "function") {
1661
+ if (this.#startDate && !this.#startDate.equals(this.oldStartDate ?? luxon2.DateTime) || this.#endDate && !this.singleDatePicker && !this.#endDate.equals(this.oldEndDate ?? luxon2.DateTime))
1662
+ this.callback(this.startDate, this.endDate, this.chosenLabel);
1663
+ }
1661
1664
  this.updateElement();
1662
1665
  const event = this.triggerEvent(this.#events.onBeforeHide);
1663
1666
  if (event.defaultPrevented)