1478 Commits

Author SHA1 Message Date
Paul Dicker
0ef34e4da3 Extend test to more distant dates 2024-02-10 19:37:55 +01:00
Paul Dicker
fc67f3e6e0 Remove obsolete test 2024-02-10 19:37:55 +01:00
Paul Dicker
acb693ac64 Windows: rewrite using GetTimeZoneInformationForYear
And add test against previous implementation
2024-02-10 19:37:55 +01:00
Paul Dicker
5fb4fabd13 Add test for localized formatting of %X 2024-02-10 19:04:57 +01:00
Paul Dicker
73388ca42a Update pure-rust-locales to 0.8.0 2024-02-10 19:04:57 +01:00
Paul Dicker
ded9fe1585 Move TOO_LONG error out of parse_internal 2024-02-09 12:00:44 +01:00
Paul Dicker
42db00a981 Remove incomplete parsing support for -0000 offset 2024-02-07 13:36:44 +01:00
Paul Dicker
9c07a015df Make range check more accurate, and add comment why it is not useless 2024-02-07 13:36:44 +01:00
Paul Dicker
51cb026a58 Replace 86_400 with MAX_RFC3339_OFFSET 2024-02-07 13:36:44 +01:00
Georgi Krastev
5656a9ed67 Add a test for duration_round close to min / max 2024-02-07 12:28:22 +01:00
Georgi Krastev
8eb92d96c4 Replace DurationExceedsTimestamp example with a note. 2024-02-07 12:28:22 +01:00
Georgi Krastev
c1f04222ca Remove check for DurationExceedsTimestamp
This check is not necessary and prevented rounding and truncation
from working correctly on timestamps close to the Unix epoch.
2024-02-07 12:28:22 +01:00
Paul Dicker
ef9a4c9539 Sync with 0.5 branch 2024-02-05 14:59:17 +01:00
Paul Dicker
ce97c2ef52 TimeDelta is not a full ISO 8601 duration 2024-02-05 12:31:46 +01:00
Paul Dicker
32fa222144 Update main documentation 2024-02-05 12:31:46 +01:00
Paul Dicker
ec7fc642b7 Rename duration module to time_delta 2024-02-05 12:31:46 +01:00
Paul Dicker
ac383d5303 Rename Duration to TimeDelta in duration module, flip type alias 2024-02-05 12:31:46 +01:00
Paul Dicker
6da68c8d04 Rename remaining uses of Duration to TimeDelta 2024-02-05 12:31:46 +01:00
Paul Dicker
3a9d8a3a3c Rename Duration to TimeDelta in date module 2024-02-05 12:31:46 +01:00
Paul Dicker
3bd9a90e91 Rename Duration to TimeDelta in round module 2024-02-05 12:31:46 +01:00
Paul Dicker
20e9a73aa3 Rename Duration to TimeDelta in naive::date module 2024-02-05 12:31:46 +01:00
Paul Dicker
04050b85f1 Rename Duration to TimeDelta in naive::time module 2024-02-05 12:31:46 +01:00
Paul Dicker
b28c59c401 Rename Duration to TimeDelta in naive::datetime module 2024-02-05 12:31:46 +01:00
Paul Dicker
d079c8c032 Rename Duration to TimeDelta in datetime module 2024-02-05 12:31:46 +01:00
Paul Dicker
6659f7b9eb Add TimeDelta as type alias of Duration 2024-02-05 12:31:46 +01:00
dependabot[bot]
f4b47013ed Bump codecov/codecov-action from 3 to 4
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3 to 4.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-05 11:50:42 +01:00
Paul Dicker
ae695a412c Fix check for nanos in Duration::new 2024-02-04 19:20:01 +01:00
Paul Dicker
f848876248 Make Duration::new public 2024-02-04 19:20:01 +01:00
Paul Dicker
b92b736f52 Set main branch as dependabot target 2024-02-02 14:10:19 +01:00
Paul Dicker
6f06e1ab0e Make methods on DateTime const where possible 2024-02-02 09:51:57 +01:00
Paul Dicker
fd66791996 Make remaining methods on NaiveDateTime const 2024-02-01 21:29:28 +01:00
Paul Dicker
f78eb20ef1 Make NaiveTime::overflowing_sub_signed const 2024-02-01 21:29:28 +01:00
Paul Dicker
e56f9c5797 Simplify NaiveTime::overflowing_add_signed and make const 2024-02-01 21:29:28 +01:00
Paul Dicker
4836953431 Make NaiveTime::signed_duration_since const 2024-02-01 21:29:28 +01:00
Paul Dicker
912cc63602 Make remaining methods on NaiveDate const 2024-02-01 21:29:28 +01:00
Paul Dicker
45785b58d3 Make methods on NaiveWeek const 2024-02-01 21:29:28 +01:00
Paul Dicker
7cc4ce89ea Make DateTime<Utc>::from_timestamp const 2024-02-01 21:29:28 +01:00
Scott Driggers
d7afd72da5 Add test_duration_const() 2024-02-01 21:29:28 +01:00
Paul Dicker
7c4bf0b578 Make all methods on Duration const 2024-02-01 21:29:28 +01:00
Paul Dicker
a14b16071f Add Duration::new 2024-02-01 21:29:28 +01:00
Paul Dicker
086a26b020 Remove duplicate try_opt macro 2024-02-01 21:29:28 +01:00
Dan Williams
e031ffbad5 Improved Duration documentation
- Added a description of internal storage and permissable range to the
    Duration type.

  - Adjusted formatting of `Duration` in a number of related function
    Rustdoc blocks, to aid readability.

  - Clarified comments for Duration::num_milliseconds().
