Skip to content

$toMillis: >3 fractional-second digits throw raw java.time.DateTimeException instead of truncating to millis (jsonata 2.2.1) #438

Description

@wnm3

Surfaced while comparing JSONata4Java against the jsonata-js 2.2.1 test corpus during the Jackson 3 migration (#430 / PR #431). Pre-existing functional-compatibility gap vs the reference implementation (try.jsonata.org 2.2.1), not a migration regression.

$toMillis with a picture whose fractional-second component supplies more precision than milliseconds throws a raw java.time.DateTimeException instead of truncating to milliseconds like the reference.

Example:

$toMillis("2026-04-08T19:05:04.01987", "[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01].[f1]")
  • JSONata4Java: raw java.time.DateTimeException: Invalid value for NanoOfSecond (valid values 0 - 999999999): ...
  • jsonata.org 2.2.1: truncates sub-millisecond precision to milliseconds (round-trips to ...019Z).

Expected: truncate to millisecond precision (matching the reference) rather than leaking an internal java.time.DateTimeException.

Reference: jsonata-js 2.2.1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions