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

Properly marshal event time to RFC-3339 format #987

Open
Cali0707 opened this issue Nov 23, 2023 · 4 comments · May be fixed by #1017
Open

Properly marshal event time to RFC-3339 format #987

Cali0707 opened this issue Nov 23, 2023 · 4 comments · May be fixed by #1017

Comments

@Cali0707
Copy link
Contributor

In event_marshal.go, time.String() is currently used to marshal the time to a string:

if eventContext.Time != nil {
stream.WriteMore()
stream.WriteObjectField("time")
stream.WriteString(eventContext.Time.String())

However, in the go time.Time documentation, it says about the method time.Time.String():

The returned string is meant for debugging; for a stable serialized representation, use t.MarshalText, t.MarshalBinary, or t.Format with an explicit format string.

In the Spec, it is required that the time is serialized to RFC-3339, so we should be using time.Time.MarshalText instead

@duglin
Copy link
Contributor

duglin commented Jan 31, 2024

Or time.Format() with RFC3339 - wanna submit a PR?

@Cali0707
Copy link
Contributor Author

Happy to open a PR, but I know @MaryamTaj has been wanting to make some contributions so I'll see if she is interested in this one first :)

@MaryamTaj
Copy link

@duglin I would love to work on this!

@MaryamTaj MaryamTaj linked a pull request Feb 17, 2024 that will close this issue
@embano1
Copy link
Member

embano1 commented Feb 18, 2024

Commented in the PR to discuss whether this must be considered a breaking change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants