@monolith-forensics/monolith-ui 1.2.110 → 1.2.111

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.
@@ -193,9 +193,10 @@ const InputSegment = styled.div `
193
193
  }
194
194
  `;
195
195
  const DateInput = forwardRef(({ className, style = {}, defaultValue, value, format = "YYYY-MM-DD HH:mm:ss", label, description, arrow = true, size = "sm", variant = "outlined", clearable = false, required = false, onChange = () => { }, min, max, error, enableCalendar = false, utc = false, closeOnSelect = true, disabled = false, }, _ref) => {
196
- const isControlled = value !== undefined;
196
+ // Determine controlled status only once at mount
197
+ const isControlled = useRef(value !== undefined);
197
198
  const [unControlledValue, setUncontrolledValue] = useState(defaultValue);
198
- const _value = isControlled ? value : unControlledValue;
199
+ const _value = isControlled.current ? value : unControlledValue;
199
200
  const [selectedSegment, setSelectedSegment] = useState();
200
201
  const [isOpen, setIsOpen] = useState(false);
201
202
  // Check if format is date only and does not include time
@@ -351,7 +352,10 @@ const DateInput = forwardRef(({ className, style = {}, defaultValue, value, form
351
352
  setUncontrolledValue((prev) => {
352
353
  if (!(selectedSegment === null || selectedSegment === void 0 ? void 0 : selectedSegment.momentType))
353
354
  return prev;
354
- const momentValue = utc ? moment.utc(prev) : moment(prev);
355
+ // if prev is null, use undefined - passing null to moment returns a null moment value
356
+ const momentValue = utc
357
+ ? moment.utc(prev || undefined)
358
+ : moment(prev || undefined);
355
359
  let newValue = moment(momentValue)
356
360
  .set(selectedSegment.momentType, parseInt(tempValue, 10) -
357
361
  (selectedSegment.type === "month" ? 1 : 0))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monolith-forensics/monolith-ui",
3
- "version": "1.2.110",
3
+ "version": "1.2.111",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "author": "Matt Danner (Monolith Forensics LLC)",