matsadler / magnus

Ruby bindings for Rust. Write Ruby extension gems in Rust, or call Ruby from Rust.
https://docs.rs/magnus/latest/magnus/
MIT License
682 stars 35 forks source link

Add support for chrono::DateTime<T> #114

Closed emwalker closed 4 months ago

emwalker commented 4 months ago

Draft PR to add support for converting to and from chrono::DateTime<Utc> and chrono::DateTime<FixedOffset> timestamps. Related discussion. I'm out of my depth here both with respect to the Ruby C API and with respect to usage of chrono, so additional diligence might be needed.

I am not attached to this PR at all. With support for nanosecond precision recently added (still to be tested on our side), it is possible that we will not need chrono.

emwalker commented 4 months ago

similar to how bytes get a footnote calling out that it requires a feature:

Given how the table is already a pretty cramped, it seemed like four **** might be a bit much. I took the liberty of converting the footnotes to GitHub Markdown's footnotes. Let me know if you would like me to revert to the four asterisks.

2024-07-22_16-45-footnotes

Unfortunately, the footnotes appear at the bottom of the page instead of the table:

2024-07-22_16-46-footnotes

matsadler commented 4 months ago

it seemed like four **** might be a bit much. I took the liberty of converting the footnotes to GitHub Markdown's footnotes. ... Unfortunately, the footnotes appear at the bottom of the page...

You're right, **** is a bit much. Probably the *** that was already there was a bit much.

I didn't know about markdown footnotes, that's neat. The readme is also rendered on crates.io, but I checked and that supports footnotes too.

However I think the way it adds them to the bottom of the page is a dealbreaker for me, especially with such a long page.

Maybe we could use *, †, ‡, §, ||, and ¶ instead of ever more asterisks?

emwalker commented 4 months ago

Updated.

In typesetting, I think the symbols would be used in order of *, †, ‡, §, ||, and ¶ as footnote references are encountered in the table, and then the footnotes themselves would be sorted in that order, in contrast to what I just did. The symbols would also be superscripts, both in the references and in the footnotes. But I didn't want to get fancy. I'm sure you'll update it to something nice.

matsadler commented 4 months ago

This is great, thanks!