update date time

This commit is contained in:
Wikzyy
2025-03-04 13:50:43 +07:00
parent 78e3b3d112
commit ea21966453
6 changed files with 22 additions and 24 deletions

View File

@ -37,6 +37,9 @@ const AddDialog = () => {
};
const [formField, setFormField] = useState(initialState);
const created_time = new Date();
const formattedTime = created_time.toISOString().slice(0, 19).replace('T', ' ');
const resetForm = () => {
setFormField(initialState);
};
@ -92,8 +95,6 @@ const AddDialog = () => {
};
useEffect(() => {
const created_time = new Date();
const formattedTime = created_time.toISOString().slice(0, 19).replace('T', ' ');
if (showAddDialog) {
setFormField({
name: formField.name,
@ -101,7 +102,7 @@ const AddDialog = () => {
created_at: formattedTime
});
}
}, [showAddDialog]);
}, [formattedTime]);
return (
<Dialog open={showAddDialog} onOpenChange={(open) => handleAddDialog(open)}>