Date Time Field

The datetime field.

The DateTime Field builds on the standard Date Field and leverages the Bootstrap DateTime plugin under the hood. You can learn more about this plugin on its GitHub page: https://github.com/Eonasdan/bootstrap-datetimepicker.

For more information on date and time formatting strings, see the Moment.js documentation: http://momentjs.com/docs/.

The default date time format is assumed to be MM/DD/YYYY HH:mm:ss. This is an American approach to the date with a 24-hour clock. If you want to have an AM/PM selector, you can set the dateFormat to MM/DD/YYYY hh:mm:ss a.

Properties

Title Date Time
Description Datetime Field based on Bootstrap DateTime Picker.
Field Type datetime
Base Field Type date

Schema

Property Type Default Description
allowOptionalEmpty Allows this non-required field to validate when the value is empty
autocomplete string Allows you to specify the autocomplete attribute for the underlying input control whether or not field should have autocomplete enabled.
data object Allows you to specify a key/value map of data attributes that will be added as DOM attribuets for the underlying input control. The data attributes will be added as data-{name}='{value}'.
disallowEmptySpaces boolean Whether to disallow the entry of empty spaces in the text
disallowOnlyEmptySpaces boolean Whether to disallow the entry of only empty spaces in the text
enum array List of specific values for this property
format string date Property data format
inputType string Allows for the override of the underlying HTML5 input type. If not specified, an assumed value is provided based on the kind of input control (i.e. 'text', 'date', 'email' and so forth)
maskString string Expression for the field mask. Field masking will be enabled if not empty.
placeholder string Field placeholder.
size number 40 Field size.
trim boolean Remove whitespace from the beginning and end of string
typeahead Provides configuration for the $.typeahead plugin if it is available. For full configuration options, see: https://github.com/twitter/typeahead.js

Options

Property Type Default Description
dateFormat string Date format (using moment.js format)
name string Field Name.
picker any Options that are supported by the Bootstrap DateTime Picker.
sort function Defines an f(a,b) sort function for the array of enumerated values [{text, value}]. This is used to sort enum and optionLabels as well as results that come back from any data sources (for select and radio controls). By default the items are sorted alphabetically. Don't apply any sorting if false.

Example 1

Single datetime field.

{% raw %} {% endraw %}

Example 2

Multiple datetime fields wrapped in a FORM.

{% raw %} {% endraw %}

Example 3

Datetime field with timepicker options and a button that returns field value as date.

{% raw %} {% endraw %}

Example 4

Single datetime field rendered in display-only mode.

{% raw %} {% endraw %}

Example 5

If you'd like to customize the behavior of this control, you can pass in explicit configuration using the picker option.

Here is an example that uses a 24 hour clock format and an alternative layout. Note that a 24 hour clock is specified with HH.

{% raw %} {% endraw %}

Example 6

DateTime fields can also be modeled as number properties. This will store the value in the milliseconds since Unix epoch convention. This is a milliseconds value with an assumed timezone of UTC.

{% raw %} {% endraw %}