Skip to content

fix: preserve string-typed invoice dates during deserialization#811

Open
miachillgood wants to merge 1 commit into
XeroAPI:masterfrom
miachillgood:codex/preserve-string-dates
Open

fix: preserve string-typed invoice dates during deserialization#811
miachillgood wants to merge 1 commit into
XeroAPI:masterfrom
miachillgood:codex/preserve-string-dates

Conversation

@miachillgood

Copy link
Copy Markdown

Summary

  • stop deserializing string-typed accounting fields into Date objects
  • preserve invoice date and dueDate exactly as string values when the model type says string
  • add regression coverage for invoice deserialization

Why

Issue #746 reports that paged invoice responses populate Invoice.date and Invoice.dueDate as runtime Date objects even though the SDK model types declare them as string. The root cause is the generic accounting deserializer special-casing /Date(...) string values and converting them to Date even when the target field type is string.

Keeping string-typed fields as strings preserves the declared TypeScript contract and avoids implicit timezone interpretation on date-only values.

Validation

  • npm test -- --runInBand
  • npm run build

Closes #746

@miachillgood miachillgood marked this pull request as ready for review June 12, 2026 11:40
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.

The "date" property on returned invoices has a TypeScript type of "string" but is in fact a "Date"

1 participant