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.
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
"week" input types.
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:
isRequiredproperty 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
maxproperties to specify it. Alternatively, you can use the
maxValueExpressionproperties 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.