update date time
This commit is contained in:
@ -34,7 +34,10 @@ const AddDialog = () => {
|
||||
created_by: '',
|
||||
created_at: ''
|
||||
};
|
||||
|
||||
const [formField, setFormField] = useState(initialState);
|
||||
const created_time = new Date();
|
||||
const formattedTime = created_time.toISOString().slice(0, 19).replace('T', ' ');
|
||||
|
||||
const resetForm = () => {
|
||||
setFormField(initialState);
|
||||
@ -70,8 +73,6 @@ const AddDialog = () => {
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const created_time = new Date();
|
||||
const formattedTime = created_time.toISOString().slice(0, 19).replace('T', ' ');
|
||||
if (showAddDialog) {
|
||||
setFormField({
|
||||
...formField,
|
||||
@ -79,7 +80,7 @@ const AddDialog = () => {
|
||||
created_at: formattedTime
|
||||
});
|
||||
}
|
||||
}, [showAddDialog]);
|
||||
}, [formattedTime]);
|
||||
|
||||
return (
|
||||
<Dialog open={showAddDialog} onOpenChange={(open) => handleAddDialog(open)}>
|
||||
|
||||
Reference in New Issue
Block a user