Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In This Topic

Table of Contents
maxLevel2
minLevel2

Date Formats

All internal handling of dates in Interactive Forms follows the ISO-8601 format (see the ISO website and this Wikipedia article for detailed information on the ISO specification). This means all internal representations of a date in Interactive Forms are of the format yyyy-MM-dd. Dates are represented by the nl.gx.forms.wmpformapi.engine.FormDate class. This class stores both the ISO representation as well as the locale of the form that the date was submitted in. When using the value of the date fragment, the local representation of the date is returned by default. For example, if you enter the ISO date 2021-07-30 in a Dutch form, then the visible representation will be 30-07-2021 (the Dutch date format). You can also access the ISO format of the entered date if desired.

Date Picker (HTML5)

The default XperienCentral presentation uses the HTML5 date picker for entering dates in Interactive Forms. The format for entering the date in the HTML5 element is browser-dependent, however, the date is always submitted to the backend in ISO format.

Accessing the Contents of a Date Fragment

There are two representations of a Date Fragment.

Local Format (Default)

This format is defined by the locale of the form and uses the java.time API to format dates to their appropriate local formats.


Info
All dates have four digits representing the year of the date — yyyy instead of yy. For the Dutch locale, the date format is hard-coded to dd-MM-yyyy for backwards compatibility.


This format is accessed by default and is constructed via the FormDate#toString()method. In JavaScript and JSP, this format is accessed by default when calling the value attribute of a fragment. For example:

$step1.mydatefragment.value$

ISO Format

This format is defined by ISO-8601 in order to unambiguously represent dates. To access this format, the nl.gx.forms.wmpformapi.engine.FormDate#getIsoFormat() method is available which is called using .isoFormat in  JSP and (server-side) JavaScript. The following example retrieves the ISO format of a Date fragment:

$step1.mydatefragment.value.isoFormat$

Prefilling

Prefilling input of a Date fragment needs to be supplied in the ISO format.

Date Validator

The date validator validates dates based on their ISO representation. It does so by checking whether the date representation is a FormDate object (backend) or not (frontend). If it is, it accesses FormDate#getIsoFormat(). If not, the string is already assumed to be in ISO format.

Backwards Compatibility

Dates for the Dutch locale are hard-coded to dd-MM-yyyy because version R33 and earlier of XperienCentral used this format for the representation of dates in the front-end. GX Software strongly recommends that you use the ISO-8601 format for the internal representation and code for dates in Interactive Forms.