'How do I set the min attribute for <input type="date"> via h:inputText?

I have the following HTML calendar:

<h:inputText t:type="date" value="#{data.dueDate}">
    <f:convertDateTime pattern="yyyy-MM-dd"/>
</h:inputText>

How can I add the min attribute for this?

t refers to xmlns:t="http://xmlns.jcp.org/jsf/passthrough"



Solution 1:[1]

With input type date you can use min and max attributes. You can set the min attribute the same way you used passthrough to set the type="date" attribute. So, for example:

<h:inputText t:type="date" t:min="2016-12-31" value="#{data.dueDate}">
  <f:convertDateTime pattern="yyyy-MM-dd"/>
</h:inputText>

See also:

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Community