@portnet/ui 0.0.111 → 0.0.113
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.
|
@@ -113,7 +113,8 @@ const PuiStandardDateField = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
113
113
|
onBlur: onBlur,
|
|
114
114
|
helperText: helperText
|
|
115
115
|
}, params), {}, {
|
|
116
|
-
error:
|
|
116
|
+
error: required && meta.touched && Boolean(meta.error),
|
|
117
|
+
helperText: meta.touched && meta.error ? meta.error : helperText,
|
|
117
118
|
inputProps: _objectSpread({
|
|
118
119
|
name
|
|
119
120
|
}, params.inputProps)
|
|
@@ -148,12 +149,13 @@ const PuiFormikDateField = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
|
148
149
|
const formikContext = (0, _formik.useFormikContext)();
|
|
149
150
|
const [hasError, setHasError] = React.useState(false);
|
|
150
151
|
const handleChange = value => {
|
|
151
|
-
if (value) {
|
|
152
|
+
if (value && (0, _moment.default)(value, inputFormat, true).isValid()) {
|
|
152
153
|
formikContext.setFieldValue(name, value);
|
|
153
154
|
onChange(value);
|
|
154
155
|
} else {
|
|
155
|
-
|
|
156
|
-
|
|
156
|
+
// Set the field value to undefined when the input is invalid or empty
|
|
157
|
+
formikContext.setFieldValue(name, undefined);
|
|
158
|
+
onChange(undefined);
|
|
157
159
|
}
|
|
158
160
|
};
|
|
159
161
|
const handleBlur = event => {
|