Parse ISO 8601 dates in TankSalesRecord - #34
Merged
Conversation
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>
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
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_datewas 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) andTime.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
Date(.Time.parse— same approachTankReconciliationRecord#started_atalready uses.nilfor blank values instead of raisingNoMethodError.Testing
New
test/tank_sales_record_test.rbcovers ISO (with and without offset), legacy MS-JSON, the epoch-collapse regression, and blanks. Full suite: 109 runs, 0 failures.🤖 Generated with Claude Code