@wernfried/daterangepicker 5.2.14 → 5.2.18

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.
@@ -1089,9 +1089,9 @@ var DateRangePicker = (function(exports, luxon2) {
1089
1089
  if (endDate < minDate) {
1090
1090
  violation = { old: endDate, reason: "minSpan" };
1091
1091
  if (this.defaultSpan) {
1092
- endDate = endDate.plus({ seconds: Math.trunc(startDate.plus(this.defaultSpan).diff(endDate).as("seconds") / shiftStep) * shiftStep });
1092
+ endDate = startDate.plus({ seconds: Math.trunc(this.defaultSpan.as("seconds") / shiftStep) * shiftStep });
1093
1093
  } else {
1094
- endDate = endDate.plus({ seconds: Math.trunc(minDate.diff(endDate).as("seconds") / shiftStep) * shiftStep });
1094
+ endDate = startDate.plus({ seconds: Math.trunc(this.minSpan.as("seconds") / shiftStep) * shiftStep });
1095
1095
  }
1096
1096
  if (endDate < minDate)
1097
1097
  endDate = endDate.plus(this.timePicker ? this.timePickerStepSize : { days: 1 });
@@ -2042,11 +2042,19 @@ var DateRangePicker = (function(exports, luxon2) {
2042
2042
  this.#startDate = this.#startDate.set({ hour, minute, second });
2043
2043
  if (this.singleDatePicker) {
2044
2044
  this.#endDate = this.#startDate;
2045
- } else if (this.#endDate && this.#endDate.hasSame(this.#startDate, "day") && this.#endDate < this.#startDate) {
2046
- this.#endDate = this.#startDate;
2045
+ } else if (this.#endDate && this.#endDate.hasSame(this.#startDate, "day")) {
2046
+ if (this.defaultSpan && this.#endDate < this.#startDate.plus(this.minSpan)) {
2047
+ this.#endDate = this.#startDate.plus(this.defaultSpan);
2048
+ } else if (this.minSpan && this.#endDate < this.#startDate.plus(this.minSpan)) {
2049
+ this.#endDate = this.#startDate.plus(this.minSpan);
2050
+ } else if (this.#endDate < this.#startDate) {
2051
+ this.#endDate = this.#startDate;
2052
+ }
2047
2053
  }
2048
2054
  } else if (this.#endDate) {
2049
2055
  this.#endDate = this.#endDate.set({ hour, minute, second });
2056
+ if (this.#endDate < this.#startDate)
2057
+ this.#endDate = this.#startDate.plus(this.minSpan ?? luxon2.Duration.fromObject({}));
2050
2058
  }
2051
2059
  this.updateCalendars(false);
2052
2060
  this.setApplyBtnState();