{hero}

datetime

Since: Editor 1.5.2

Date and / or time input.
Please note - this property requires the Editor extension for DataTables.

The full Editor reference documentation is available to registered users of Editor - the information shown below is a summary only. If you already have an Editor license please , alternatively an Editor license can be purchased on this site, or sign up for the free trial.

Description

Date and time data often forms the corner stone of many web applications and in order to facilitate easy entry of date information Editor includes the datetime field type which will show a calendar and / or time picker to the end user (based on the format set).

By default the calendar will operate with ISO8601 dates (YYYY-MM-DD - for example 2015-10-25) and requires no additional software to operate with this common and unambiguous date format. However, you may wish to show date information to your end users in a different format to increase its legibility - that can be done using the displayFormat and wireFormat options and including the Moment.js library on your page. Moment.js has a wide range of formatting options and virtually any date format can be used.

It is important to understand the difference between the display and wire formats:

  • Display format: What the end user sees inside the input.
  • Wire format: The value that is used for get and set from the field (i.e. what is transmitted over the wire to the server for saving to the database).

Prior to Editor 1.9.1 there was no wireFormat option - it expected the data to never change format at the client-side (as such the legacy display option is now mapped to displayFormat automatically). Changing the format is optional - if you want to edit the data in the format that the server sent and received, just use the defaultdisplayFormat option.

In addition to date this field type provides a time input widget as well. The format to be used can be specified using the format option and datetime will automatically determine if the calendar should be shown, the time picker or both - i.e. if a format does not include date information the calendar will not be shown, only the time picker.