Skip to content

Commit

Permalink
Merge pull request #95 from RafaDSan/dev
Browse files Browse the repository at this point in the history
Displaying correct endDate on task Created
  • Loading branch information
0xneves authored Oct 16, 2023
2 parents ac68684 + d8a0699 commit 0f18591
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/content/applications/Tasks/settings/CreateTask.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const CreateTask = ({ data }) => {
const [task, setTask] = useState<Task>();
const [valueReward, setValueReward] = useState<string>();
const [authorizedRolesStr, setAuthorizedRolesStr] = useState<string>();
const [expireDate, setExpireDate] = useState<DatePickerProps<Dayjs> | null>(null);
const [expireDate, setExpireDate] = useState<Dayjs | null>(null);
const [loading, setLoading] = useState<boolean>(true);
const [openError, setOpenError] = useState(false);
const { register, handleSubmit, formState: { errors } } = useForm({
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -239,7 +239,7 @@ const CreateTask = ({ data }) => {
<div>
<DatePicker
label={'Deliver Date'}
onChange={(newValue: any) => setExpireDate(newValue)}
onChange={(newValue: Dayjs) => setExpireDate(newValue)}
slotProps={{
textField: { size: 'medium' },
openPickerIcon: { style: { color: theme.palette.primary.main } },
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/TaskServiceHook.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 0f18591

Please sign in to comment.