Skip to content

Commit

Permalink
fix: invalid date
Browse files Browse the repository at this point in the history
  • Loading branch information
ialexanderbrito committed Jan 21, 2023
1 parent 5f147da commit dc0e957
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/contexts/User.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ export function UserProvider({ children }: any) {
const hourFormattedCalendarEnd = Number(hourFormattedCalendar) + 100;
const startDate = dateFormattedCalendar + 'T' + hourFormattedCalendar;
const endDate = dateFormattedCalendar + 'T' + hourFormattedCalendarEnd;

if (selectHours === '') {
setSelectHours('00:00:00');
}

const dataEHora = new Date(selectDayFormatted + ' ' + selectHours);
const selectHoursFormatted = addMinutes(new Date(dataEHora), 60);
const selectHoursFinish = format(selectHoursFormatted, 'HH:mm:ss');
Expand Down Expand Up @@ -333,6 +338,7 @@ export function UserProvider({ children }: any) {
if (!barbeiro) return;
if (!storagedUser) return;
if (!situacaoAgendamento) return;
if (!selectHoursFinish) return;
if (!selectedService) {
toast.error('Selecione um serviço para agendar', { id: 'toast' });
return;
Expand Down

0 comments on commit dc0e957

Please sign in to comment.