@idds/react 1.1.98 → 1.1.99

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.
package/dist/index.es.js CHANGED
@@ -9114,6 +9114,7 @@ function DatePicker({
9114
9114
  setTempStartDate(null);
9115
9115
  setIsOpen(false);
9116
9116
  } else {
9117
+ onChange(["", ""]);
9117
9118
  setTempStartDate(date);
9118
9119
  }
9119
9120
  } else if (mode === "multiple") {
@@ -9272,11 +9273,13 @@ function DatePicker({
9272
9273
  if (tempStartDate && isSameDate(date, tempStartDate)) {
9273
9274
  return true;
9274
9275
  }
9275
- if (selectedDates.length === 1) {
9276
- return isSameDate(date, selectedDates[0]);
9277
- } else if (selectedDates.length === 2) {
9278
- const [start, end] = selectedDates;
9279
- return isSameDate(date, start) || isSameDate(date, end);
9276
+ if (!tempStartDate) {
9277
+ if (selectedDates.length === 1) {
9278
+ return isSameDate(date, selectedDates[0]);
9279
+ } else if (selectedDates.length === 2) {
9280
+ const [start, end] = selectedDates;
9281
+ return isSameDate(date, start) || isSameDate(date, end);
9282
+ }
9280
9283
  }
9281
9284
  return false;
9282
9285
  } else {
@@ -9285,9 +9288,14 @@ function DatePicker({
9285
9288
  };
9286
9289
  const isDateInRange = (date) => {
9287
9290
  if (!date) return false;
9288
- if (mode === "range" && selectedDates.length === 2) {
9289
- const [start, end] = selectedDates;
9290
- return date > start && date < end;
9291
+ if (mode === "range") {
9292
+ if (tempStartDate) {
9293
+ return false;
9294
+ }
9295
+ if (selectedDates.length === 2) {
9296
+ const [start, end] = selectedDates;
9297
+ return date > start && date < end;
9298
+ }
9291
9299
  }
9292
9300
  return false;
9293
9301
  };
@@ -9308,14 +9316,19 @@ function DatePicker({
9308
9316
  };
9309
9317
  const getRangePosition = (date) => {
9310
9318
  if (!date) return "none";
9311
- if (mode === "range" && selectedDates.length === 2) {
9312
- const [start, end] = selectedDates;
9313
- if (isSameDate(date, start) && isSameDate(date, end)) {
9314
- return "single";
9315
- }
9316
- if (isSameDate(date, start)) return "start";
9317
- if (isSameDate(date, end)) return "end";
9318
- if (date > start && date < end) return "middle";
9319
+ if (mode === "range") {
9320
+ if (tempStartDate && isSameDate(date, tempStartDate)) {
9321
+ return "start";
9322
+ }
9323
+ if (!tempStartDate && selectedDates.length === 2) {
9324
+ const [start, end] = selectedDates;
9325
+ if (isSameDate(date, start) && isSameDate(date, end)) {
9326
+ return "single";
9327
+ }
9328
+ if (isSameDate(date, start)) return "start";
9329
+ if (isSameDate(date, end)) return "end";
9330
+ if (date > start && date < end) return "middle";
9331
+ }
9319
9332
  }
9320
9333
  return "none";
9321
9334
  };