Skip to content

Commit

Permalink
span: deprecate silent "days are 24 hours" in some cases
Browse files Browse the repository at this point in the history
This does make _some_ use cases a bit more annoying, but I think it
overall makes the API more consistent. Essentially, unless
`SpanRelativeTo::days_are_24_hours` are provided, then Jiff will always
consider days to be a variable unit like weeks, months and years.
Previously, this would only happen _some_ of the time.

For now, when that assumption is silently made, Jiff will emit a
deprecation warning. This will turn into a hard error in `jiff 0.2`.

Ref #48
  • Loading branch information
BurntSushi committed Jan 21, 2025
1 parent 709a5b6 commit 9f4793a
Show file tree
Hide file tree
Showing 4 changed files with 369 additions and 91 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ have been deprecated in favor of `in_tz`.
* [#32](https://github.com/BurntSushi/jiff/issues/32):
The `Eq` and `PartialEq` trait implementations on `Span` have been deprecated
in favor of using the new `SpanFieldwise` type.
* [#48](https://github.com/BurntSushi/jiff/issues/48):
Silently assuming days are always 24 hours in some `Span` APIs has now been
deprecated. This will become an error in `jiff 0.2`. To continue assuming
days are 24 hours without a relative reference date, you can use the new
`SpanRelativeTo::days_are_24_hours` API. In `jiff 0.1`, you'll seen a
WARN-level log message emitted if you're code will be broken by `jiff 0.2`.


0.1.24 (2025-01-16)
Expand Down
Loading

0 comments on commit 9f4793a

Please sign in to comment.