IBM / JSONata4Java

Open Source Java version of JSONata
Apache License 2.0
88 stars 36 forks source link

Backport: Picture string with ordinal not parsed correctly #310

Open uw4 opened 1 month ago

uw4 commented 1 month ago

A user of the jsonata-java lib (see #275) fixed this issue in $toMillis (a logic error): https://github.com/dashjoin/jsonata-java/issues/42

The original (one line) fix is in this pull request https://github.com/dashjoin/jsonata-java/pull/41 and the test case is here https://github.com/dashjoin/jsonata-java/blob/5ba7416e1dd822444e2fa50fea3fe32453a9acf3/src/test/java/com/dashjoin/jsonata/DateTimeTest.java

As we are based on the same impl DateTimeUtils.analyseDateTimePicture is also affected.

Original issue:

Expression:

$toMillis('2018th', '[Y0001;o]')

Expected output

1514764800000

Actual output

index out of bounds exception