boa-dev / temporal

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

Update duration rounding to new algorithms #65

Closed nekevss closed 4 months ago

nekevss commented 4 months ago

Currently a WIP.

This closes #19 outside of anything related to ZonedDateTime, which I'd prefer to consider separately due to the reliance on time zones.

This PR updates duration rounding to the new duration rounding algorithms.

As it's a bit of a larger PR, I thought I would create a draft in case anyone wants to take a look early.

Overall, this draft is fairly close to complete, but there are still at least a couple bugs around the actually rounding that I'm working through.

nekevss commented 4 months ago

This PR should definitely wait until after #66 is merged so it can be rebased to remove the custom traits, but it is essentially ready for review outside of that impending rebase

There are a couple things to note:

  1. This implements the new rounding methods under a round_v2 and doesn't remove the previous one just yet. It can be removed if everyone else thinks it should be in this PR, but I was sort of thinking about lagging on removing the previous methods while the rest is tested. Hopefully, it also makes the diff just a little bit easier to read.
  2. Any rounding around ZonedDateTime is not included in this, but it's hard to implement and test that without proper time zone support, so if everyone else is in agreement I'd prefer to file that under a new issue.
  3. We should probably file an issue for more unit tests around the internal nudge algorithms and normalization records.