fix: auto-detect & materialize 2-digit-year (M/D/YY) dates and datetimes (#36088)#1
Open
hidekoji wants to merge 1 commit into
Open
fix: auto-detect & materialize 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
…times The year-last date heuristic only accepted 4-digit years, and the date collector never used it at all: CollectorGuess.cpp guessed year-last dates as "date", but CollectorDate::setValue used only parseLocaleDate(), so even 4-digit M/D/YYYY dates materialized to NA. Datetime auto-detection only handled ISO8601. - DateTimeParser.h: add consumeYearFlexible() (2- or 4-digit year, %y pivot 00-68->2000s / 69-99->1900s, reject 3-digit); route parseYearLastHeuristic() and parseDateOrder() 'y' case through it; add disambiguateDayMonth() and parseYearLastHeuristicDateTime(). - Collector.cpp: CollectorDate::setValue falls back to parseYearLastHeuristic when parseLocaleDate fails; CollectorDateTime::setValue falls back to parseYearLastHeuristicDateTime when parseISO8601 fails. - CollectorGuess.cpp isDateTime(): year-last datetime fallback after ISO8601. - Tests: 2-digit MDY/DMY dates, %y pivot, invalid/3-digit rejection, the 4-digit materialization regression, 2- and 4-digit MDY datetimes, and explicit date_order with 2-digit years. Bump version to 2.2.0.3. Ref: exploratory-io/tam#36088 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Author
|
Released as v2.2.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:M/D/YYdates (e.g.5/29/26) import as character. Two bugs:CollectorGuess.cppguessed year-last dates as"date", butCollectorDate::setValueused onlyparseLocaleDate()— so even 4-digitM/D/YYYYmaterialized toNA.Fix
DateTimeParser.h:consumeYearFlexible()(2/4-digit year,%ypivot, reject 3-digit); routeparseYearLastHeuristic()+parseDateOrder()'y'through it; adddisambiguateDayMonth()andparseYearLastHeuristicDateTime().Collector.cpp:CollectorDate::setValuefalls back toparseYearLastHeuristicwhenparseLocaleDatefails;CollectorDateTime::setValuefalls back toparseYearLastHeuristicDateTimewhenparseISO8601fails.CollectorGuess.cpp isDateTime(): year-last datetime fallback after ISO8601.Tests
2-digit MDY/DMY dates,
%ypivot, invalid/3-digit rejection, the 4-digit materialization regression, 2- and 4-digit MDY datetimes, explicitdate_order2-digit. Existingtest-parsing-datetime.R+test-collectors.Rpass.Version → 2.2.0.3.
🤖 Generated with Claude Code