In this release we shipped part of the effort to reduce the number of methods that could unexpectedly panic, notably for the DateTime and Duration types.
Chrono internally stores the value of a DateTime in UTC, and transparently converts it to the local value as required. For example adding a second to a DateTime needs to be done in UTC to get the correct result, but adding a day needs to be done in local time to be correct. What happens when the value is near the edge of the representable range, and the implicit conversions pushes it beyond the representable range? Many methods could panic on such inputs, including formatting the value for Debug output.
In chrono 0.4.32 the range of NaiveDate, NaiveDateTime and DateTime is made slightly smaller. This allows us to always do the implicit conversion, and in many cases return the expected result. Specifically the range is now from January 1, -262144 until December 31, 262143, one year less on both sides than before. We expect this may trip up tests if you hardcoded the MIN and MAX dates.
Duration had a similar issue. The range of this type was pretty arbitrary picked to match the range of an i64 in milliseconds. Negating an i64::MIN pushes a value out of range, and in the same way negating Duration::MIN could push it out of our defined range and cause a panic. This turns out to be somewhat common and hidden behind many layers of abstraction. We adjusted the type to have a minimum value of -Duration::MAX instead and prevent the panic case.
Other highlights:
Duration gained new fallible initialization methods.
Better support for rkyv.
Most methods on NaiveDateTime are now const.
We had to bump our MSRV to 1.61 to keep building with our dependencies. This will also allow us to make more methods on DateTime const in a future release.
Complete list of changes:
Fixes
Fix panic in TimeZone::from_local_datetime (#1071)
Fix out of range panics in DateTime getters and setters (#1317, #1329)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself)
- `@dependabot ignore minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself)
- `@dependabot ignore ` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore ` will remove all of the ignore conditions of the specified dependency
- `@dependabot unignore ` will remove the ignore condition of the specified dependency and ignore conditions
Bumps the all-dependencies group with 2 updates: serde and chrono.
Updates
serde
from 1.0.195 to 1.0.196Release notes
Sourced from serde's releases.
Commits
ede9762
Release 1.0.196d438c2d
Merge pull request #2682 from dtolnay/decimalpointbef110b
Format Unexpected::Float with decimal pointb971ef1
Merge pull request #2681 from dtolnay/workspacedeps29d9f69
Fix workspace.dependencies default-features future compat warningaecb408
Sort workspace dependencies1c675ab
Merge pull request #2678 from rodoufu/workspaceDependenciesdd61963
Adding workspace dependencies111803a
Merge pull request #2673 from Sky9x/msrv-badge0024f74
Use shields.io's MSRV badgesUpdates
chrono
from 0.4.31 to 0.4.33Release notes
Sourced from chrono's releases.
... (truncated)
Commits
7c419a3
Prepare 0.4.33 releasea9b37c4
Makerkyv
feature default tosize_32
a73b543
Don't assumerkyv-(16|32|64)
implies therkyv
featureb5381f8
Fixed typo in Duration::hours() exceptionbf70419
527757386
Prepare 0.4.32 releasecee242a
Fix typos in Datelike impl for DateTime6ec8f97
Add from_timestamp_millis to DateTime<Utc> (#1374)65f0cc2
CI Linting: Fix missing sources checkout intoml
job.5536687
Add Months::as_u32() (#1373)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show