sahvx655-wq commented on PR #408: URL: https://github.com/apache/commons-validator/pull/408#issuecomment-4806896548
Took the epoch route you suggested. compare() now sends both WEEK_OF_YEAR and WEEK_OF_MONTH through one helper that looks at the day gap first: a week or more apart is always a different week, and within a week they only count as the same week when the week number also matches. That removes the year-boundary false match on WEEK_OF_YEAR and drops the getWeekYear()/isWeekDateSupported() machinery the earlier version leaned on. On WEEK_OF_MONTH: the old path compared MONTH before WEEK_OF_MONTH, so a December day and a January day never collided the way the year-boundary case did, which is why it wasn't visibly broken. Routing it through the same guard keeps every existing WEEK_OF_MONTH result and makes that invariant explicit rather than incidental. I added boundary tests for both fields and the full build (mvn clean verify with checkstyle/spotbugs/pmd, 1092 tests) is green. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
