Date & time picker

The UI component Date & Time Picker allows the user to easily input data of type Datetime. You can bind this UI component to a property, which can allow you to persist this user input to the database.

You can see an example setup of the Date & Time Picker in the UI Components App in our Showroom! You can try the component, as well as access the setup in Appfarm Create. If you do not have access, you can register here.


Here are some of the properties in Appfarm Create which are custom for a Date & Time Picker:


The data source property or variable that the user input is bound to. This can be an App Variable, a Runtime Only Object Class property, or a Database Connected Object Class property. The data type of this property must be Datetime.

If validation of the input is important, it is recommended to use an App Variable or a Runtime Only Object Class property here, so that input validation can be performed before persisting input to the database.


Define an event where the component will enter an error state. This can be through binding to a Data Source Property, setting up a Condition, or a JavaScript function. This can be used to alert the user of a required field when filling in a form or to alert the user that some of their input data is not correct.

Other properties listed below, such as Min Date and Max Date, can help with input validation too.


This is text that tells the user what the Date & Time Picker will be used for. This could be a preferred delivery date and time for an order, for instance. Labels are always visible to the user.


This is a piece of text that appears whenever the user input (value property) is blank.

Helper Text

This serves a similar function to Placeholder Text, but it is always visible regardless of the user's input. It appears directly underneath the Date & Time Picker. This can be used to give the user slightly more guidance than a Placeholder property might, as it is constantly visible.


Three types of Date & Time Picker are available:

  • Date: The user can input a date only

  • Time: The user can input a time only

  • Date & Time: The user can choose both a date and a time

Note that even if you choose type Time, at Datetime datatype will be saved. Using Time as type will only edit the time-part of the Datetime. If the property is null or undefined when a new Time is entered, the date-part of the value property will be set to Today.

It is also possible to have two Date & Time Pickers in the same view, both connected to the same value property: One with Type Date, and the other with Type Time. These will update the date-part and the time-part of the same property independently.

You app has a form for registering a new event. You want to have a date for the event, and the start time. See screenshot below.

In this example, you may have 1 object class property Event.Start (Datetime data type). Both the Event Date and Start Time will be bound to this property. When the user selects an Event Date, only the bold part below will be altered. When the user selects a Start Time, only the italic part will be entered (the seconds and millesecondspart will be left untouched or set to Now if the Datetime was null or undefined previously)


Note that if you want to e.g. modify the seconds-part or the date-part when using the Time picker, you can add an On Value Changed event handler, with an action that updates the same property using a Function and the momentjs library.

If you want to learn more about how Date and Time is stored, and how time zones are handles, you may read more here.

Min Date

This property is not available for the Time type. This allows the developer to choose the earliest possible date that the user can choose from. Inputs earlier than this date will not be enabled.

Max Date

This property is not available for the Time type. This allows the developer to choose the latest possible date that the user can choose from. Inputs later than this date will not be enabled. A common use for this property is to bind Max Date to today's date, so users cannot pick a value in the future.

Auto Focus

When selected, this component will gain focus automatically when the screen is rendered.

Tab Index

Users can use the Tab key to navigate between inputs and components on a screen. This property tells Appfarm Create which index to bind to the current Date & Time Picker. This value should only be given when you want to override the default tab index. Using a tab index of -1 will remove the component from the tab index.



Appfarm Create provides three different variants of the Date & Time Picker component. These are all available to view in the Appfarm Showroom.

  • Standard

  • Outlined

  • Filled

Disable Underline

When selected, the component will not have the bottom border line filled in.


Three choices are available for this property. These define the margin style between this component and other UI components on the screen.

  • Normal

  • Dense

  • None


When enabled, the input component will appear directly on screen instead of in a separate dialog. This is best explained with an example, which is available in the Appfarm Showroom.

Only Calendar

This is only available when Inline is enabled. Not available for the Time type. This will show the calendar only, instead of showing additional input information above the calendar. This is also best explained with an example, which is also available in the Appfarm Showroom.

Week Numbers

Not available for the Time type. Calendars will show the relevant week numbers next to dates when this property is enabled.

Event Handlers

Event Handlers can detect a specific event occurring in Appfarm Create and can link these events to actions. One Event Handler is available for the Date & Time Picker component:

On Value Change: This Event Handler will run an action when a change is detected in the data source bound to the component. For example, if you only want to show projects with a due date after a given date which can be input by the user, an action which reads the projects data source could be linked to this Event Handler.

Last updated