1583 Commits

Author SHA1 Message Date
Paul Dicker
db1c8eff16 Guard against integer overflow in TzInfo::for_year 2024-03-08 14:54:48 +01:00
Paul Dicker
d40417fd1d Improve error checking in naive_date_time_from_system_time 2024-03-08 14:54:48 +01:00
Dirkjan Ochtman
bcb53864f7 Remove duplicate test 2024-03-07 10:03:43 +01:00
Erick Tryzelaar
e79fe2187d Remove unnessary Copy and Send impls
Fuchsia is doing an audit of chrono 0.4.34, and we noticed an unncessary
unsafe of `Send` for `DateTime`. While it's valid since `Tz::Offset` is
`Send`, and `NaiveDateTime` only has `u32` fields, there's a potential
hazard if `NaiveDateTime` ever grows unsendable fields (unlikely as that
is).

This (and the `Copy` impl) were added 9 years ago to fix #25, which
stemmed from early versions of associate traits not working properly
with auto-traits. This has since been fixed, and is no longer necessary
with the MSRV 1.61.0.
2024-03-07 06:55:25 +01:00
Paul Dicker
31145976e1 CI: Lint benchmarks 2024-03-06 19:36:50 +01:00
Paul Dicker
2d2f1a9670 Correct timestamp deprecation notes 2024-03-06 15:54:17 +01:00
Paul Dicker
9fdb59638e Prepare 0.4.35 v0.4.35 2024-03-06 14:25:00 +01:00
Paul Dicker
9e667b606e Deprecate panicking TimeDelta constructors 2024-03-06 14:04:55 +01:00
Paul Dicker
2c1b0bea94 Tests: replace TimeDelta::milliseconds with try_milliseconds 2024-03-06 14:04:55 +01:00
Paul Dicker
2bf3302ce5 Tests: replace TimeDelta::seconds with try_seconds 2024-03-06 14:04:55 +01:00
Paul Dicker
f93508ffd9 Tests: replace TimeDelta::minutes with try_minutes 2024-03-06 14:04:55 +01:00
Paul Dicker
9fc931a394 Tests: replace TimeDelta::hours with try_hours 2024-03-06 14:04:55 +01:00
Paul Dicker
9f23c08e10 Tests: replace TimeDelta::days with try_days 2024-03-06 14:04:55 +01:00
Paul Dicker
e8f9b5e041 Tests: replace TimeDelta::weeks with try_weeks 2024-03-06 14:04:55 +01:00
Paul Dicker
51a1aa27bd Tests: use Days type when it is more appropriate than TimeDelta 2024-03-06 14:04:55 +01:00
Paul Dicker
4251bd1eb1 Replace TimeDelta::seconds with try_seconds 2024-03-06 14:04:55 +01:00
Paul Dicker
073c3c32f0 Replace TimeDelta::days with try_days 2024-03-06 14:04:55 +01:00
Paul Dicker
383fcff56c Use simplified resolve_week_date 2024-03-06 14:04:55 +01:00
Paul Dicker
d7e5853949 Use checked_add_days in NaiveDateWeeksIterator 2024-03-06 14:04:55 +01:00
Paul Dicker
5caa640f0f Documentation fixes 2024-03-06 14:04:55 +01:00
Paul Dicker
90dbd75d0d Hide fields on Parsed in preparation of making them private with 0.5 2024-03-06 14:01:32 +01:00
Paul Dicker
ba4e50c8f2 Add getters to Parsed 2024-03-06 14:01:32 +01:00
Paul Dicker
40724008b2 Add range checks to the Parsed::set_* methods 2024-03-06 14:01:32 +01:00
dependabot[bot]
f4adc28dce Update windows-bindgen requirement from 0.53 to 0.54
Updates the requirements on [windows-bindgen](https://github.com/microsoft/windows-rs) to permit the latest version.
- [Release notes](https://github.com/microsoft/windows-rs/releases)
- [Commits](https://github.com/microsoft/windows-rs/compare/0.53.0...0.54.0)

---
updated-dependencies:
- dependency-name: windows-bindgen
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-04 07:34:48 +01:00
Paul Dicker
0aa46ddbf0 Sync Datelike docs 2024-03-01 11:52:26 +01:00
Paul Dicker
1d3da21ae2 Add comment to calculate UNIX_EPOCH_DAY 2024-03-01 11:52:09 +01:00
Paul Dicker
83573a8b30 Deprecate timestamp methods on NaiveDateTime 2024-03-01 11:52:09 +01:00
Paul Dicker
585d48be38 Don't use timestamp methods from NaiveDateTime in serde module 2024-03-01 11:52:09 +01:00
Paul Dicker
392e0dd460 Don't use timestamp methods from NaiveDateTime 2024-03-01 11:52:09 +01:00
Paul Dicker
39f9a97b9b Translate timestamp tests to DateTime 2024-03-01 11:52:09 +01:00
Paul Dicker
27a1ee4cdc Move implementation of from_timestamp* to DateTime 2024-03-01 11:52:09 +01:00
Paul Dicker
0c23fd4df5 Move implementation of timestamp* to DateTime 2024-03-01 11:52:09 +01:00
Paul Dicker
1c1feca6fa Use UNIX_EPOCH in NaiveDateTime::default() 2024-03-01 11:52:09 +01:00
Paul Dicker
774951ff3d Add DateTime::{from_timestamp_micros, from_timestamp_nanos} 2024-03-01 11:52:09 +01:00
Paul Dicker
ca51f694bb Make with_year return Some if it is a no-op 2024-02-29 13:16:43 +01:00
Paul Dicker
43675f162c Use overflowing_naive_local in checked_(add|sub)_days 2024-02-29 13:16:43 +01:00
Paul Dicker
06bd82cccf Extend fast path in NaiveDate::add_days 2024-02-29 13:16:43 +01:00
Paul Dicker
dd201649b5 Use overflowing_naive_local in checked_(add|sub)_months 2024-02-29 13:16:43 +01:00
Paul Dicker
e292d9bc90 Simplify from_isoywd a bit 2024-02-27 16:04:18 +01:00
Paul Dicker
a6c0c6425c Check for invalid cast 2024-02-27 15:37:31 +01:00
Paul Dicker
bbdc332958 Simplify SerdeError 2024-02-27 15:37:31 +01:00
Paul Dicker
0b68d19a3e Move serde_from and SerdeError to crate::serde inline module 2024-02-27 15:37:31 +01:00
Paul Dicker
85c70ffad9 Improve documentation of Parset::to_* 2024-02-27 15:32:37 +01:00
Paul Dicker
48f05499d6 Return correct error in Parsed::to_fixed_offset 2024-02-27 15:32:37 +01:00
Paul Dicker
e9e9adf622 Improve documentation of Parsed::set_* 2024-02-27 15:32:37 +01:00
Paul Dicker
a8908b4428 Expand Parsed documentation 2024-02-27 15:32:37 +01:00
Paul Dicker
9efa85d9b6 Return IMPOSSIBLE if year fields don't match 2024-02-27 15:32:37 +01:00
Paul Dicker
b882f58fa4 Simplify error value of parse_internal 2024-02-26 11:15:33 +01:00
Paul Dicker
8fcad1fda9 Update windows-bindgen to 0.53 2024-02-26 10:36:48 +01:00
Ed Morley
81d58e05f7 Improve docs for crate features
The `chrono` crate makes use of several Cargo features:
02c68d69a1/Cargo.toml (L19-L46)

These features are documented in both `README.md` and the rustdocs
in `lib.rs, however, the lists in each place were missing some features
and also inconsistent in their descriptions.

I've also removed the unused `[wasm-bindgen]` link definition.

Fixes #1434.
2024-02-26 08:43:05 +01:00