Repository navigation
Detect day-first month-name dates with a comma before the year - #465
Merged
Merged
Conversation
Member
|
Thanks @DG47! |
DG47
force-pushed
the
fix/day-first-comma-dates
branch
from
October 22, 2026 13:54
4a56d07 to
8e97439
Compare
|
Contributor
Author
|
Fixed the SonarCloud finding (regex complexity from the month-name alternation) with a |
Member
|
Thanks @DG47! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #462.
A day-first date with a comma before the year, such as
27 March, 1965, was not detected by the date filter, so the whole date was left in the output. Day-first dates without the comma were detected only through the optional leading day on the month-first patterns, so their spans carriedMMMM yyyy(orMMMM-ddfor27-Mar-1965), which does not describe the text.Changes:
DateFiltergets day-first month-name patterns, placed ahead of the month-first ones so that, for the same text, the day-first format is the one recorded on the span:D Month, YYYY, formatdd MMMM, yyyyD<delim>Month<delim>YYYYfor each of the existing delimiters (space,-,/,.), formatdd MMMM yyyy,dd-MMMM-yyyy,dd/MMMM/yyyy,dd.MMMM.yyyyst,nd,rd,th); the month is a full or abbreviated name with an optional period; the year is any four digits, as forMonth D, YYYYafter Month-name dates with a two-digit day and a year before 1970 lose their year #459.DateFilterTest: the forms from the issue (27 March, 1965,27 Mar, 1965,27th March, 1965,3 March, 2020, and others) withonlyValidDatesoff and on; every day 1 to 31 with years 1900, 1950, 1969, 1970, 2025, and 2099 for the comma, space, and hyphen forms; the forms without the comma; the format on each day-first span; and that month-first dates keep their month-first formats.dates.mdlists the day-first forms, andRELEASE_NOTES.mdhas an entry.Not changed here: like the other month-name formats,
dd MMMM, yyyyusesyyyyanddd, soSHIFTandTRUNCATE_TO_YEARstill fall back to redaction for these dates. That is #461.Testing (JDK 17):
mvn --batch-mode test -Dtest=DateFilterTest: before the change,filterDateDayFirstWithComma,filterDateDayFirstEveryDay, andfilterDateDayFirstFormatfail; after it,Tests run: 73, Failures: 0, Errors: 0, Skipped: 0mvn --batch-mode package:Tests run: 2975, Failures: 0, Errors: 0, Skipped: 0,BUILD SUCCESS