Skip to content

Add further format kinds #46

Closed

Description

@Mearman

format supported isoDateTime and numberText. Each kind has to be a bijection on its canonical form, which is what makes the round trip hold.

Decision: implement three kinds that are exact bijections on a stated canonical text, and treat any later kind as an ordinary feature rather than an open deferral. isoDate maps a YYYY-MM-DD calendar date to its UTC midnight in epoch milliseconds and renders the date part back; decode refuses an instant that is not a UTC midnight or falls outside four-digit years, so it never renders a date encode would not accept. Before this, a date-only input to isoDateTime decoded as a full timestamp and failed its own round trip. booleanText maps exactly "true" and "false" to booleans (an enum cannot, since it maps strings to strings). jsonText parses JSON text to the value it denotes and renders it with JSON.stringify, so the canonical input is JSON without whitespace outside strings; a __proto__ key anywhere in the parsed value is refused, because the output's JSON check would drop it silently.

Implemented in #56.

Activity

  1. added
    enhancementNew feature or request
    deferredDeliberately not built yet, with a trigger for revisiting
    on Oct 20, 2026
  2. added theissue type on Oct 20, 2026
  3. github-actions commented on Oct 21, 2026

    @github-actions

    🎉 This issue has been resolved in version 0.8.0 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    deferredDeliberately not built yet, with a trigger for revisitingenhancementNew feature or requestreleased

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions