ariebovenberg / whenever

⏰ Modern datetime library for Python
https://whenever.rtfd.io
MIT License
904 stars 15 forks source link

Rounding #152

Open ariebovenberg opened 4 months ago

ariebovenberg commented 4 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 4 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 4 months ago

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