1376 Commits

Author SHA1 Message Date
Paul Dicker
0032431491 Remove obsolete overflow check 2023-09-26 17:44:20 +02:00
Paul Dicker
cf62e4648c Fix panic in default impl of TimeZone::from_local_datetime 2023-09-26 17:44:20 +02:00
Paul Dicker
652bd7842a Document Add and Sub impls of DateTime 2023-09-26 16:46:12 +02:00
Paul Dicker
353a29e4ed Consistently document Add and Sub impls of NaiveDateTime 2023-09-26 16:46:12 +02:00
Paul Dicker
ea45eeded7 Document Add and Sub impls of NaiveTime 2023-09-26 16:46:12 +02:00
Paul Dicker
e3091d1b3e Consistently document Add and Sub impls of NaiveDate 2023-09-26 16:46:12 +02:00
Paul Dicker
78230395a6 Move doc comments from method to trait (for consistency) 2023-09-26 16:46:12 +02:00
Paul Dicker
483da3b834 Clamp std::time::Duration before converting to prevent panic 2023-09-26 16:46:12 +02:00
Paul Dicker
f0c62b4494 Use expect instead of unwrap in Add and Sub impls 2023-09-26 16:46:12 +02:00
Paul Dicker
be8f2fd31d Update deny.toml 2023-09-26 15:05:40 +02:00
jtmoon79
e116f5c101 tests with date command set env LC_ALL
For tests calling `date` Unix tool, also set
environment variable `LC_ALL=c` to make more sure to
avoid locality problems.
2023-09-26 12:06:06 +02:00
Paul Dicker
d450b68b83 Use checked_(add|sub)_offset in Add and Sub impls of DateTime 2023-09-25 14:18:46 +02:00
Paul Dicker
b1473c4e39 Move Add and Sub impls for Fixedoffset to datetime modules 2023-09-25 14:18:46 +02:00
Paul Dicker
c836a1f93c Move Add and Sub impls to naive::datetime 2023-09-25 13:21:48 +02:00
Paul Dicker
a49eb9d80f Use checked_(add|sub)_offset in Add and Sub impls 2023-09-25 13:21:48 +02:00
Paul Dicker
3bcd73c684 Add NaiveDateTime::checked_(add|sub)_offset 2023-09-25 13:21:48 +02:00
Paul Dicker
0953e4a89c Also report correct ordinal in test_date_bounds 2023-09-25 10:10:35 +02:00
Paul Dicker
b18e663a27 Fix *_DAYS_FROM_YEAR_0 calculation 2023-09-25 10:10:35 +02:00
Paul Dicker
a47e0e3c16 Move Add and Sub impls to naive::time module 2023-09-23 14:33:46 +02:00
Paul Dicker
00fa07baa1 Use overflowing_(add|sub)_offset in Add and Sub impls 2023-09-23 14:33:46 +02:00
Paul Dicker
b5cdcc66fb Add NaiveTime::overflowing_(add|sub)_offset 2023-09-23 14:33:46 +02:00
Paul Dicker
4d28a89325 Remove format::{format_localized, format_item_localized} 2023-09-23 14:33:14 +02:00
Paul Dicker
68a141eba0 Don't make unstable-locales depend on alloc feature 2023-09-23 13:12:21 +02:00
Paul Dicker
bfc7b26239 Make std imply alloc feature 2023-09-23 13:12:21 +02:00
Paul Dicker
45f1a4d554 Add benchmark for DateTime::with_* 2023-09-23 12:46:32 +02:00
Paul Dicker
41e34aded4 Deprecate standalone format* functions 2023-09-22 13:35:37 +02:00
Paul Dicker
b48bb3a4ba Move formatting from standalone functions to Display impl 2023-09-22 13:35:37 +02:00
Paul Dicker
bbec5318cc Import fmt::core::Display 2023-09-22 13:35:37 +02:00
Ihor Ranchynskyi
a32d77acb0
duplicate derives on ArchivedT types (for rkyv feature) (#1271)
Duplicate derives for `ArchiveT` types for `rkyv` feature
2023-09-22 13:02:15 +02:00
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