Repository navigation
Release v7.19.3
Closes #1123.
The defect
DateOnly and TimeOnly both render the ISO-8601 form from toString(), but neither defined toJSON(). JSON.stringify only calls toJSON() when it exists, so it fell back to enumerating the instance properties:
JSON.stringify({ date: DateOnly.from(2026, 8, 30) })
// before: {"date":{"year":2026,"month":8,"day":30}}
// after: {"date":"2026-08-30"}How it surfaced
Arc for Kotlin sends RFC QUERY argument bodies through JSON.stringify, so query arguments of these types arrived at a JVM endpoint as component objects where a scalar ISO string was expected, and failed to bind. The GET path was never affected: it goes through String(value) and therefore toString().
Guid in this same package already defines toJSON(), and both new methods follow that precedent by delegating to the existing toString().
Change
Source/JavaScript/DateOnly.ts— addtoJSON()Source/JavaScript/TimeOnly.ts— addtoJSON(), preserving the fractional part when present- specs for both, covering the direct value, agreement with
toString(), and the serialized object form
No behaviour changes for any other path; toString() is untouched.
Verification
vitest run in Source/JavaScript: 114 files, 468 tests, all passing.