LinkedIn
Copied!

Table of Contents

Date Time control in DX API

The Date Time control (pxDateTime) helps users select the date and time in forms. Learn about the JSON structure and elements of a sample Date Time control, to understand how you can integrate the element into your custom application.

The following JSON code is a sample API response for the Date Time control:

{
  "validationMessages": "",
  "visible": true,
  "labelReserveSpace": true,
  "readOnly": false,
  "control": {
    "modes": [
      {
        "dateTime": "auto",
        "showReadOnlyFormatting": false,
        "allowTextEntry": true,
        "textAlign": "Left",
        "tooltip": "Data & time",
        "ignoreLocaleSettings": false,
        "displayLongFormat": false,
        "displayMode": "calendar",
        "calendarNavigation": "true",
        "minChars": "",
        "modeType": "editable",
        "controlFormat": "",
        "maxChars": "",
        "placeholder": "Deadline",
        "formatType": "text",
        "specifySize": "auto",
        "obfuscated": false
      },
      {
        "modeType": "readOnly",
        "dateTimeFormat": "DateTime-Short",
        "tooltip": "",
        "showReadOnlyValidation": "false",
        "formatType": "datetime",
        "obfuscated": false,
        "showAs24HourFormat": false
      }
    ],
    "actionSets": [],
    "type": "pxDateTime"
  },
  "label": "eta",
  "type": "Date",
  "required": false,
  "validateAs": "",
  "reference": "eta",
  "labelFormat": "Standard",
  "disabled": false,
  "testID": "202008140904060384476",
  "value": "",
  "maxLength": 0,
  "expectedLength": "",
  "fieldID": "eta",
  "customAttributes": {
    "testAttr": "testVal"
  }
}

The following examples show a sample configuration of the control with the relevant JSON elements:

Cell properties - General tab
Cell properties - General tab
  • The expressions and When rules that are part of conditions, such as Visibility, Disable, or Required, return boolean values.
  • For conditions, such as Visibility, Disable, or Required, for the Condition (when rule) option, negation with the logical operator (!) is supported. For example, !pzVisibleWhen.
  • Fields, such as Placeholder or Helper text, return the corresponding values from the associated Pega rules.
  • The JSON response does not contain the data in the Default value field.
  • The response returns the name-value pairs that you add to the DX API attributes of the control as part of the customAttributes element.
Cell properties - Presentation tab
Cell properties - Presentation tab
  • In the Specify size setting, if you select Custom, two additional fields appear that determine the custom width of the control. The fields are:
    • A Width field whose JSON element is control.modes[0].charWidth of type string that takes the width as the input. 
    • A drop-down list field whose JSON element is control.modes[0].charWidthUnits of type string that takes the unit of the width as input.
  • The JSON response does not contain information on the fields whose JSON elements are not mentioned in the above image.
Property referenced in the control - Advanced tab
Property referenced in the control - Advanced tab
The message in the validationMessages element is displayed when the validation in the validateAs element fails.
Suggest Edit
Did you find this content helpful?

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.