@monolith-forensics/monolith-ui 1.1.82 → 1.1.83
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.
|
@@ -199,6 +199,8 @@ const DateInput = styled(({ className, defaultValue, format = "YYYY-MM-DD HH:mm:
|
|
|
199
199
|
const { getReferenceProps } = useInteractions([dismiss]);
|
|
200
200
|
const segments = useMemo(() => parseTimestamp(moment(value).toISOString(), format, utc), [value, format, utc]);
|
|
201
201
|
const checkValidRange = (value) => {
|
|
202
|
+
if (!value)
|
|
203
|
+
return false;
|
|
202
204
|
if (min && moment(value).isBefore(min))
|
|
203
205
|
return false;
|
|
204
206
|
if (max && moment(value).isAfter(max))
|
|
@@ -353,18 +355,28 @@ const DateInput = styled(({ className, defaultValue, format = "YYYY-MM-DD HH:mm:
|
|
|
353
355
|
}
|
|
354
356
|
};
|
|
355
357
|
const handleWheelEvent = (e) => {
|
|
356
|
-
if (!selectedSegment)
|
|
358
|
+
if (!selectedSegment) {
|
|
357
359
|
return;
|
|
360
|
+
}
|
|
358
361
|
setValue((prev) => {
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
362
|
+
let newValue = prev;
|
|
363
|
+
if (selectedSegment.type === "separator") {
|
|
364
|
+
newValue = prev; // skip all logic if separator
|
|
365
|
+
}
|
|
366
|
+
else if (!prev) {
|
|
367
|
+
newValue = isDateOnly
|
|
368
|
+
? moment().format(format)
|
|
369
|
+
: moment().toISOString();
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
newValue =
|
|
373
|
+
e.deltaY > 0
|
|
374
|
+
? moment(newValue).subtract(1, selectedSegment.type).toISOString()
|
|
375
|
+
: moment(newValue).add(1, selectedSegment.type).toISOString();
|
|
376
|
+
}
|
|
377
|
+
if (!checkValidRange(newValue)) {
|
|
367
378
|
return prev;
|
|
379
|
+
}
|
|
368
380
|
newValue = isDateOnly ? moment(newValue).format(format) : newValue;
|
|
369
381
|
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
370
382
|
return newValue;
|