Skip to main content
Version: v4

Date Time Picker Element

DateTimeElement is used to represent a single input field that allows to select date and time.

Properties:

PropertyTypeDescription
elementTypeStringdefaults to UIElementTypeConstants.dropdown
elementIdStringunique ID for the interaction element
labelStringaccepts a string. It is the label of the dropdown.
modeDateTimePickerMode \n\n\n\n(.dateTime, .date, .time)It is the mode of the date time picker.
fromDateTimeIntIt is the start date of the date time picker.
toDateTimeIntIt is the end date of the date time picker.
dateTimeFormatStringIt is the format of the date time picker.
timeZoneStringIt is the time zone of the given date.
defaultValueIntIt is the default value of the input element.
isOptionalBoolIt states if the input element is optional.

Usage

Here's an example of how you can create an instance of the DateTimeElement class:

In this example, a new instance of DateTimeElement is created with the elementId "1" and the label text "Select a Date".

Example

Here is an example that showcases the creation and manipulation of an instance of DateTimeElement:

let dateTimePicker = DateTimeElement()
dateTimePicker.elementId = "332"
dateTimePicker.isOptional = true
dateTimePicker.timeZone = TimeZone.current.identifier
dateTimePicker.mode = .dateTime
dateTimePicker.fromDateTime = Int(Date().timeIntervalSince1970)
dateTimePicker.toDateTime = Int(Date().addingTimeInterval(40*30*30).timeIntervalSince1970)