ariebovenberg / whenever

⏰ Modern datetime library for Python, available in Rust or pure Python
https://whenever.rtfd.io
MIT License
834 stars 13 forks source link

Rounding #152

Open ariebovenberg opened 3 months ago

ariebovenberg commented 3 months ago

It'd make sense to be able to round datetimes in different ways:

The temporal API probably gives a big hint for doing this.

BurntSushi commented 3 months ago

Yeah, the Temporal API does indeed provide rounding APIs for datetime types. But what's even more useful, IMO, is rounding and re-balancing for durations. There are a lot of options availabe on, for example, ZonedDateTime.until that permit rounding the span returned or even choosing the "biggest" unit.

ariebovenberg commented 3 months ago

When it comes to re-balancing of durations, this issue is relevant as well: #108.