-
Notifications
You must be signed in to change notification settings - Fork 21
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
Unable to parse 7 digit precision in the "time" field #46
Comments
Part of the issue with the precision comes from PHP's precision to 6 digits in versions less than 8. We'll look to get this reviewed by EOW with some internal team members and hopefully have a solution here. If you see more test cases you would like to add or account for, please go ahead and add code suggestions to the PR. I'll hold it open for a bit so you should have morning and early afternoon tomorrow to provide any feedback. |
Hm, I can only add that we're using PHP 8.1 and it doesn't work with more than 6 digits: https://3v4l.org/KYPtB#v8.1.18 |
Is 7 digits of precision common in the .net world? I'm wondering why they made that implementation decision. If all the other libraries don't use 7 digits, maybe the correct thing to do is to "fix" the dotnet implementation. That said, I suppose all other libraries should also truncate off the extra digits, for good interoperability with existing serialized events. |
Seems you're right. Don't quite know where I got the assumption of 9 digits now. The issue with the previous implementation is the usage of The benefit is that
This is a valid point, but I do think preferring support of the spec is most polite here. |
That's exactly how my workaround works. Your Denormalizer class is final so I couldn't extend it, but I'm creating a decorator like this:
And then, instead of calling If you want to switch to using |
Unfortunately, PHP 7.4 support requires the |
Oh, sorry, I completely forgot about 7.4 🤦 You're right, it needs to stay there for backwards compatibility. |
I didn't remember but the unit tests caught it for us. :) Sending this along now and will cut a release next week. Feel free to use mainline as a test until that's done. Thanks for your report, help, and patience here. |
I was searching for similar issue and found #35, but this SDK still can't parse 7 digit precision in the timestamp, for example
2023-04-12T12:50:04.2121108Z
Interestingly, the 7 digit precision comes from CloudEvents C# SDK. One would assume these SDKs would be compatible.
Can something be done about this? Right now, I have to write a custom Denormalizer class which parses the timestamp and formats it back to 6 digit precision, before passing it to the original (included) denormalizer.
The text was updated successfully, but these errors were encountered: