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

Output fractional seconds in timestamp.to_rfc3339 function #14

Merged
merged 3 commits into from
Jan 21, 2025

Conversation

mooreryan
Copy link
Contributor

Output fractional seconds in timestamp.to_rfc3339 function.

I figured it may be best to avoid a method that divides the nanoseconds by 1 billion, then converts that float to a string using float.to_string, so that we can fully control the format. (E.g., it won't depend on any changes to how stdlib prints float strings or anything else like that.) And so, it uses that "digit arithmetic" method that you see.

Additionally, I mentioned needing to update some of the round-trip tests once the fractional seconds are printed by timestamp.to_rfc3339. This PR includes those test updates as well.

Now that `to_rfc3339` prints fractional seconds, allow generating timestamps with non-zero nanoseconds for round-trip tests.
@mooreryan
Copy link
Contributor Author

Original issue: #8

Copy link
Member

@lpil lpil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!!

@lpil lpil merged commit 0c97aec into gleam-lang:main Jan 21, 2025
1 check passed
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 this pull request may close these issues.

2 participants