Skip to content

Keep Date parameter values when preparing solver downloads - #38

Open
ugin-man wants to merge 3 commits into
tscircuit:mainfrom
ugin-man:koyo/preserve-date-params-20260909
Open

Keep Date parameter values when preparing solver downloads#38
ugin-man wants to merge 3 commits into
tscircuit:mainfrom
ugin-man:koyo/preserve-date-params-20260909

Conversation

@ugin-man

@ugin-man ugin-man commented Sep 8, 2026

Copy link
Copy Markdown

The parameter cleaner used by Download JSON, Download page.tsx and Download test.ts treats Date instances as ordinary records. Object.entries(new Date(...)) is empty, so { start: new Date("2026-09-09T00:00:00Z") } becomes { start: {} } before JSON serialization instead of retaining the normal ISO timestamp.

Extract the existing pure cleaner into a small internal module and clone Date values before ordinary record traversal. Recursive underscore-key removal stays unchanged. Valid dates retain native ISO JSON output and invalid dates retain native JSON null behavior. This preserves timestamp values; it does not introduce a JSON Date reviver or promise instance-type round-tripping through generated source.

Seven tests cover root/nested/array dates, invalid dates, recursive internal-key removal, input immutability and primitive controls. The original DownloadDropdown.tsx source was verified against Git blob e5d0a6a96c71abaccc43ef7820ddaad95e77bb2b. Local Node 22.16.0 execution of the verbatim extracted original cleaner produced 4 failures / 3 passes; the patched helper passes all 7. Only the helper export/test-runner/import-path adaptations were needed, with no behavior mocks.

Upstream CI verification

At head 38b6c6bb540bd2f805089beace26bac11024950e, all three checks passed:

Base: a72b99f60680ffbe56a4c72e113ca52c9469921e. Download templates, React handlers and all non-Date cleanup behavior are otherwise unchanged. No browser-click or production-build validation is claimed. The separate constructor-argument template issue is reported in #39; it is not resolved by this change. Prepared with ChatGPT assistance and the account owner's authorization; no manual human review is claimed.

@vercel

vercel Bot commented Sep 8, 2026

Copy link
Copy Markdown

@ugin-man is attempting to deploy a commit to the tscircuit Team on Vercel.

A member of the Team first needs to authorize it.

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