Skip to content

fix: auto-detect & materialize 2-digit-year (M/D/YY) dates and datetimes (#36088)#1

Open
hidekoji wants to merge 1 commit into
detect_slash_datetimefrom
fix/issue-36088-2digit-year
Open

fix: auto-detect & materialize 2-digit-year (M/D/YY) dates and datetimes (#36088)#1
hidekoji wants to merge 1 commit into
detect_slash_datetimefrom
fix/issue-36088-2digit-year

Conversation

@hidekoji

@hidekoji hidekoji commented Jun 1, 2026

Copy link
Copy Markdown

Problem

exploratory-io/tam#36088: M/D/YY dates (e.g. 5/29/26) import as character. Two bugs:

  1. The year-last date heuristic only accepted 4-digit years.
  2. CollectorGuess.cpp guessed year-last dates as "date", but CollectorDate::setValue used only parseLocaleDate() — so even 4-digit M/D/YYYY materialized to NA.

Fix

  • DateTimeParser.h: consumeYearFlexible() (2/4-digit year, %y pivot, reject 3-digit); route parseYearLastHeuristic() + parseDateOrder() 'y' 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, explicit date_order 2-digit. Existing test-parsing-datetime.R + test-collectors.R pass.

Version → 2.2.0.3.

🤖 Generated with Claude Code

…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>
@hidekoji hidekoji changed the base branch from master to detect_slash_datetime June 1, 2026 22:07
@hidekoji

hidekoji commented Jun 1, 2026

Copy link
Copy Markdown
Author

Released as v2.2.0.3 (tagged off this branch head 21e80e60 = v2.2.0.2 + the 2-digit-year fix), per tam#36088. Mac Intel+ARM binaries built from this tag are uploaded to download2 and referenced by tam PR exploratory-io/tam#36090.

Base retargeted from master (which predates the date_order feature) to detect_slash_datetime. Not auto-merging — branch reconciliation left to the maintainer. Windows binary still pending (build host offline).

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