(Quick Reference)

datePicker

Purpose

Creates a date picker which renders as selects for the day,month,year,hour and second of the day.

Examples

<g:datePicker name="myDate" value="${new Date()}"
              noSelection="['':'-Choose-']"/>
<g:datePicker name="myDate" value="${new Date()}" precision="day" years="${1930..1970}"/>
<g:datePicker name="myDate" value="${new Date()}" precision="day" years="[1930, 1940, 1950, 1960, 1970]"/>

Description

Attributes

  • name (required) - The name of the date picker field set
  • value (optional) - The current value of the date picker; defaults to now if not specified
  • precision (optional) - The desired granularity of the date to be rendered
    • Valid values are 'year', 'month', 'day', 'hour', or 'minute'
    • Defaults to 'minute' if not specified
    • Uses default values for the non-rendered date components. Default values...
      • month = January
      • day = 1st day of the month
      • hour = 00
      • minute = 00
  • noSelection (optional) - A single-entry map detailing the key and value to use for the "no selection made" choice in the select box. If there is no current selection this will be shown as it is first in the list, and if submitted with this selected, the key that you provide will be submitted. Typically this will be blank.
  • years (optional) - A list or range of years to display, in the order specified. i.e. specify 2007..1900 for a reverse order list going back to 1900. If this attribute is not specified, a range of years from the current year - 100 to current year + 100 will be shown.

Source

Show Source