[
https://issues.apache.org/jira/browse/WW-5816?focusedWorklogId=1050008&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1050008
]
ASF GitHub Bot logged work on WW-5816:
--------------------------------------
Author: ASF GitHub Bot
Created on: 25/Oct/26 08:53
Start Date: 25/Oct/26 08:53
Worklog Time Spent: 10m
Work Description: lukaszlenart opened a new pull request, #366:
URL: https://github.com/apache/struts-site/pull/366
Documents [WW-5816](https://issues.apache.org/jira/browse/WW-5816). **Merge
after apache/struts#2060**, which adds the validator.
New pages:
- **localdate validator**: description, ISO `min`/`max` and expression
parameters, and XML examples for plain, field and expression syntax
- **LocalDateRangeFieldValidator Annotation**: the parameter table without
`dateFormat` (bounds are ISO only); a non-ISO bound fails when the validators
are built
Updated:
- Validation: `localdate` added to the bundled validators list
- Annotations: row for the new annotation
- Validations Annotation: `localDateRangeFields` member
- date validator: points `LocalDate` properties to `localdate` (the `date`
validator throws `ClassCastException` on them)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Issue Time Tracking
-------------------
Worklog Id: (was: 1050008)
Time Spent: 20m (was: 10m)
> Add a range validator for java.time.LocalDate properties
> --------------------------------------------------------
>
> Key: WW-5816
> URL: https://issues.apache.org/jira/browse/WW-5816
> Project: Struts 2
> Issue Type: New Feature
> Components: Annotations, XML Validators
> Reporter: Lukasz Lenart
> Assignee: Lukasz Lenart
> Priority: Major
> Fix For: 7.5.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> h2. Problem
> {{DateRangeFieldValidator}} ({{date}}) is a {{RangeValidatorSupport<Date>}}.
> On a {{java.time.LocalDate}} property it compares the {{LocalDate}} value
> against a {{java.util.Date}} bound, which throws {{ClassCastException}}, so a
> {{LocalDate}} field has no working range validation. {{DateConverter}} and
> the date tags have supported {{LocalDate}} for some time (WW-5016, WW-5530,
> WW-5810); the validators have not.
> h2. Proposal
> A separate validator, following the one-class-per-type pattern of the
> existing range validators:
> * {{LocalDateRangeFieldValidator extends RangeValidatorSupport<LocalDate>}},
> registered as {{localdate}} in the default validators
> * {{min}} / {{max}} as ISO dates ({{2026-01-01}}), plus {{minExpression}} /
> {{maxExpression}}
> * annotation {{@LocalDateRangeFieldValidator}}, a {{localDateRangeFields()}}
> member on {{@Validations}} (with an empty default, so existing code keeps
> compiling), and processing in {{AnnotationValidationConfigurationBuilder}}
> * {{LocalDate}} only; {{LocalDateTime}} / {{LocalTime}} can follow on demand
> {{DateRangeFieldValidator}} stays unchanged. The removed legacy client-side
> validation never supported {{date}}, so nothing is needed there.
> Before implementing, check how a string {{min}} / {{max}} param from XML
> reaches the generic {{setMin(T)}} / {{setMax(T)}} of
> {{RangeValidatorSupport}}, and that it ends up as a {{LocalDate}}.
> h2. Requirements
> * Tests: XML and annotation configuration, inclusive bounds, null value
> skipped, expressions
> * Validator reference docs on struts-site
> Related: WW-5811 (HTML5 {{min}}/{{max}} for {{date}} controls), which will
> map this validator's bounds directly to {{min="yyyy-MM-dd"}}.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)