feat: add timezone selector and fix timezone conversion bug#127
Open
webtaken wants to merge 1 commit intocrafter-station:mainfrom
Open
feat: add timezone selector and fix timezone conversion bug#127webtaken wants to merge 1 commit intocrafter-station:mainfrom
webtaken wants to merge 1 commit intocrafter-station:mainfrom
Conversation
Add a LATAM timezone selector to the event creation/edit form using SearchableSelect with searchable dropdown (19 LATAM timezones). Fix bug where event dates were incorrectly stored in UTC. The form sent bare datetime strings (e.g. "2026-03-28T22:45") which were parsed via new Date() in the server's local timezone instead of the event's selected timezone. For example, creating an event at 10:45 PM in Buenos Aires (ART, UTC-3) should be stored as 2026-03-29T01:45:00Z, but was stored as 2026-03-29T03:45:00Z because the server interpreted the time in its own timezone (UTC-5). This caused the detail page to display "domingo 29 de marzo, 12:45 AM (ART)" instead of the correct "sábado 28 de marzo, 10:45 PM (ART)", and the countdown to show ~4h 52m instead of ~2h 52m. Fixed by using fromZonedTime() from date-fns-tz to properly convert local event times to UTC before storage, in both createEvent and updateEvent flows. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
@webtaken is attempting to deploy a commit to the Crafter Station Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SearchableSelectBug Details
When creating an event with a non-default timezone, dates were stored incorrectly. The form sent bare datetime strings (e.g.
2026-03-28T22:45) whichnew Date()parsed in the server's local timezone instead of the event's selected timezone.Example: Creating an event at 10:45 PM Buenos Aires (ART, UTC-3):
2026-03-29T01:45:00Z(22:45 + 3h)2026-03-29T03:45:00Z(parsed as server timezone UTC-5 instead)This caused the detail page to show "domingo 29 de marzo, 12:45 AM (ART)" instead of the correct "sábado 28 de marzo, 10:45 PM (ART)", and the countdown to display ~4h 52m instead of ~2h 52m.
Fix
Use
fromZonedTime()fromdate-fns-tzto properly convert local event times to UTC before storage, in bothcreateEventandupdateEventflows.Files Changed
lib/event-utils.ts— ExportTIMEZONE_ABBRSat module level, addTIMEZONE_OPTIONSlib/actions/events.ts— UsefromZonedTime()for date conversion increateEventcomponents/org/creation/org-event-form-minimal.tsx— Add timezone selector, usefromZonedTime()in edit modeTest plan
bun run buildpasses🤖 Generated with Claude Code