Table of Contents


Since 2.0

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.

See the ICEfaces Showcase Live Demo of this component, complete with source code.

Getting Started

                <ace:dateTimeEntry id="cal"


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).
dateTextChange Fired when date text is changed and input field loses focus.

JavaScript API

ICEfaces 3.x

The client side component object is exposed through the global variable name specified in the widgetVar attribute.

ICEfaces 4+

The "widgetVar" attribute on the ACE components has been removed in ICEfaces 4 and in its place a new "ice.ace.instance()" client JavaScript object lookup API has been introduced. The reason for this change is to enable lazy-initialization of the ACE component JavaScript objects to improve runtime performance and reduce browser memory use.

var widget = ice.ace.instance('frm:componentId);
The ice.ace.instance function requires the full client id of the component to be specified, such as "j_idt77:componentId" instead of just "componentId". To reduce the complexity of working with complete IDs with this function it may be preferable in some cases to use prependId="false" in the enclosing form (e.g. <h:form prependId="false">).
This component doesn't have a client-side API made specifically to be used by application developers. However, the component's internal methods and variables can be accessed in this way, including the underlying jQuery object and objects from underlying Javascript libraries (if applicable), and can be used for whatever purpose a developer might have in mind.

Keyboard and ARIA 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

The following ARIA roles are supported: grid, presentation, heading, columnheader, gridcell, textbox.


This component supports built-in labels. The text specified in the label attribute will be rendered next to the main input field of this component. The position specified by labelPosition will determine where this label is going to be rendered; the possible values are left, right, top, bottom, none and inField (to render the label in the field itself).

Required Indicator

The requiredIndicator attribute specifies the text to be displayed next to the main input field when this component is marked as required. When, this component is not marked as required, then the text specified in the optionalIndicator is going to be rendered. The indicatorPosition attribute determines where this indicator text is going to the rendered; the possible values are left, right, top, bottom, labelLeft, labelRight, and none.

Required Styling

Then this component is marked as required, the main input field receives the CSS class ui-state-required, otherwise, it receives the CSS class ui-state-optional. When this component is marked as invalid by the app, it will be rendered with the CSS class ui-state-error. These CSS classes can be used to add custom styling to this component, in order indicate its current state in a more visual way.

CSS Classes

The following markup represents the basic HTML structure of the component and the CSS classes it uses.

<!-- Root container -->
<span class="[user defined classes]" style="[user defined styles]">
		<div class="ui-datepicker-inline ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all">
			<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix ui-corner-all">
				<!-- Previous month button -->
				<a class="ui-datepicker-prev ui-corner-all">
					<span class="ui-icon ui-icon-circle-triangle-w">Prev</span>
				<!-- Next month button -->
				<a class="ui-datepicker-next ui-corner-all">
					<span class="ui-icon ui-icon-circle-triangle-e">Next</span>
				<!-- Current month and year -->
				<div class="ui-datepicker-title">
					<span class="ui-datepicker-month">Month</span>
					<span class="ui-datepicker-year">20??</span>
			<table class="ui-datepicker-calendar">
						<!-- The first day of the week -->
						<th class="ui-datepicker-week-end" role="columnheader">
							<span title="Sunday">Sun</span>
						<!-- ...the rest of the days of the week go here -->
					<!-- The first row of days of the month -->
						<!-- The first day of the month -->
						<td class="ui-datepicker-week-end">
							<a class="ui-state-default">1</a>
						<!-- ...the rest of the days of the month in the first row go here -->
					<!-- ...the rest of the rows of days of the month go here -->

Lenient Parsing

The lenientParsing attribute is turned on by default and it enables the lenient mode of java.text.DateFormat when converting inputs to Date objects. It is also turned on by default in java.text.DateFormat. When this is enabled, the user can enter out-of-range values and the input will still be parsed successfully (i.e. there won't be a ParseException). However, the results might be quite different from what's expected. The following example is taken from the java.util.Calendar javadoc.

With lenient interpretation, a date such as "February 942, 1996" will be treated as being equivalent to the 941st day after February 1, 1996. With strict (non-lenient) interpretation, such dates will cause an exception to be thrown.

Known Issues


Additional Resources

Tutorial on setting locale

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

© Copyright 2018 ICEsoft Technologies Canada Corp.