mirror of
https://github.com/LucasVbr/meeting-app.git
synced 2026-05-14 01:31:54 +00:00
6eba0d5785
Took 7 hours 1 minute
30 lines
852 B
TypeScript
30 lines
852 B
TypeScript
import {Button, Flex, FormControl, Input} from '@chakra-ui/react';
|
|
import {useDispatch} from 'react-redux';
|
|
import {useState} from 'react';
|
|
import moment from 'moment';
|
|
|
|
const BirthInput = () => {
|
|
const dispatch = useDispatch();
|
|
const [birth, setBirth] = useState('');
|
|
|
|
return (
|
|
<Flex>
|
|
<FormControl>
|
|
<Input type={'date'} onChange={(evt) => setBirth(evt.target.value)}
|
|
value={birth}/>
|
|
</FormControl>
|
|
|
|
<FormControl>
|
|
<Button onClick={() => dispatch({
|
|
type: 'gettingStartForm/setInput',
|
|
payload: {
|
|
inputs: {'birth': moment(birth).toISOString()},
|
|
message: `Le ${moment(birth).format("ll")}.`, // TODO formate date
|
|
},
|
|
})}>Envoyer</Button>
|
|
</FormControl>
|
|
</Flex>
|
|
);
|
|
};
|
|
|
|
export default BirthInput; |