Skip to content

Commit

Permalink
[ADD]: período de matrícula atual
Browse files Browse the repository at this point in the history
  • Loading branch information
juliaryoshida committed Dec 14, 2023
1 parent aabc685 commit cda0506
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions frontend/src/pages/Home/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ const Home = () => {
<Text fontSize="lg" color="#243A69" marginTop="2vh">
Período de Matrícula Atual:{" "}
{`${new Date(currentRegistrationPeriod.start).toLocaleDateString()} às ${new Date(
currentRegistrationPeriod.start
).toLocaleTimeString()} - ${new Date(currentRegistrationPeriod.end).toLocaleDateString()} às ${new Date(
currentRegistrationPeriod.end
).toLocaleTimeString()}`}
</Text>
Expand Down
14 changes: 13 additions & 1 deletion frontend/src/pages/RegistrationPeriod/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,19 @@ const RegistrationPeriod = () => {
}),
endTime: yup
.string()
.required("A hora de término é obrigatória"),
.required("A hora de término é obrigatória")
.test('isAfterStart', 'A hora de término deve ser posterior à hora de início', function (endTime) {
const { startDate, startTime, endDate } = this.parent;

if (endDate === startDate) {
const startDateTime = new Date(`${startDate}T${startTime}`);
const endDateTime = new Date(`${endDate}T${endTime}`);

return endDateTime > startDateTime;
}

return true;
}),
}),
onSubmit: async (values) => {
console.log(values);
Expand Down

1 comment on commit cda0506

@vercel
Copy link

@vercel vercel bot commented on cda0506 Dec 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

matriculai – ./frontend

matriculai.vercel.app
matriculai-git-main-matriculai.vercel.app
matriculai-matriculai.vercel.app

Please sign in to comment.