1347 Commits

Author SHA1 Message Date
Paul Dicker
c892679e8d CI: run cargo-deadlinks for all features 2023-09-22 10:31:04 +02:00
Paul Dicker
a1a0f89dab Show arbitrary and unstable-locales features on docs.rs 2023-09-22 10:31:04 +02:00
Paul Dicker
7d2c9fc3f8 Switch docs.rs to auto_docs_cfg 2023-09-22 10:31:04 +02:00
Paul Dicker
c4fc4c4b75 Show rkyv support on docs.rs 2023-09-21 14:03:29 +02:00
Paul Dicker
5fc9be8800 Export Archived* types in rkyv module 2023-09-21 14:03:29 +02:00
Markus Legner
bc9d070227 improve doc comment and tests for timestamp_nanos_opt
- The doc comment for `DateTime::timestamp_nanos_opt` incorrectly
  described a panic, which is actually an error.
- The lower and upper limits of valid timestamps were not precise
  (both for `DateTime` and `NaiveDateTime` and both `timestamp_nanos`
  and `timestamp_nanos_opt`).
  This commit adds the precise limits to all methods and doctests for
  those limits to `DateTime::timestamp_nanos_opt`.
2023-09-18 10:54:14 +02:00
Paul Dicker
e730c6ac45 Bump version to 0.4.31 v0.4.31 2023-09-15 16:48:33 +02:00
Marco Neumann
2afdde8f7f fix: underflow during datetime->nanos conversion
Fixes #1289.
2023-09-15 14:51:10 +02:00
Paul Dicker
46ad2c2b2c Add UNIX_EPOCH constants 2023-09-15 12:20:28 +02:00
Eden Mikitas
1df8db3a54 Add TimeZone::timestamp_micros
Use NaiveDateTime::from_timestamp_micros instead of implementing
the same logic again.
2023-09-15 11:03:25 +02:00
Eden Mikitas
861d4e1248 Make TimeZone::timestamp_millis_opt use
NaiveDateTime::from_timestamp_millis to reduce code duplication
2023-09-15 11:03:25 +02:00
Jerko Steiner
3c4846a882 Upgrade pure-rust-locales to 0.7.0 2023-09-14 17:23:31 +02:00
Paul Dicker
6665804676 Deny leap second if secs != 59 in from_num_seconds_from_midnight_opt 2023-09-12 17:27:04 +02:00
Paul Dicker
61b7ffbb7a Deny leap second if secs != 59 in from_hms_nano_opt 2023-09-12 17:27:04 +02:00
Paul Dicker
202af6cfda Don't generate leap seconds that are not 60 in NaiveTime's Arbitrary impl 2023-09-12 17:27:04 +02:00
Paul Dicker
60283ab55c Don't create strange leap seconds in tests 2023-09-12 17:27:04 +02:00
Paul Dicker
03a12c7995 Change example for leap seconds not on the minute boundary 2023-09-12 17:27:04 +02:00
Paul Dicker
a174b8afad Deprecate timestamp_nanos 2023-09-12 14:50:10 +02:00
Paul Dicker
94ad32a40d Switch tests to timestamp_nanos_opt 2023-09-12 14:50:10 +02:00
Paul Dicker
6302624c43 Use timestamp_nanos_opt in serialization; add panic warning 2023-09-12 14:50:10 +02:00
Paul Dicker
310b60a48c Use timestamp_nanos_opt in duration_round and duration_trunc 2023-09-12 14:50:10 +02:00
Paul Dicker
08edc5ae93 Add DateTime::timestamp_nanos_opt 2023-09-12 14:50:10 +02:00
Paul Dicker
323f29aab1 Add NaiveDateTime::timestamp_nanos_opt 2023-09-12 14:50:10 +02:00
Paul Dicker
36ec37b1d1 Optimize NaiveDate::add_days for small values 2023-09-12 14:13:49 +02:00
Paul Dicker
d68f151b81 Add benchmark 2023-09-12 14:13:49 +02:00
Paul Dicker
084b021576
Format day in RFC 2822 without padding (#1272) 2023-09-11 10:34:27 +02:00
Charles Samborski
ccd3737bcc Add DateTime::<Utc>::from_timestamp
This commit adds the new constructor `from_timestamp` to build a `DateTime<Utc>` from a UNIX timestamp.

Figuring out how to convert a timestamp into a `DateTime<Utc>` was a common issue:
- https://github.com/chronotope/chrono/issues/88
- https://github.com/chronotope/chrono/issues/200
- https://github.com/chronotope/chrono/issues/832

This commit should make `DateTime<Utc>` creation more discoverable and intuitive.

This commit respects the current convention of preferring fallible functions. It avoids however the `_opt` suffix as there is no panicking variant. See [this issue](https://github.com/chronotope/chrono/issues/815) for discussion about error handling and panics.

Closes https://github.com/chronotope/chrono/issues/832
2023-09-11 10:32:18 +02:00
Paul Dicker
90a9913cf8 CI: remove exception for __doctest feature in cargo hack check 2023-09-11 09:22:50 +02:00
Paul Dicker
155e9da327 Make dependabot target 0.4.x branch 2023-09-11 09:22:50 +02:00
Paul Dicker
85d4f7f590 Bump actions/checkout from 3 to 4 2023-09-11 09:22:50 +02:00
Paul Dicker
2960f2c454 Remove __doctest feature 2023-09-09 11:33:17 +02:00
Paul Dicker
77d0bec82d Add more documentation about the RFC 2822 obsolete date format 2023-09-08 11:44:13 +02:00
Paul Dicker
101ca7e96d Bump version to 0.4.30 v0.4.30 2023-09-07 16:46:53 +02:00
Dirkjan Ochtman
eee59e373a Rewrite history sections for clarity and consistency 2023-09-07 13:14:53 +02:00
Paul Dicker
7387fe7aba Add history of chrono and time 0.1 to main documentation 2023-09-07 12:28:01 +02:00
Paul Dicker
8509da4979 Apply Clippy suggestions for duration module 2023-09-07 10:28:10 +02:00
Paul Dicker
9d7fafe69b Remove mention of oldtime from documentation 2023-09-07 10:28:10 +02:00
Paul Dicker
27ea7e9007 Rename oldtime module to duration 2023-09-07 10:28:10 +02:00
Paul Dicker
8f5becd277 Drop time 0.1 as optional dependency 2023-09-07 10:28:10 +02:00
Paul Dicker
f4aefc7f33 Clarify Timelike::num_seconds_from_midnight is a simple mapping 2023-09-06 17:04:30 +02:00
Paul Dicker
1903778a15 Add NaiveDate::leap_year 2023-09-06 17:02:01 +02:00
Truong Tan Dat
84334df989 Update readme 2023-09-06 16:20:56 +02:00
Paul Dicker
8509c25364 Bump version to 0.4.29 v0.4.29 2023-09-05 17:34:32 +02:00
Dirkjan Ochtman
d7444990b7 Add Discord link to README 2023-09-05 15:24:15 +02:00
Paul Dicker
2a96a795ca Deprecated TimeZone::datetime_from_str 2023-09-05 14:23:14 +02:00
Paul Dicker
754ad18ed3 Remove remaining uses of TimeZone::datetime_from_str() from tests and docs 2023-09-05 14:23:14 +02:00
Paul Dicker
935e7b5953 Parse to NaiveDateTime in parse_rfc850 test
The format string doesn't contain any offset info.
2023-09-05 14:23:14 +02:00
Paul Dicker
d56049f52a Move test_datetime_parse_from_str_with_spacesto naive::datetime 2023-09-05 14:23:14 +02:00
Paul Dicker
53b3f6bd57 Parse to NaiveDateTime in test_utc_datetime_from_str_with_spaces 2023-09-05 14:23:14 +02:00
Paul Dicker
5a6b2b40a7 Fix arbitrary string slicing in parse_rfc3339_relaxed 2023-09-05 09:16:15 +02:00