<< View previous version | view page history | view next version >>
Overview
The dateTimeEntry component allows you to enter a date and/or a time. You can enter the date/time as text or pick the date/time from an inline or popup calendar. When entering as text, the format is as specified in the pattern attribute.
Getting Started
<ace:dateTimeEntry id="cal" value="#{datePopup.selectedDate}" timeZone="Canada/Mountain" pattern="MMM/dd/yyyy" renderAsPopup="true"/>
Attributes
TagLib Documentation This section covers attributes involved in the typical use-cases for this component. For reference, the complete taglib documentation for this component is available here. |
value is value of the component as a java.util.Date object. Default is current date and time.
renderAsPopup determines whether the calendar is displayed inline or as a popup. Default is false, i.e. inline.
The pattern attribute is used to specify the date/time format of the text input field. It also affects whether the time entry sliders appear in the calendar. The pattern characters are as detailed in the java.text.SimpleDateFormat javadoc. When an hour field is present in the pattern, the time entry sliders will appear. Some uncommon pattern characters (e.g. G, w, K, k) may not be translatable to pattern characters for the client side date/time object. The following pattern characters are supported: y, M, d, E, a, H, h, m, s, z. But even with these supported pattern characters the formatting may not be exactly the same on the server side and client side. E.g.:
- "EEEE" is long day name in Java, but translated to "DE", where "D" is short day name in datepicker and "E" is literal "E". So "Wednesday" becomes "WedE". To work around this, use "EEEEEE" instead, which is translated to long day name in datepicker ("DD").
- "m" can only mean minute in Java, but can mean month in datepicker or minute in timepicker. To avoid confusion, always use "M" in the date portion and "m" in the time portion.
timeZone is used to set the date's time zone. It can be a string or java.util.TimeZone object.
Month/year navigation is by left and right arrow images, one month at a time. To also navigate by month/year drop down lists, set navigator to true.
To enter time only, set timeOnly to true.
Multiple months can be displayed by specifying the no. of months in pages.
Event Listeners
valueChangeListener | Listener method that will be notified when a new value has been set for this input component. |
Client Behavior Events
dateSelect | Fired when a date is selected from the calendar (default event). |
JavaScript API
The client side date/time object is exposed through the global variable named by the widgetVar attribute, but currently there is no API useful to the user.
Keyboard Support
These keyboard shortcuts work only in a popup calendar without the time component. Some of them may conflict with browser keyboard shortcuts.
Keypress | Result |
---|---|
page up/down | previous/next month |
ctrl+page up/down | previous/next year |
ctrl+home | current month or open when closed |
ctrl+left/right | previous/next day |
ctrl+up/down | previous/next week |
enter | select the focused day |
ctrl+end | close and erase the date |
escape | close the calendar without selection |