1089 Commits

Author SHA1 Message Date
Paul Dicker
eb927846b6 Add DateTime::fixed_offset 2023-05-15 16:10:59 +02:00
Paul Dicker
7bf98de158 [CI] Test rustdoc 2023-05-15 15:19:10 +02:00
Paul Dicker
d70eb453a9 Fix broken links 2023-05-15 15:19:10 +02:00
Paul Dicker
3b3432e94c Add link checker to CI 2023-05-15 15:19:10 +02:00
Paul Dicker
40ed3bf063 Update github actions 2023-05-15 15:19:10 +02:00
Paul Dicker
fc8513b88c [CI] Lint Windows target 2023-05-15 15:19:10 +02:00
Paul Dicker
5dd7961c86 No need to allow clippy::manual-non-exhaustive 2023-05-15 15:19:10 +02:00
Paul Dicker
e3f591fba3 Remove num-integer dependency 2023-05-15 13:02:13 +02:00
Paul Dicker
3bfb6abbbf Fix test_leap_second during DST transition 2023-05-15 11:39:47 +02:00
Paul Dicker
0367c76a9f Simplify from_timestamp_millis, from_timestamp_micros 2023-05-15 11:37:50 +02:00
Tormod Gjeitnes Hellen
2a6a07d967 Make eligible functions const. 2023-05-15 10:48:13 +02:00
jtmoon79
8fd7ca24bb cargo fmt updates
Run `cargo fmt`. Changes to `src/datetime/tests.rs`.
2023-05-15 10:48:13 +02:00
jtmoon79
1a233aa75d Constrain timezone parsing
Constrain timezone parsing further. Only allow optional colon
char `:` between timezone hour offset and timezone minute offset.

Issue #660
2023-05-15 10:48:13 +02:00
jtmoon79
f90d4037f0 Constrain timezone separator colon strings
Constrain timezone middle-colon separator string from
infinite intermixed whitespace and colons
to possible patterns `":"`, `" "`, `" :"`, `": "`, or `" : "`.
A reasonable trade-off of previous extreme flexibility for
a little flexbility and concise input.

Issue #660
2023-05-15 10:48:13 +02:00
jtmoon79
eb94e813d2 Add tests for timezone parsing whitespace and colon
Add tests for timezone parsing infinite whitespace and colons.

Prepatory tests for next commit around constraining timezone and
colons.
2023-05-15 10:48:13 +02:00
jtmoon79
1f45d8ed3f Exact whitespace parsing
Be exact about allowed whitespace around and between data and
parsing formats for all parsing.
Except RFC 2822 which explicitly allows arbitrary whitespace.

Issue #660
2023-05-15 10:48:13 +02:00
jtmoon79
bc58a7db52 Add various tests for current parsing
Add more varying testing for most parsing functions.
Tests emphasize whitespace, literals, timezones, and timezone
delimiters (colons and whitespace).

Add tests for multiple-byte characters and combining characters
in and around data and parsing formats.

These tests are added to aid humans verifying the next commit that
changes parsing behavior.

Issue #660
2023-05-15 10:48:13 +02:00
Paul Dicker
6655649e86 Gate test on clock feature 2023-05-12 10:06:02 +02:00
Paul Dicker
6a37b4c91e Use correct offset in conversion from Local to FixedOffset 2023-05-12 08:51:17 +02:00
Paul Dicker
595955c482 Add test for impl From<DateTime<Local>> for DateTime<FixedOffset> 2023-05-12 08:51:17 +02:00
Paul Dicker
38d9132bea Only run test on windows with clock feature 2023-05-12 08:50:07 +02:00
Paul Dicker
386f32705e [CI] Run tests with --no-default-features 2023-05-12 08:50:07 +02:00
Mahmoud Al-Qudsi
28b2200f4f Ignore unsupported doc tests under --no-default-features
There's no pretty way of gating doctests contingent on cfg
presence/absense so this is kind of ugly.

