fix: updates typing on DatePicker component and joi schema

This commit is contained in:
Jarrod Flesch
2020-12-29 12:41:15 -05:00
parent 30e28603a7
commit 5100fd35dc
7 changed files with 106 additions and 38 deletions

View File

@@ -5,7 +5,7 @@ import withCondition from '../../withCondition';
import useFieldType from '../../useFieldType';
import Label from '../../Label';
import Error from '../../Error';
import { date } from '../../../../../fields/validations';
import { date as dateValidation } from '../../../../../fields/validations';
import { Props } from './types';
import './index.scss';
@@ -17,12 +17,14 @@ const DateTime: React.FC<Props> = (props) => {
path: pathFromProps,
name,
required,
validate = date,
validate = dateValidation,
label,
admin: {
placeholder,
readOnly,
style,
width,
date,
} = {},
} = props;
@@ -69,7 +71,9 @@ const DateTime: React.FC<Props> = (props) => {
/>
<div className={`${baseClass}__input-wrapper`}>
<DatePicker
{...props}
{...date}
placeholder={placeholder}
readOnly={readOnly}
onChange={readOnly ? undefined : setValue}
value={value as Date}
/>