date: support MMDDhhmm[[CC]YY][.ss] positional argument for setting date#11534
date: support MMDDhhmm[[CC]YY][.ss] positional argument for setting date#11534aguimaraes wants to merge 14 commits into
Conversation
|
GNU testsuite comparison: |
01e8f66 to
edbe04d
Compare
|
GNU testsuite comparison: |
Merging this PR will not alter performance
Comparing Footnotes
|
edbe04d to
5e0e12b
Compare
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
hey guys, is there anything else I can change to make this good enough to merge? |
…-format # Conflicts: # tests/by-util/test_date.rs
|
@cakebaker would you mind taking a look, please? I merged main, conflicts resolved, all tests passing. |
| } | ||
|
|
||
| #[test] | ||
| fn test_parse_positional_12_digits() { |
There was a problem hiding this comment.
can you decrease the number of tests ? just merge them
There was a problem hiding this comment.
sure thing.
I've merged them in two, invalid and valid input.
Is that ok?
Unable to generate the performance reportThere was an internal error while processing the run's data. We're working on fixing the issue. Feel free to contact us on Discord or at support@codspeed.io if the issue persists. |
Fixes #6398
The
datecommand accepts a bare positional argument to set the system clock:Previously, any positional argument without a
+prefix was rejected with "invalid date". This was already documented in the usage string but never implemented.The parser lives in
date.rsrather than theparse_datetimecrate because this format is specific to thedatecommand positional argument. It follows the existing pattern in this codebase wheretouchhas its ownparse_timestamp()for the similar[[CC]YY]MMDDhhmm[.ss]format.The implementation rearranges the input into
CCYYMMDDhhmm[.ss]and delegates tojiff::fmt::strtime::parsefor validation, same approach astouch::parse_timestamp(). Two-digit years use the same century rule astouch: 00-68 -> 20xx, 69-99 -> 19xx.