Date and Time Fields
Last updated
Last updated
The Date and DateTime elements allow you to add a calendar where the user can select a day, month, and year (and, in the case of DateTime, also a time). Unlike other options for entering the same type of data (e.g., a text field with masks), these tools are especially useful for standardizing formats and avoiding errors when inputting information.
Date fields can be used to pinpoint important events in time or set deadlines. Since their function is very specific, their customization options are limited, and the format will already be predefined.
We will add a required Date field in the "Personal Information" section of the form so that the user can select their date of birth. To do this, we will reorganize the existing fields in this section, reducing the space allocated for the ID and tax key so that they appear on the same row. Remember to go to Properties > General > Size and adjust the size of both fields to 6 units so they occupy half the space. They will automatically rearrange, freeing up space below to insert the new Date component.
Once added, we will define the value “fecha_nacimiento” for the Name property, which will be registered internally, and the value “Date of Birth” for the Label property, which the user will see.
The DateTime field works similarly, except that it includes a space for the time, which is useful for scheduling meetings, specifying reception or delivery times, and setting more precise deadlines, among other possibilities. The time format is also predefined by default in hours, minutes, and seconds.