Skip to content

fix(date): accept a period after abbreviated month names - #347

Open
youdie006 wants to merge 1 commit into
uutils:mainfrom
youdie006:month-abbreviation-period
Open

youdie006 wants to merge 1 commit into
uutils:mainfrom
youdie006:month-abbreviation-period

Conversation

@youdie006

Copy link
Copy Markdown

#334 let abbreviated weekday names take a trailing dot (mon.), but literal_month still parses only alpha1, so a dotted month abbreviation is rejected. The module doc of date.rs quotes the GNU manual: months "may be abbreviated to their first three letters, possibly followed by an abbreviating dot".

input           GNU date 9.4 (TZ=UTC)   before   after
jan. 5 2024     2024-01-05 00:00:00     error    2024-01-05 00:00:00
nov.-14-2022    2022-11-14 00:00:00     error    2022-11-14 00:00:00
dec.25          2026-12-25 00:00:00     error    2026-12-25 00:00:00
sept. 5 2024    invalid date            error    error
june. 5 2024    invalid date            error    error

This uses the same parser shape as #334 ((alpha1, opt('.')).take()) and adds the dotted three-letter forms to the match, so sept., june. and january. stay rejected like in GNU date. The grammar comment in items/mod.rs is updated to match.

Tests: dotted rows in the literal1/literal2/literal3 tests and month_abbreviation_with_period in lib.rs (all twelve months, plus the rejected forms); they fail without the change. cargo test, cargo fmt --all -- --check and cargo clippy --all-targets -- -D warnings pass locally. GNU behaviour was checked only by running date, not by reading its source.

Written with AI assistance (Claude); I have reviewed the change.

uutils#334 let weekday names take an abbreviating dot (mon., tue.), but
literal_month still parsed only alpha1, so jan. 5 2024 or 14-nov.-2022
were rejected, although the module doc quotes the GNU manual allowing
"an abbreviating dot" and GNU date accepts them.
Copilot AI balanced review requested due to automatic review settings October 27, 2026 14:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

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

codecov Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.90%. Comparing base (37d5d78) to head (3147b94).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #347   +/-   ##
=======================================
  Coverage   98.90%   98.90%           
=======================================
  Files          21       21           
  Lines        4546     4564   +18     
  Branches      142      142           
=======================================
+ Hits         4496     4514   +18     
  Misses         49       49           
  Partials        1        1           
Flag Coverage Δ
macos_latest 98.90% <100.00%> (+<0.01%) ⬆️
ubuntu_latest 98.90% <100.00%> (+<0.01%) ⬆️
windows_latest 12.13% <3.22%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants