Skip to content

Fix issue 28 tz#33

Closed
ismayc wants to merge 2 commits into
simonpcouch:mainfrom
ismayc:fix-issue-28-tz
Closed

Fix issue 28 tz#33
ismayc wants to merge 2 commits into
simonpcouch:mainfrom
ismayc:fix-issue-28-tz

Conversation

@ismayc

@ismayc ismayc commented May 22, 2026

Copy link
Copy Markdown
Contributor

No description provided.

ismayc and others added 2 commits May 4, 2026 16:51
…ch#28)

`get_flights()` previously returned `time_hour` with airport-local wall
clocks implicitly tagged as UTC, while `get_weather()` returned true UTC
instants tagged as GMT. The two columns therefore disagreed for any
non-UTC origin and the canonical `(origin, time_hour)` join produced no
rows. After this change both functions return `time_hour` in the
airport's IANA `tzone` (looked up from `get_airports()`), matching
`nycflights13`'s convention: flights are forced into the local zone
(wall clock preserved, instant corrected) and weather is converted into
the local zone (instant preserved, wall clock + year/month/day/hour
recomputed). New unit tests in `test-8-time-hour-tz.R` exercise both
modes and lock in the cross-table join invariant.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
A POSIXct column carries one `tzone` attribute, so the previous "tag each
row with its origin's local tz" approach couldn't actually hold for
mixed-origin queries -- `bind_rows` collapses the per-group tzs and the
printed display silently lies for the losing rows. Reframe the contract:
`get_flights()$time_hour` is the correct UTC instant (BTS wall clocks
reinterpreted via each origin's IANA tz), `get_weather()$time_hour` already
publishes UTC instants, and the `(origin, time_hour)` join works honestly
across any combination of time zones.

Also removes the weather-side UTC-boundary bug (querying & filtering on
UTC months but then converting to local time pulled in adjacent local
months), since weather no longer gets a tz conversion. Tests cover DST
crossing within a single airport, round-trip back to local wall clocks,
multi-tz row ordering, and empty input. Drops `tibble::` usage in tests
(undeclared dependency WARNING) in favour of `dplyr::tibble`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ismayc ismayc closed this May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant