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

Incorrectly parsing input quasi UTC #24

Closed
sshaikh opened this issue May 25, 2019 · 5 comments
Closed

Incorrectly parsing input quasi UTC #24

sshaikh opened this issue May 25, 2019 · 5 comments

Comments

@sshaikh
Copy link

sshaikh commented May 25, 2019

I have been passed a string:

2019-05-25T15:30:42.526058+00:00

When passing this wholesale through the moment node I get this output:

2019-02-27T15:30:42.526Z

If I manipulate the string:

str.substring(0,23) + "Z"

That fixes it.

I'm posting the issue here primarily because I'm not sure how the moment node passes the string to the moment library, so am not sure where the bug is (if its a bug at all - the input timestamp does look legitimate enough).

@TotallyInformation
Copy link
Owner

TotallyInformation commented May 25, 2019

Hi, thanks for this. I need to test against MomentJS itself to see if this is an upstream bug or not.

A quick test shows that it is the 6th decimal place on the seconds value that causes the issue. Reduced to 5 is no problem. Will now test with raw moment.

@TotallyInformation
Copy link
Owner

TotallyInformation commented May 25, 2019

OK, got it. It is an upstream bug in moment-parseformat.

I use that so as to give the widest possible chance at parsing inputs in different formats.

But it produces weird outputs beyond 3dp:

fmt6dp parseFormat YYYY-MM-DDTHH:mm:ss.SSSDDDZ
fmt5dp parseFormat YYYY-MM-DDTHH:mm:ss.SSSDDZ

Reported upstream:

gr2m/moment-parseformat#96

But I'm not hopeful of a resolution since there are many other outstanding issues back to 2016.

@sshaikh
Copy link
Author

sshaikh commented May 25, 2019

Thanks for the investigation and the follow up!

@TotallyInformation
Copy link
Owner

Clearly the upstream author is not willing to fix this issue so I will add a work-around to limit the number of decimal places.

Added to backlog and a fix will be provided in an upcoming release.

@TotallyInformation
Copy link
Owner

Workaround added to next release.

TotallyInformation added a commit that referenced this issue Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

2 participants