The `<tc:date/>` tag create an input field with a button to open a calendar to edit the date. The date can also be edited in the textfield.

Tag Library Documentation: |

In general, a date had a label. To get a label use the `label` attribute, `<tc:in>`.

<tc:date label="Date" value="\#{dateController.sputnikLd}"/> Without a label:

The following date should be selected after reloading the page. This can be done with the attribute `focus`.

<tc:date label="Date (focus)" focus="true"/>>

It is NOT recommended to use `<f:convertDateTime>`, in most cases the converter will be configured automatically.

The `value` must be one of a set of several types. There are some new classes from since Java 8, which are generally preferred to use (there are several discussions in the net).

- (not recommended)
- (not recommended)
- for plain text (TBD)

Technical hint: Until Tobago 4 the user readable localized formatted String (e. g. 12/31/2050) was rendered into the HTML file and was post back to the server. Since Tobago 5 the string will be tranfered as ISO 8601 (e. g. 2050-12-31) to satisfy the HTML5 specification for input type="date", type="time" and type="datetime-local".

A date can be set as required with the `required` attribute. Such a date must contain a value, otherwise a submit is not possible. Leave the field blank and press 'submit' to see the error message.

<tc:date label="Date (required)" required="true" value="\#{dateController.once}">

A Java date can also be displayed in other components. Please use an appropriate converter.

<tc:in label="Date in Textfield" value="\#{dateController.today}"> <f:convertDateTime pattern="dd.MM.yyyy"/> </tc:in> <tc:textarea label="Date in Text Area" value="\#{dateController.today}"> <f:convertDateTime pattern="dd.MM.yyyy"/> </tc:textarea> <tc:out label="Date in Output" value="\#{dateController.today}"> <f:convertDateTime pattern="dd.MM.yyyy"/> </tc:out> <tc:label value="\#{dateController.today}"> <f:convertDateTime pattern="dd.MM.yyyy"/> </tc:label>

Here are some examples for different pattern. The format is used from .

Also the type of the button changed with the `type` attribute.

<tc:date label="Month" value="\#{dateController.today}"> <f:convertDateTime pattern="MM/yyyy" type="date"/> </tc:date> <tc:date label="Time" value="\#{dateController.today}"> <f:convertDateTime pattern="HH:mm" type="time"/> </tc:date> <tc:date label="Time" value="\#{dateController.today}"> <f:convertDateTime pattern="HH:mm:ss" type="time"/> </tc:date> <tc:date label="Date and time" value="\#{dateController.today}"> <f:convertDateTime pattern="dd.MM. - HH:mm" type="both"/> </tc:date>

Display a today button on the datepicker with the attribute `todayButton=true`.

Styles can be set with the attributes `dateStyle` and `timeStyle`. Possible values are 'short', 'medium', 'long' and 'full'.

To define the earliest or latest acceptable date, the attributes `min` and `max` can be used.

Press the button to submit the date to the server. The output field show the current value. The date can be changed with the datepicker or by entering a valid date in the textfield.

The output field in this example, display the given date. With `<f:ajax render="outputfield"/>`, the `<tc:out id="outputfield" .../>` will be rerendered, after the date changed. The date can be changed by button or by entering a valid date in the textfield. If the date is not valid, it won't be adopted.