Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jfayot opened this issue Sep 6, 2023 · 4 comments · May be fixed by #12345
Open

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

jfayot opened this issue Sep 6, 2023 · 4 comments · May be fixed by #12345
Labels

Comments

@jfayot
Copy link
Contributor

jfayot commented Sep 6, 2023

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 jfayot changed the title JulianDate.toIso8601 builds a non compliant string with very small millseconds JulianDate.toIso8601 builds a non compliant string with very small milliseconds Sep 6, 2023
@ggetz ggetz added type - bug category - architecture / api good first issue An opportunity for first time contributors labels Sep 6, 2023
@ggetz
Copy link
Contributor

ggetz commented Sep 6, 2023

Thanks for the report @jfayot!

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

@Alforoan
Copy link

can I take this please?

@jfayot
Copy link
Contributor Author

jfayot commented Aug 21, 2024

can I take this please?

Sure !

@jjhembd
Copy link
Contributor

jjhembd commented Nov 11, 2024

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

jfayot added a commit to jfayot/cesium that referenced this issue Nov 28, 2024
…mpliant string with very small milliseconds)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment