github GitoxideLabs/gitoxide gix-date-v0.9.3
gix-date v0.9.3

latest releases: gix-v0.69.1, v0.40.0, gitoxide-core-v0.44.0...
one day ago

Bug Fixes

  • add support for 'any' unit, when parsing <count> <unit> ago.
    Similar to Git, any unit is allowed and will default to seconds, like 60 flurps ago
    will mean a minute in the past.

  • Parse relative months and years
    This extends gix_date::parse::relative::span to recognize times
    with "months" and "years", as in "3 months ago" and "2 years ago".
    Those units are supported by Git.

    The actual change here to the parsing code is very simple, because
    it is directly facilitated by #1474.

    The units "seconds", "minutes", "hours", "days", and "weeks"
    continue to be recognized (as before). Relative times like
    "1 year, 2 months ago" remain unrecognized.

    For background, see 43b6c06 (#498), c5c6bf6,
    #1474 (comment),
    and
    #1696 (comment).

    Note that this specific change does not itself fix issue #1696,
    which applies to the intepretation of "days" and "weeks", and now
    also applies in the same way to the interpretation of "months" and
    "years". (It continues not to apply to the interpretation of
    "seconds", "minutes", and "hours".)

    The tests are updated to cover "months" and "years", as well as to
    exercise a wider range of relative times, including showing which
    units (e.g. "days") are affected by #1696. A few sub-cases, of
    those adjusted or added here, test strings from a related test in
    Git, to allow comparison. But most are not related to cases there.

    As before, the tests pass on CI, or when the time zone is otherwise
    UTC, or with local time zones that never have DST adjustments.

    The sub-cases are reordered to be monotone increasing in the
    magnitude of the relative intervals tested (and thus monotone
    decreasing in the associated absolute timestamps), and the original
    input is kept zipped into the actual and expected arrays being
    compared. This way, if the assertion fails (such as due to #1696),
    it is clear and readable which sub-cases failed and exactly how, as
    well as what all the sub-cases are and what each sub-case tests.

    Reordering the sub-cases and preserving the inputs they parse in
    this way avoids the disadvantages of #1697 while keeping, and
    expanding on, its benefits.

    Failure, where it occurs, now looks like:

    --- STDERR: gix-date::date time::parse::relative::various ---
    thread 'time::parse::relative::various' panicked at gix-date\tests\time\parse.rs:252:9:
    assertion failed: (left == right): relative times differ

    Diff < left / right > :
    [
    (
    "5 seconds ago",
    2024-11-24T23:51:49Z,
    ),
    (
    "5 minutes ago",
    2024-11-24T23:46:54Z,
    ),
    (
    "5 hours ago",
    2024-11-24T18:51:54Z,
    ),
    (
    "5 days ago",
    2024-11-19T23:51:54Z,
    ),
    (
    "3 weeks ago",
    2024-11-03T23:51:54Z,
    ),
    (
    "21 days ago",
    2024-11-03T23:51:54Z,
    ),
    (
    "504 hours ago",
    2024-11-03T23:51:54Z,
    ),
    (
    "30240 minutes ago",
    2024-11-03T23:51:54Z,
    ),
    (
    "2 months ago",
    < 2024-09-24T23:51:54Z,

       2024-09-24T22:51:54Z,
    

    ),
    (
    "1460 hours ago",
    2024-09-25T03:51:54Z,
    ),
    (
    "87600 minutes ago",
    2024-09-25T03:51:54Z,
    ),
    (
    "14 weeks ago",
    < 2024-08-18T23:51:54Z,

       2024-08-18T22:51:54Z,
    

    ),
    (
    "98 days ago",
    < 2024-08-18T23:51:54Z,

       2024-08-18T22:51:54Z,
    

    ),
    (
    "2352 hours ago",
    2024-08-18T23:51:54Z,
    ),
    (
    "141120 minutes ago",
    2024-08-18T23:51:54Z,
    ),
    (
    "5 months ago",
    < 2024-06-24T23:51:54Z,

       2024-06-24T22:51:54Z,
    

    ),
    (
    "3650 hours ago",
    2024-06-25T21:51:54Z,
    ),
    (
    "219000 minutes ago",
    2024-06-25T21:51:54Z,
    ),
    (
    "26 weeks ago",
    < 2024-05-26T23:51:54Z,

       2024-05-26T22:51:54Z,
    

    ),
    (
    "182 days ago",
    < 2024-05-26T23:51:54Z,

       2024-05-26T22:51:54Z,
    

    ),
    (
    "4368 hours ago",
    2024-05-26T23:51:54Z,
    ),
    (
    "262080 minutes ago",
    2024-05-26T23:51:54Z,
    ),
    (
    "8 months ago",
    < 2024-03-24T23:51:54Z,

       2024-03-24T22:51:54Z,
    

    ),
    (
    "5840 hours ago",
    2024-03-26T15:51:54Z,
    ),
    (
    "350400 minutes ago",
    2024-03-26T15:51:54Z,
    ),
    (
    "38 weeks ago",
    2024-03-03T23:51:54Z,
    ),
    (
    "266 days ago",
    2024-03-03T23:51:54Z,
    ),
    (
    "6384 hours ago",
    2024-03-03T23:51:54Z,
    ),
    (
    "383040 minutes ago",
    2024-03-03T23:51:54Z,
    ),
    (
    "11 months ago",
    2023-12-24T23:51:54Z,
    ),
    (
    "8030 hours ago",
    2023-12-26T09:51:54Z,
    ),
    (
    "481800 minutes ago",
    2023-12-26T09:51:54Z,
    ),
    (
    "14 months ago",
    < 2023-09-24T23:51:54Z,

       2023-09-24T22:51:54Z,
    

    ),
    (
    "21 months ago",
    2023-02-24T23:51:54Z,
    ),
    (
    "2 years ago",
    2022-11-24T23:51:54Z,
    ),
    (
    "20 years ago",
    2004-11-24T23:51:54Z,
    ),
    (
    "630720000 seconds ago",
    2004-11-29T23:51:54Z,
    ),
    ]

Commit Statistics

  • 6 commits contributed to the release over the course of 28 calendar days.
  • 28 days passed between releases.
  • 2 commits were understood as conventional.
  • 0 issues like '(#ID)' were seen in commit messages

Commit Details

view details
  • Uncategorized
    • Update changelogs prior to release (7ea8582)
    • Merge pull request #1702 from EliahKagan/run-ci/duration-units (b34d14e)
    • Add support for 'any' unit, when parsing <count> <unit> ago. (34d2fce)
    • Fix test expection for UTC relative dates (856b385)
    • Parse relative months and years (c95135b)
    • Merge pull request #1701 from GitoxideLabs/release (e8b3b41)

Don't miss a new gitoxide release

NewReleases is sending notifications on new releases.