Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Matboj #460

Merged
merged 1 commit into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/components/CompetitionPage/UpcomingOrCurrentEventInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@ export const UpcomingOrCurrentEventInfo: FC<{event: Event; name: string; shortNa

const upcomingEventDate = event ? formatDateTimeInterval(start, end) : null

const regStart = DateTime.fromISO(registration_link.start)
const regEnd = DateTime.fromISO(registration_link.end)
const regStart = registration_link && DateTime.fromISO(registration_link.start)
const regEnd = registration_link && DateTime.fromISO(registration_link.end)
const now = DateTime.now()

const registrationInfo = (() => {
if (!regStart || !regEnd) return ''
if (now < regStart) return `Registrácia bude otvorená od ${regStart.toFormat(DateFormat.DATE_TIME)}`
if (now < regEnd) return `Registrácia je otvorená do ${regEnd.toFormat(DateFormat.DATE_TIME)}`
return `Registrácia bola ukončená`
})()

const isRegistrationActive = regStart < now && regEnd > now
const isRegistrationActive = regStart && regEnd && regStart < now && regEnd > now

return (
<Stack gap={1}>
Expand Down
2 changes: 1 addition & 1 deletion src/types/api/competition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface Event {
can_participate: boolean
is_registered: boolean
publication_set: Publication[]
registration_link: RegistrationLink
registration_link?: RegistrationLink
location: string | null
year: number | null
school_year: string | null
Expand Down
Loading