@portnet/ui 0.0.110 → 0.0.112
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.
|
@@ -77,8 +77,12 @@ const PuiStandardDateField = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
77
77
|
} = _ref,
|
|
78
78
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
79
79
|
const handleChange = value => {
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
if (value && (0, _moment.default)(value, format, true).isValid()) {
|
|
81
|
+
const formattedValue = format ? value.format(format) : value.toISOString();
|
|
82
|
+
onChange(formattedValue);
|
|
83
|
+
} else {
|
|
84
|
+
onChange(null);
|
|
85
|
+
}
|
|
82
86
|
};
|
|
83
87
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_DesktopDatePicker.DesktopDatePicker, _objectSpread({
|
|
84
88
|
ref: ref,
|
|
@@ -144,8 +148,13 @@ const PuiFormikDateField = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
144
148
|
const formikContext = (0, _formik.useFormikContext)();
|
|
145
149
|
const [hasError, setHasError] = React.useState(false);
|
|
146
150
|
const handleChange = value => {
|
|
147
|
-
|
|
148
|
-
|
|
151
|
+
if (value) {
|
|
152
|
+
formikContext.setFieldValue(name, value);
|
|
153
|
+
onChange(value);
|
|
154
|
+
} else {
|
|
155
|
+
formikContext.setFieldValue(name, null);
|
|
156
|
+
onChange(null);
|
|
157
|
+
}
|
|
149
158
|
};
|
|
150
159
|
const handleBlur = event => {
|
|
151
160
|
onBlur(event);
|