Skip to content

Commit

Permalink
fix Matboj (#460)
Browse files Browse the repository at this point in the history
  • Loading branch information
rtrembecky authored Nov 23, 2024
1 parent 199a1c4 commit 2a27266
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
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

0 comments on commit 2a27266

Please sign in to comment.