Skip to content

fix: handle Option<NaiveDate> when serializing end_date#70

Open
MackDing wants to merge 1 commit intoPolymarket:mainfrom
MackDing:fix/issue-65
Open

fix: handle Option<NaiveDate> when serializing end_date#70
MackDing wants to merge 1 commit intoPolymarket:mainfrom
MackDing:fix/issue-65

Conversation

@MackDing
Copy link
Copy Markdown

@MackDing MackDing commented Apr 29, 2026

Fixes #65

p.end_date is Option<NaiveDate> so calling .to_string() directly fails to compile on stable Rust.

Verified with cargo check (0 errors).


Note

Low Risk
Small, localized change to JSON formatting for a single field; main impact is that missing end_date now serializes as null instead of failing to compile.

Overview
Fixes JSON serialization for Position.end_date in print_positions by converting it with Option::map instead of calling .to_string() directly.

This makes end_date emit as either a string date or null in the JSON output and restores compilation on stable Rust when end_date is Option<NaiveDate>.

Reviewed by Cursor Bugbot for commit 85494cc. Bugbot is set up for automated code reviews on this repo. Configure here.

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.

Compile error on HEAD: Option<NaiveDate>::to_string() in src/output/data.rs:84

2 participants