boa-dev / temporal

A Rust implementation of ECMAScript's Temporal API
Apache License 2.0
26 stars 4 forks source link

Implement `Duration::round` and some general updates/fixes #24

Closed nekevss closed 9 months ago

nekevss commented 9 months ago

Currently a WIP. EDIT: this is ready for review!

This PR is to implement Duration::round along with some other updates and ideally basic tests as well. The hope is to have this implemented and tested so that it can be used to switch over the internal duration slots from f64 to i32. 😄

A couple notes:

  1. I ended up switching rounding back to f64 for now / this PR. It had been u64, and my goal for the next PR is to head back in that direction. The truncation of values between integer types was causing some havoc and making debugging more difficult than it needed to be while dealing with round.
  2. Currently, the only testing is for floor rounding, but this can be added to if desired.