cesium icon indicating copy to clipboard operation
cesium copied to clipboard

JulianDate.toIso8601 builds a non compliant string with very small milliseconds

Open jfayot opened this issue 2 years ago • 3 comments

console.log(Cesium.JulianDate.toIso8601(Cesium.JulianDate.fromIso8601("2011-03-25T16:00:00.00000001Z"))

outputs:

2011-03-25T16:00:00.10000803740695119e-7Z

Which is not ISO8601 compliant !

In JulianDate.js, line 787, the comment says:

//Forces milliseconds into a number with at least 3 digits to whatever the default toString() precision is.

but toString will automatically convert the milliseconds into scientific notation when lower than 1e-6. number.toFixed is not appropriate neither, something more sophisticated needed here...

jfayot avatar Sep 06 '23 14:09 jfayot

Thanks for the report @jfayot!

We'd be happy to review a fix if you or anyone else has the bandwidth to contribute!

ggetz avatar Sep 06 '23 15:09 ggetz

can I take this please?

Alforoan avatar Aug 21 '24 19:08 Alforoan

can I take this please?

Sure !

jfayot avatar Aug 21 '24 20:08 jfayot

Here is a helpful Sandcastle demonstrating the problem, contributed by a community member.

jjhembd avatar Nov 11 '24 23:11 jjhembd