[ 
https://issues.apache.org/jira/browse/WW-5811?focusedWorklogId=1050042&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1050042
 ]

ASF GitHub Bot logged work on WW-5811:
--------------------------------------

                Author: ASF GitHub Bot
            Created on: 25/Oct/26 15:07
            Start Date: 25/Oct/26 15:07
    Worklog Time Spent: 10m 
      Work Description: lukaszlenart opened a new pull request, #367:
URL: https://github.com/apache/struts-site/pull/367

   Docs for [WW-5811](https://issues.apache.org/jira/browse/WW-5811) / 
apache/struts#2061. Merge after the code PR.
   
   Updates `core-developers/client-side-validation.md`:
   - **Governing rule:** range constraints are now also added to `type="date"` 
inputs.
   - **Mapping table:**
     - The `date` row ("deferred") becomes `date`/`localdate` → `min`/`max`, on 
`type="date"` only.
     - The `required` row adds temporal controls bound to a date/time property.
   - **New paragraph on when plain `required` is emitted on temporal controls:**
     - It depends on the property's declared type, because an empty value 
converts to null.
     - A `String` property, an indexed path or an unresolved property gets no 
`required`.
   - **New paragraph on date ranges:**
     - `localdate` bounds are written as they are.
     - `java.util.Date` bounds are reduced to their calendar date in the server 
zone. The page explains why that never makes the browser stricter.
     - Out-of-range years are skipped.
     - Why `month`/`week`/`time`/`datetime-local` get no `min`/`max`.
   - **Extension point:**
     - The five-argument `constraintsFor` with its `default` fallback.
     - The `StrutsHtmlConstraintProvider` subclass migration note.
     - The `convertsBlankToNull` override for custom converters.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   




Issue Time Tracking
-------------------

    Worklog Id:     (was: 1050042)
    Time Spent: 0.5h  (was: 20m)

> Derive HTML5 min/max and required constraints for temporal controls
> -------------------------------------------------------------------
>
>                 Key: WW-5811
>                 URL: https://issues.apache.org/jira/browse/WW-5811
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Core Tags
>            Reporter: Lukasz Lenart
>            Assignee: Lukasz Lenart
>            Priority: Major
>             Fix For: 7.5.0
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> h2. Problem
> HTML5 constraint derivation ({{struts.ui.html5.constraints}}) maps range 
> validators to {{min}}/{{max}} only for {{number}} and {{range}} controls. 
> {{HtmlControlType.supportsRange()}} already includes the temporal controls 
> ({{date}}, {{month}}, {{week}}, {{time}}, {{datetime-local}}), but 
> {{StrutsHtmlConstraintProvider}} deliberately skips them, because their 
> {{min}}/{{max}} values need per-control ISO formatting. As a result, 
> {{DateRangeFieldValidator}} emits nothing.
> The {{required}} validator has a related gap. {{addRequiredField}} emits 
> {{required}} only for {{radio}} and {{file}}, because other controls submit 
> an empty string, which the {{required}} validator accepts. A temporal control 
> bound to a {{java.util.Date}} (or {{java.time}}) property is different: 
> {{DateConverter}} turns {{""}} into null, so the server rejects the empty 
> value just as the browser would. These controls currently get only 
> {{data-msg-required}}.
> This affects {{textfield type="date"}} (and the other temporal types) today, 
> and {{datetextfield}} in the html5 theme (WW-5778).
> h2. Proposal
> In {{StrutsHtmlConstraintProvider}}, map {{DateRangeFieldValidator}} min/max 
> to {{min}}/{{max}} for temporal controls, formatted per control:
> * {{date}} → {{yyyy-MM-dd}}
> * {{month}} → {{yyyy-MM}}
> * {{week}} → {{YYYY-'W'ww}} (ISO week-based year)
> * {{time}} → {{HH:mm}} (or {{HH:mm:ss}})
> * {{datetime-local}} → {{yyyy-MM-dd'T'HH:mm}}
> Emit {{required}} from a {{required}} validator on a temporal control only 
> when the bound property's type converts an empty string to null. A 
> {{textfield type="date"}} bound to a {{String}} property must not get it, 
> because the server accepts {{""}} there. The provider currently sees only the 
> control type and the value, so it needs the property type as well.
> Requirements:
> * Format the bounds the same way the server compares them, so the browser 
> never rejects a value the server accepts (time zone and truncation for 
> {{java.util.Date}} bounds)
> * Skip the attribute for controls/value types that cannot be represented 
> exactly, as the numeric path does for fractional {{min}}
> * Tests for each temporal control, including {{datetextfield}} (replace 
> {{Html5ConstraintRenderingTest.testRendersNoRequiredOnADateTextField}}), and 
> the tag reference updated
> Related: WW-5778 (datetextfield in the html5 theme), WW-5810 (java.time 
> support in datetextfield)



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to