add contest thunck and remove google button

This commit is contained in:
Виталий Лавшонок
2025-12-02 22:34:28 +03:00
parent 2e5d4b2653
commit 95f7479375
6 changed files with 459 additions and 162 deletions

View File

@@ -12,6 +12,16 @@ import { CreateContestBody } from '../../../redux/slices/contests';
import DateRangeInput from '../../../components/input/DateRangeInput';
import { useNavigate } from 'react-router-dom';
function toUtc(localDateTime?: string): string {
if (!localDateTime) return '';
// Создаём дату (она автоматически считается как локальная)
const date = new Date(localDateTime);
// Возвращаем ISO-строку с 'Z' (всегда в UTC)
return date.toISOString();
}
interface ModalCreateContestProps {
active: boolean;
setActive: (value: boolean) => void;
@@ -61,7 +71,13 @@ const ModalCreateContest: FC<ModalCreateContestProps> = ({
};
const handleSubmit = () => {
dispatch(createContest(form));
dispatch(
createContest({
...form,
endsAt: toUtc(form.endsAt),
startsAt: toUtc(form.startsAt),
}),
);
};
return (