Skip to content

Parse ISO 8601 dates in TankSalesRecord - #34

Merged
kylekeesling merged 1 commit into
masterfrom
fix-tank-sales-iso-dates
Aug 25, 2026
Merged

Parse ISO 8601 dates in TankSalesRecord#34
kylekeesling merged 1 commit into
masterfrom
fix-tank-sales-iso-dates

Conversation

@kylekeesling

Copy link
Copy Markdown
Member

Problem

Tank sales records synced from the current MyTankInfo host all land with starts_at/ends_at = 1970-01-01 00:00:02 UTC.

parse_ms_json_date was written for the legacy host's MS-JSON format (/Date(1620792000000)/): it extracts the first digit run and treats it as milliseconds. The current host returns ISO 8601 strings ("2026-08-25T02:14:30"), so the regex grabs the year (2026) and Time.at(2.026) yields the epoch.

In PASS Tools this made every synced sales row invisible to the date-filtered Tank Sales Report (H.N. Funkhouser, Basecamp card 10236942673).

Fix

  • Apply the millisecond parse only when the value contains Date(.
  • Parse everything else with Time.parse — same approach TankReconciliationRecord#started_at already uses.
  • Return nil for blank values instead of raising NoMethodError.

Testing

New test/tank_sales_record_test.rb covers ISO (with and without offset), legacy MS-JSON, the epoch-collapse regression, and blanks. Full suite: 109 runs, 0 failures.

🤖 Generated with Claude Code

The legacy host returned MS-JSON dates ("/Date(1620792000000)/"). The
current host returns ISO 8601 strings ("2026-08-25T02:14:30"). The old
parser extracted the first digit run from the string — the year — and
produced 1970-01-01 00:00:02 UTC for every record.

Keep the millisecond parse for MS-JSON values. Parse everything else
with Time.parse. Return nil for blank values.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@kylekeesling
kylekeesling merged commit a796c44 into master Aug 25, 2026
5 checks passed
@kylekeesling
kylekeesling deleted the fix-tank-sales-iso-dates branch August 25, 2026 15:52
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