[
https://issues.apache.org/jira/browse/WW-5816?focusedWorklogId=1050028&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1050028
]
ASF GitHub Bot logged work on WW-5816:
--------------------------------------
Author: ASF GitHub Bot
Created on: 25/Oct/26 12:25
Start Date: 25/Oct/26 12:25
Worklog Time Spent: 10m
Work Description: lukaszlenart merged PR #366:
URL: https://github.com/apache/struts-site/pull/366
Issue Time Tracking
-------------------
Worklog Id: (was: 1050028)
Time Spent: 1h 40m (was: 1.5h)
> 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: 1h 40m
> 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)