Repository navigation
fix(frontend): enter a hackathon's start and end as Zurich date and time - #441
Conversation
marftn
left a comment
There was a problem hiding this comment.
Thanks for addressing this, but I think this issue should be solved differently. This PR is patching a symptom rather than fixing the error. The value of endsAt should reflect, as it says, the time when the hackathon ends. It should be equivalent to hackathonClosesAt. What we are doing here is trying to patch in the backend a problem that originates from the frontend sending the wrong time. I see two ways of fixing this:
- Make
endsAta date instead of atime.Timein the backend, and have in the contract that a hackathon ends at the end of a date. - Change the frontend behavior to send the right time instead. If the user chooses December 24, it should send December 25 at 00:00 to the backend (with the zurich time zone). Another option is to let the user select a specific time rather than a date.
The first solution would require some db migration in the backend, and the second one would require changing the already-created hackathons end date, either manually (as it's exceptional and affecting only one hackathon at the moment) or with some migration as well. The expires_at value of the invites should also be fixed, because it was defaulted from endsAt.
I'd prefer the second option (fixing it in the frontend), as it allows more flexibility for the end time.
|
@marftn Good catch, I will do the second option then and fix the timezone in the frontend. |
The create and edit forms offered a date only, and the server action
parsed it with `new Date("2026-11-13")`, which is 00:00 UTC. `ends_at` is
the moment the backend closes a hackathon, so every hackathon closed at
01:00 Zurich time on its own last day: Join and Leave were refused,
invite links defaulting to `ends_at` expired, and a one-day hackathon
went straight from PENDING to FINISHED. "From Bits to Breakthroughs 2026"
(2026-11-13) hit exactly this.
Both forms now take a date and a time, read explicitly as Europe/Zurich
by `$lib/utils/eventTime` — not by `new Date()`, which on the server
reads a bare date-time in the container's UTC clock. The edit form shows
stored values on the same clock, so saving it unchanged keeps them, and
`ends_at` stays what it says: the moment the hackathon ends.
Hackathons and invites created before this keep their midnight-UTC
values; they are corrected by a one-off SQL update, not by this commit.
520248e to
3824c74
Compare
Hackathons close when organizers say they do
Before: organizers could only pick a date, which was saved as midnight UTC. Every hackathon therefore closed at 01:00 on its last day. During "From Bits to Breakthroughs 2026", a one-day event on 13 November, nobody could join, invite links had expired, and the event showed as finished all day. Now organizers pick a date and a time in Zurich time, and the hackathon closes exactly then.
Left out:
main.main.Verified: frontend lint and all tests pass, with new tests for winter time, summer time and both clock-change days.