@wernfried/daterangepicker 5.2.12 → 5.2.14

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.
@@ -247,12 +247,14 @@ var DateRangePicker = (function(exports, luxon2) {
247
247
  this.maxSpan = null;
248
248
  console.warn(`Ignore option 'minSpan' and 'maxSpan', because 'minSpan' must be smaller than 'maxSpan'`);
249
249
  }
250
- if (this.defaultSpan && this.minSpan && this.minSpan > this.defaultSpan) {
251
- this.defaultSpan = null;
252
- console.warn(`Ignore option 'defaultSpan', because 'defaultSpan' must be greater than 'minSpan'`);
253
- } else if (this.defaultSpan && this.maxSpan && this.maxSpan < this.defaultSpan) {
254
- this.defaultSpan = null;
255
- console.warn(`Ignore option 'defaultSpan', because 'defaultSpan' must be smaller than 'maxSpan'`);
250
+ if (this.defaultSpan) {
251
+ if (this.minSpan && this.minSpan > this.defaultSpan) {
252
+ this.defaultSpan = null;
253
+ console.warn(`Ignore option 'defaultSpan', because 'defaultSpan' must be greater than 'minSpan'`);
254
+ } else if (this.maxSpan && this.maxSpan < this.defaultSpan) {
255
+ this.defaultSpan = null;
256
+ console.warn(`Ignore option 'defaultSpan', because 'defaultSpan' must be smaller than 'maxSpan'`);
257
+ }
256
258
  }
257
259
  }
258
260
  if (this.timePicker) {
@@ -1083,10 +1085,14 @@ var DateRangePicker = (function(exports, luxon2) {
1083
1085
  }
1084
1086
  }
1085
1087
  if (this.minSpan) {
1086
- const minDate = startDate.plus(this.defaultSpan ?? this.minSpan);
1088
+ const minDate = startDate.plus(this.minSpan);
1087
1089
  if (endDate < minDate) {
1088
1090
  violation = { old: endDate, reason: "minSpan" };
1089
- endDate = endDate.plus({ seconds: Math.trunc(minDate.diff(endDate).as("seconds") / shiftStep) * shiftStep });
1091
+ if (this.defaultSpan) {
1092
+ endDate = endDate.plus({ seconds: Math.trunc(startDate.plus(this.defaultSpan).diff(endDate).as("seconds") / shiftStep) * shiftStep });
1093
+ } else {
1094
+ endDate = endDate.plus({ seconds: Math.trunc(minDate.diff(endDate).as("seconds") / shiftStep) * shiftStep });
1095
+ }
1090
1096
  if (endDate < minDate)
1091
1097
  endDate = endDate.plus(this.timePicker ? this.timePickerStepSize : { days: 1 });
1092
1098
  violation.new = endDate;
@@ -1128,8 +1134,12 @@ var DateRangePicker = (function(exports, luxon2) {
1128
1134
  this.triggerEvent(this.#events.onBeforeRenderTimePicker);
1129
1135
  this.renderTimePicker("start");
1130
1136
  this.renderTimePicker("end");
1131
- this.container.querySelectorAll(".calendar-time.end-time select").disabled = !this.#endDate;
1132
- this.container.querySelectorAll(".calendar-time.end-time select").classList.toggle("disabled", !this.#endDate);
1137
+ this.container.querySelectorAll(".calendar-time.end-time select").forEach((el) => {
1138
+ el.disabled = !this.#endDate;
1139
+ });
1140
+ this.container.querySelectorAll(".calendar-time.end-time select").forEach((el) => {
1141
+ el.classList.toggle("disabled", !this.#endDate);
1142
+ });
1133
1143
  }
1134
1144
  this.updateLabel();
1135
1145
  this.updateMonthsInView();
@@ -1377,7 +1387,7 @@ var DateRangePicker = (function(exports, luxon2) {
1377
1387
  if (this.maxSpan && (!this.maxDate || this.#startDate.plus(this.maxSpan) < this.maxDate))
1378
1388
  maxDate = this.#startDate.plus(this.maxSpan);
1379
1389
  if (this.minSpan && side === "end")
1380
- minLimit = this.#startDate.plus(this.defaultSpan ?? this.minSpan);
1390
+ minLimit = this.#startDate.plus(this.minSpan);
1381
1391
  if (side === "start") {
1382
1392
  selected = this.#startDate;
1383
1393
  minDate = this.minDate;