fix: timezone-aware event time calculation#20
Merged
radiolabme merged 1 commit intomainfrom Feb 17, 2026
Merged
Conversation
Use Temporal polyfill to preserve calendar dates when comparing event times. JavaScript Date was treating date-only strings as UTC midnight, causing events to appear as Past before they actually happened. - Add getEventTimestampInTimezone() using Temporal.PlainDate - Add isEventPast() for reliable past/future checks - Update events/index.astro to use new utilities - Add 9 tests covering timezone edge cases
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.
Fixes #12
Problem
Events were displaying as "Past Event" before they actually occurred. The January meeting showed as past at 2:18 PM on January 20, even though it was scheduled for 6 PM that day.
Root Cause
The date parsing logic interpreted date-only strings (
2026-01-20) as UTC midnight, then applied local timezone conversion. For Pacific time (UTC-8), this shifted the calendar date backward—"January 20 at midnight UTC" became "January 19 at 4 PM Pacific."Solution
Use the Temporal API (via polyfill) to handle dates correctly:
Temporal.PlainDateto represent the calendar date without timezoneTemporal.ZonedDateTimeChanges
getEventTimestampInTimezone()andisEventPast()functions@js-temporal/polyfilldependencyTesting
All 73 tests pass. The new tests specifically reproduce the reported bug scenario:
Future
When Temporal lands natively in browsers (projected late 2026), the polyfill can be removed without code changes.