Index
Edit

Date

An object signifying a point in time. Produces one or two ISO-8601 formatted date strings, depending on usage (see below).

Properties

  • optionsobject - Extra type options. See below.

Options

  • inputUtcboolean - Set to true if user input is treated as UTC (also known as Coordinated Universal Time, Military Time or "Zulu-time"). If this options is set to true, no local time data will be stored following user input (see sample output below). Default is false.
  • dateFormatstring - Controls how the date input field formats the displayed date. Use any valid Moment format option. Default is YYYY-MM-DD.
  • timeFormatstring - Controls how the time input field formats the displayed date. Use any valid Moment format option. Default is HH:mm.
  • inputDateboolean - Set to true if user is allowed to input a date. Default is true.
  • inputTimeboolean - Set to true if user is allowed to input a time. Default is true.
  • timeStepnumber - Number of minutes between each entry in the time input. Default is 15 which lets the user choose between 09:00, 09:15, 09:30 and so on.
  • calendarTodayLabelstring - Label for the "jump to today" button on the date input widget. Default is today.
  • placeholderDatestring - Placeholder for the date input field. Default is todays date, formatted as per the dateFormat option.
  • placeholderTimestring - Placeholder for the time input field. Default is current time, formatted as per the timeFormat option.

Example: Basic usage

{
  title: 'Release date',
  name: 'releaseDate',
  type: 'date'
}

Example: The whole enchilada

{
  title: 'Release date',
  name: 'releaseDate',
  type: 'date',
  options: {
    inputUtc: false,
    dateFormat: 'YYYY-MM-DD',
    timeFormat: 'HH:mm',
    inputDate: true,
    inputTime: true,
    timeStep: 15,
    calendarTodayLabel: 'Today',
    placeholderDate: '2017-04-18',
    placeholderTime: '11:29'
  }
}

Sample output when inputUtc is true:

{
  "_type": "date",
  "utc": "2017-04-18T12:29:00Z"
}

Sample output when inputUtc is false:

{
  "_type": "date",
  "local": "2017-04-18T11:29:00+01:00",
  "utc": "2017-04-18T12:29:00Z",
  "timezone": "Europe/Oslo",
  "offset": 60 // utc offset in minutes
}

Previous: SpanNext: Reference