Fix issue 28 tz#33
Closed
ismayc wants to merge 2 commits into
Closed
Conversation
…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>
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.
No description provided.