Repository navigation
date: accept dotted calendar dates - #350
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #350 +/- ##
==========================================
+ Coverage 98.90% 98.93% +0.03%
==========================================
Files 21 21
Lines 4572 4611 +39
Branches 142 142
==========================================
+ Hits 4522 4562 +40
+ Misses 49 48 -1
Partials 1 1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
b23d5da to
2e01e00
Compare
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
| /// A year belongs to the dotted date only when it immediately follows the | ||
| /// second dot. With whitespace after that dot, GNU treats the number as a | ||
| /// separate item instead. |
There was a problem hiding this comment.
I think this comment is incorrect, or I'm missing something. The following example works with GNU date:
$ date -d "14 . 11 . 2022"
Mon Nov 14 12:00:00 AM CET 2022
There was a problem hiding this comment.
yep, right, my test script had issues
| s(dec_uint), | ||
| s('.'), | ||
| s(dec_uint), | ||
| '.', |
There was a problem hiding this comment.
See my previous comment.
s('.'),|
|
||
| match year { | ||
| Some(year) => { | ||
| year_from_str(year).map_err(|e| ErrMode::Backtrack(ctx_err(e)))?; |
There was a problem hiding this comment.
do we need this? try_into() already calls year_from_str
| alt((dotted, us, literal1, literal2, literal3)).parse_next(input) | ||
| } | ||
|
|
||
| /// Parse the European `DD.MM[.][YYYY]` spelling. |
There was a problem hiding this comment.
the second dot is mandatory in the code, so 14.11 is rejected
should it be DD.MM.[YYYY]?
There was a problem hiding this comment.
yep, wrong script on my side
| s('.'), | ||
| s(dec_uint), | ||
| '.', | ||
| opt(take_while(1.., AsChar::is_dec_digit)), |
There was a problem hiding this comment.
literal1 requires the year to be followed by a space or eof, why not here?
2e01e00 to
d385a2b
Compare
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
Merging this PR will not alter performance1 warning
Comparing |
d385a2b to
f7fdc18
Compare
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
|
regresion is normal, added work |
f7fdc18 to
fe277a4
Compare
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
fe277a4 to
5229946
Compare
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
| "Format string: {input}" | ||
| ); | ||
| } | ||
|
|
There was a problem hiding this comment.
please also add a test in tests/date.rs (with a 2-digit year too, e.g. 14.11.22)
| ) | ||
| .parse_next(input)?; | ||
|
|
||
| match year { |
There was a problem hiding this comment.
the same map_err in both arms, could be dedup, no?
a8614b1 to
84acf61
Compare
84acf61 to
9532b6b
Compare
|
Thanks for your PR |
Add GNU-compatible dotted calendar date parsing with regression coverage.