First, a doc comment `///` is converted into its equivalent
`#[doc(...)]`, which is then converted into a conditional rust attribute
via `#[cfg_attr(...)]`. We need two of these, one to ignore the tests if
the cfg predicate isn't met and another to indicate the start of a code
block and enable testing + syntax highlighting.
2023-05-12 08:50:07 +02:00
Paul Dicker
e0c4926841 Fix import 2023-05-12 08:50:07 +02:00
Paul Dicker
4ce9e830d8 Prevent bench_year_flags_from_year from being optimized out 2023-05-11 14:53:39 +02:00
pezcore
005ec07f45 add impl From<NaiveDateTime> for NaiveDate 2023-05-11 14:51:41 +02:00
Qiu Chaofan
8df1ba108f Fix tests on AIX
- Add AIX timezone database path to search list.
- Use date program from freeware to do the testing.
2023-05-11 13:56:12 +02:00
Dirkjan Ochtman
f87d548601 Remove unnecessary cast 2023-05-10 11:56:29 +02:00
Dirkjan Ochtman
1ab234fe5a Remove custom matches!() macro 2023-05-10 11:56:29 +02:00
Dirkjan Ochtman
64c3c2ba86 Allow clippy to take advantage of new MSRV 2023-05-10 11:56:29 +02:00
Dirkjan Ochtman
816f5bd48c Bump MSRV to 1.56 2023-05-10 11:56:29 +02:00
Paul Dicker
f6597197cd Fix panic in from_num_days_from_ce_opt 2023-05-08 14:04:33 +02:00
Paul Dicker
a20a9b7b90 Revert "Add with_timezone to NaiveDateTime"
This reverts commit e9067a5a3e684f1069f9d627e57ea7d536398e2e.
2023-05-08 09:29:53 +02:00
campbellcole
e3bca27a01 add documentation for %Z quirk 2023-05-07 09:24:09 +02:00
Paul Dicker
35b145bd0c Add #[track_caller] to LocalResult::unwrap 2023-05-04 10:28:51 +02:00
Paul Dicker
895d3b867f Fix warnings when running tests on Windows 2023-04-25 17:18:16 +02:00
Paul Dicker
84bbea5131 Add comment about non_exhaustive attributes 2023-04-18 17:40:49 +02:00
Paul Dicker
42943b7077 use iter::Copied (MSRV: 1.36) 2023-04-18 17:40:49 +02:00
Paul Dicker
6045377c75 Use rem_euclid from std (MSRV: 1.38) 2023-04-18 17:40:49 +02:00
Paul Dicker
93e2a91618 Add test for string slicing panic from issue 1010 2023-04-18 15:15:03 +02:00
Paul Dicker
a50648daf0 Prevent string slicing inside char boundaries 2023-04-18 15:15:03 +02:00
Paul Dicker
e9067a5a3e Add with_timezone to NaiveDateTime 2023-04-18 12:11:01 +02:00
Paul Dicker
c83f32e6ba Guard against overflow in NaiveDate::with_*0 methods 2023-04-18 12:09:32 +02:00
Paul Dicker
e51430f3e1 Add an example to Weekday 2023-04-18 12:00:55 +02:00
Paul Dicker
35eaac3446 Add test for issue 551 2023-04-18 11:59:25 +02:00
jtmoon79
5bc022ca81 RFC 2822 single-letter obsolete tests
Add follow-up tests to PR #1013

Link to RFC 2822 section.
2023-04-13 09:25:11 +02:00
Paul Dicker
5ecf30b36e Fix military timezones in RFC 2822 parsing 2023-04-12 14:35:34 +02:00
lukas
311d52eb91 Add #[must_use] to some methods 2023-04-03 15:31:59 +02:00
Philip Munksgaard
4e2c2b4ad2 Add PartialOrd derivation for Month
Also add a few tests to make sure it behaves as expected.
2023-03-31 13:01:06 +02:00
Kevin
1f1e2f8ff0
Refactor windows module in Local (#992) 2023-03-21 10:05:16 +01:00