Using this a picture and date with a more precise format then 3 digits returns an invalid timestamp.
While not using a picture returns the correct timestamp.
$toMillis("2026-04-08T19:05:04.94756", "[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01].[f1]")
Will return 1775675198756 (2026-04-08T19:06:38.756Z)
While it should 1775667904947 (2026-04-08T17:05:04.947Z)
This will happen if you use fractional precision. [f1], or specifying the decimals f[00001].
Code snippet
const JSONata = require("jsonata");
const inputData = "2026-04-08T19:05:04.94756"; // Change timestamp
let mapping = `$toMillis($, "[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01].[f1]")`; // change or remove picture
(async () => {
const expression = JSONata(mapping);
const transformedData = await expression.evaluate(inputData);
const dDate = new Date(transformedData);
console.log(`input :${inputData}`);
console.log(`timestamp :${transformedData}`);
console.log(`date :${dDate.toISOString()}`);
})();
Using this a picture and date with a more precise format then 3 digits returns an invalid timestamp.
While not using a picture returns the correct timestamp.
Will return 1775675198756 (2026-04-08T19:06:38.756Z)
While it should 1775667904947 (2026-04-08T17:05:04.947Z)
This will happen if you use fractional precision. [f1], or specifying the decimals f[00001].
Code snippet