Skip to content
Snippets Groups Projects
Verified Commit ddb3b6a7 authored by Defendi Alberto's avatar Defendi Alberto
Browse files

Create util for DateTimePicker.

parent 778d9cc1
No related branches found
No related tags found
2 merge requests!85Implement the remaining api calls to make possible to link a driver shift with a reservation.,!75Resolve "Driver shift page where driver inserts shift."
/* eslint-disable react/jsx-props-no-spreading */
import React, { FC } from 'react';
import { Control, Controller, FieldValues } from 'react-hook-form';
import { KeyboardDateTimePicker } from '@material-ui/pickers/DateTimePicker/DateTimePicker';
type DateTimePickerPropsType = {
control: Control<FieldValues>;
name: string;
label: string;
id: string;
};
export const ControlledDateTimePicker: FC<DateTimePickerPropsType> = ({
control,
name,
label,
id,
}: DateTimePickerPropsType) => (
<Controller
control={control}
name={name}
as={({ ref, ...rest }) => (
<KeyboardDateTimePicker
margin="normal"
id={id}
label={label}
format="dd/MM/yyyy"
KeyboardButtonProps={{
'aria-label': { label },
}}
{...rest}
/>
)}
/>
);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment