contest update form fix

This commit is contained in:
Виталий Лавшонок
2025-12-09 17:09:11 +03:00
parent 6675bd871e
commit 14d2f5cbf1
3 changed files with 47 additions and 12 deletions

View File

@@ -27,6 +27,16 @@ interface Mission {
name: string;
}
function toUtc(localDateTime?: string): string {
if (!localDateTime) return '';
// Создаём дату (она автоматически считается как локальная)
const date = new Date(localDateTime);
// Возвращаем ISO-строку с 'Z' (всегда в UTC)
return date.toISOString();
}
/**
* Страница создания / редактирования контеста
*/
@@ -117,7 +127,14 @@ const ContestEditor = () => {
};
const handleUpdateContest = () => {
dispatch(updateContest({ ...contest, contestId }));
dispatch(
updateContest({
...contest,
endsAt: toUtc(contest.endsAt),
startsAt: toUtc(contest.startsAt),
contestId,
}),
);
};
const handleDeleteContest = () => {