fix: auto-detect 2-digit-year (M/D/YY) dates and datetimes (#36088)#1
Open
hidekoji wants to merge 1 commit into
Open
fix: auto-detect 2-digit-year (M/D/YY) dates and datetimes (#36088)#1hidekoji wants to merge 1 commit into
hidekoji wants to merge 1 commit into
Conversation
The year-last date heuristic only accepted 4-digit years (consumeInteger(4, &year_) with exact=true, plus a year_ < 1000 guard), so M/D/YY values like 5/29/26 were guessed as character. Datetime auto-detection only handled ISO8601. - Add consumeYearFlexible(): consume a 2- or 4-digit year, applying the %y pivot (00-68 -> 2000s, 69-99 -> 1900s); reject 3-digit years. - parseYearLastHeuristic() + parseDateOrder() 'y' case route through it. - Add parseYearLastHeuristicDateTime() and wire it into guess_type isDateTime() and vroom_dttm.cc materialization as an ISO8601 fallback. - Extract disambiguateDayMonth() shared by both heuristics. - Add testthat coverage for 2-digit MDY/DMY/ambiguous dates, %y pivot, invalid/3-digit rejection, 2- and 4-digit MDY datetimes, and explicit date_order with 2-digit years. Bump version to 1.7.0.3. Ref: exploratory-io/tam#36088 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Author
|
Released as v1.7.0.3 (tagged off this branch head Base retargeted from |
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.
Problem
exploratory-io/tam#36088: dragging a CSV withM/D/YYdates (e.g.5/29/26) imports the date columns as character. The year-last date heuristic only accepted 4-digit years, and there was no year-last heuristic for datetimes.Fix
consumeYearFlexible(): consume a 2- or 4-digit year, applying the%ypivot (00-68→2000s, 69-99→1900s); reject 3-digit years.parseYearLastHeuristic()+parseDateOrder()'y'case route through it.parseYearLastHeuristicDateTime(); wire intoguess_type.cc isDateTime()andvroom_dttm.ccmaterialization as an ISO8601 fallback.disambiguateDayMonth()shared by both heuristics.Tests
testthat coverage for 2-digit MDY/DMY/ambiguous dates, the
%ypivot, invalid/3-digit rejection, 2- and 4-digit MDY datetimes, and explicitdate_orderwith 2-digit years. Existingtest-datetime.Rpasses with no regressions.Version → 1.7.0.3.
🤖 Generated with Claude Code