Date-Time Entry

Edit in →
Survey Creator

A date-time entry question is a variation of a text entry question used to input formatted date and time values. This example demonstrates different types of date-time entry questions supported by SurveyJS Form Library. Switch between React, Vue, Knockout, jQuery, and Angular to view an example for your JavaScript framework.

Create a Date-Time Entry Question

To create a date-time entry form field, define an object with the type property set to "text" and add it to the elements array. Within this object, specify the question's title and a unique name that identifies the date-time input question. Optionally, you can specify a description to place under the title and a placeholder to show within the date-time input field.

Specify Input Type

If a question requires input in a specific date-time format, use the inputType property to specify the input type. An inputType value is passed on to the type attribute of the underlying <input> HTML element. This example demonstrates the "date", "time", "datetime-local", "month", and "week" input types.

Validate Date-Time Values

If you need to ensure that respondents fill out all required form fields and the format of values is correct, enable data validation. This example demonstrates the following validation types and describes how to configure them:

  • Required Validation
    Enable the isRequired property for the form fields that should not be empty.

  • Date-Time Range Validation
    If date-time values should fall within a specific range, use the min and max properties to specify it. Alternatively, you can use the minValueExpression and maxValueExpression properties to calculate range limits dynamically (see Expressions).

To learn more about data validation in SurveyJS Form Library, refer to the following help topic: Data Validation.

Your cookie settings

We use cookies on our site to make your browsing experience more convenient and personal. In some cases, they are essential to making the site work properly. By clicking "Accept All", you consent to the use of all cookies in accordance with our Terms of Use & Privacy Statement. However, you may visit "Cookie settings" to provide a controlled consent.

Your renewal subscription expires soon.

Since the license is perpetual, you will still have permanent access to the product versions released within the first 12 month of the original purchase date.

If you wish to continue receiving technical support from our Help Desk specialists and maintain access to the latest product updates, make sure to renew your subscription by clicking the "Renew" button below.

Your renewal subscription has expired.

Since the license is perpetual, you will still have permanent access to the product versions released within the first 12 month of the original purchase date.

If you wish to continue receiving technical support from our Help Desk specialists and maintain access to the latest product updates, make sure to renew your subscription by clicking the "Renew" button below.