fschutt / printpdf

A fully-featured PDF library for Rust, WASM-ready
https://fschutt.github.io/printpdf/
MIT License
829 stars 98 forks source link

Fix date on wasm32 #168

Closed dodomorandi closed 8 months ago

dodomorandi commented 8 months ago

In https://github.com/fschutt/printpdf/commit/bb2645e5845789009e6f9abc11489908bdf9314c I introduced a regression, because I did not notice that the OffsetDateTime is a partially polyfilled type when wasm32 is used.

This should fix the issue, improving the polyfill. Notice that the tests are not currently made to compile on wasm (because of the implementation of Date). This is doable, but at that point it is necessary to spin up a wasm runtime in order to run tests. Maybe for a future PR.

This is a breaking change, because I explicitly change the interface of OffsetDateTime in order to make it coherent with the time crate.

Closes #167