diff --git a/src/content/applications/Tasks/settings/CreateTask.tsx b/src/content/applications/Tasks/settings/CreateTask.tsx index 2f82492..74db00e 100644 --- a/src/content/applications/Tasks/settings/CreateTask.tsx +++ b/src/content/applications/Tasks/settings/CreateTask.tsx @@ -70,7 +70,7 @@ const CreateTask = ({ data }) => { const [task, setTask] = useState(); const [valueReward, setValueReward] = useState(); const [authorizedRolesStr, setAuthorizedRolesStr] = useState(); - const [expireDate, setExpireDate] = useState | null>(null); + const [expireDate, setExpireDate] = useState(null); const [loading, setLoading] = useState(true); const [openError, setOpenError] = useState(false); const { register, handleSubmit, formState: { errors } } = useForm({ @@ -125,8 +125,8 @@ const CreateTask = ({ data }) => { const splittedRoles: readonly bigint[] = authorizedRoles.map(str => BigInt(str)); task.authorizedRoles = splittedRoles; task.reward = BigInt(valueReward); - let data = String(Math.floor(Date.now() / 1000) + 3600) - task.endDate = BigInt(data); + let expireTimestamp = expireDate.unix(); + task.endDate = BigInt(expireTimestamp); console.log("task.endDate: ", task.endDate); await createTask(task); @@ -239,7 +239,7 @@ const CreateTask = ({ data }) => {
setExpireDate(newValue)} + onChange={(newValue: Dayjs) => setExpireDate(newValue)} slotProps={{ textField: { size: 'medium' }, openPickerIcon: { style: { color: theme.palette.primary.main } }, diff --git a/src/hooks/TaskServiceHook.tsx b/src/hooks/TaskServiceHook.tsx index ba81db8..ac2c342 100644 --- a/src/hooks/TaskServiceHook.tsx +++ b/src/hooks/TaskServiceHook.tsx @@ -102,7 +102,7 @@ export const useTaskServiceHook = (task: TaskService) => { const timeInSeconds = Math.floor(Number(nft.endDate) * 1000); const date = new Date(timeInSeconds); - const dateFormatted = `${date.getDate().toString().padStart(2, '0')}/${(date.getMonth() + 1).toString().padStart(2, '0')}/${date.getFullYear()}`; + const dateFormatted = `${(date.getMonth() + 1).toString().padStart(2, '0')}/${date.getDate().toString().padStart(2, '0')}/${date.getFullYear()}`; nft.endDate = dateFormatted; setTaskData(nft); } catch (error) {