2024-02-01 20:56:49 +01:00
Dan Williams
ec831e7bc9 Added Duration::try_milliseconds()
- Added a new Duration::try_milliseconds() function, to attempt to
    create a new milliseconds-based Duration, and return None if it
    fails, based on checking against MAX and MIN. Currently, failure can
    only happen for exactly one value, which is i64::MIN.

  - Updated Duration::milliseconds() to call try_milliseconds() and
    panic if None is returned. Although panicking in production code and
    especially library code is bad, this is in keeping with current
    Chrono behaviour. Note that this function is now no longer const.

  - Updated the Duration::milliseconds() documentation to make it clear
    that it now panics.

  - Added documentation to Duration::microseconds() and nanoseconds() to
    make it clear that they are infallible.

  - All tests now pass, including the one previously ignored.
2024-02-01 20:56:49 +01:00
Dan Williams
e5309f8aa7 Improved the documentation of Duration constructors
- Added Panics and Errors sections where appropriate, as these are
    generally-expected and help draw attention to the fact that the
    standard (i.e. non-try) constructors can panic. The Errors section
    for the try constructors is common practice when returning None for
    overflow situations as well as for functions actually returning a
    Result.

  - Added an further explanation of the behaviour of the seconds()
    constructor.

  - Minor additional readability edits.
2024-02-01 20:56:49 +01:00
Dan Williams
d87df5de78 Added additional tests for Duration bounds
- Added tests for creating the maximum and minimum allowable values of
    Durations having a magnitude of seconds, testing the limits plus one
    value beyond the limits in both directions. These tests all pass.

  - Expanded the tests for creating the maximum and minimum allowable
    values of Durations having a magnitude of milliseconds. These tests
    examine the results in more detail, document what is being tested,
    and also test one value beyond the limits in both directions.
    Notably, the test for Duration::milliseconds() construction for
    i64::MIN currently fails, as it is erroneously allowed. This test is
    ignored for now, until the fix is applied.

  - Expanded the tests for creating the maximum and minimum allowable
    values of Durations having a magnitude of microseconds and
    nanoseconds. These tests examine the results in more detail,
    document what is being tested, and also test one value beyond the
    limits in both directions. They also test the maximum reportable
    value from .num_*() and the maximum storable value of the Duration
    separately.

  - Separated out the tests for MAX and MIN, for clarity.

  - Added additional tests for addition and subtraction operations on
    Durations, ensuring that equivalent tests are performed against both
    operations, such as adding and subtracting zero, adding and
    subtracting one nanosecond, and others.

  - Added tests for greater-than and less-than comparison of two
    Durations, to ensure that internal representation of partial seconds
    is correctly ordered.
2024-02-01 20:56:49 +01:00
Paul Dicker
83d5aae6aa Remove stray documentation 2024-02-01 17:37:09 +01:00
Paul Dicker
cf17f7a239 Remove deprecated methods from documentation 2024-01-30 20:47:54 +01:00
Paul Dicker
3e6fa4c0df Don't use deprecated method in wasm test 2024-01-30 20:47:54 +01:00
Paul Dicker
02a96eba57 Remove workaround for Rust < 1.61 2024-01-29 09:31:44 +01:00
Paul Dicker
baa55d0847 CI: test arbitrary feature 2024-01-26 15:55:32 +01:00