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 rust-dependencies group with 7 updates:
1.0.53
1.0.55
0.8.8
0.8.9
0.21.5
0.21.7
1.0.78
1.0.79
0.4.31
0.4.33
0.21.1
0.21.2
1.10.2
1.10.3
Updates
thiserror
from 1.0.53 to 1.0.55Release notes
Sourced from thiserror's releases.
Commits
6089273
Release 1.0.55322a2ae
Merge pull request #280 from dtolnay/depinfofd7d7a5
Emit dep-info for probe.rs in case sccache needs it447c328
Release 1.0.544619db8
Merge pull request #279 from dtolnay/depinfo7b53bff
Make env-dep:RUSTC_BOOTSTRAP get listed in probe's dep-infoe0500ad
Merge pull request #277 from dtolnay/nightlyci48cea47
Make CI verify that error_generic_member_access works in latest nightlyfe40a50
Merge pull request #276 from dtolnay/optionifletelseb97654a
Remove option_if_let_else clippy suppressionUpdates
toml
from 0.8.8 to 0.8.9Commits
f5c6f4b
chore: Release24e599e
docs: Update changelogd00d616
Merge pull request #670 from epage/span7e23971
fix(serde): Improve spans for empty tablesd5423f6
test(serde): Show bad span9db97b3
Merge pull request #668 from JustusAdam/patch-15381d7b
docs: Describe Table order based on concepts106d51f
test: Update compliance suite062e058
Merge pull request #665 from toml-rs/renovate/actions-setup-python-5.x0da2b51
Merge pull request #666 from toml-rs/renovate/github-codeql-action-3.xUpdates
base64
from 0.21.5 to 0.21.7Changelog
Sourced from base64's changelog.
Commits
9652c78
v0.21.708deccf
provide as_str() method to return the alphabet characters (#264)1cd75a1
v0.21.65820d9b
Merge pull request #263 from marshallpierce/silverlyra-usage97d9180
Merge branch 'usage' of github.com:silverlyra/rust-base64 into silverlyra-usageb64c624
Merge pull request #262 from tamird/clape32ca18
examples: replace structopt with clap72f25a8
Simplify the example program40e162c
Rewrite the crate docstringbfde751
Merge pull request #260 from marshallpierce/mp/doc-grammarUpdates
anyhow
from 1.0.78 to 1.0.79Release notes
Sourced from anyhow's releases.
Commits
71ab53d
Release 1.0.7960705a5
Merge pull request #340 from dtolnay/depinfo17e252b
Include env-dep:RUSTC_BOOTSTRAP in dep-info for sccache04774c0
Merge pull request #338 from dtolnay/nightlyci1fd290c
Make CI verify that error_generic_member_access works in latest nightlyee41470
RUSTC must be set by Cargo for build scriptUpdates
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)Updates
opentelemetry_sdk
from 0.21.1 to 0.21.2Release notes
Sourced from opentelemetry_sdk's releases.
Commits
ff64e21
Prepare for v0.21.2 release (#1463)164c13b
Fix max_scale validation of exponential histogram configuration (#1452)43cd4ac
Fix delta aggregation metric reuse (#1434)Updates
regex
from 1.10.2 to 1.10.3Changelog
Sourced from regex's changelog.
Commits
0c09903
1.10.3653bb59
deps: bump regex-automata to 0.4.4e7b5401
regex-automata-0.4.41bc667d
changelog: 1.10.3fbd2537
safety: guard in Input::new against incorrect AsRef implementations027eebd
cargo: set 'default-features = false' for memchr and aho-corasickdc0a9d2
ci: small clean-upsa3d5975
doc: fix link in Index<&str> impl docs4f5992f
doc: tweakCaptures
documentation837fd85
regex-cli-0.2.0Dependabot 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