DateTime widget

<<TableOfContents: execution failed [Argument "maxdepth" must be an integer value, not "[2]"] (see also the log)>>


A widget that permits you to select a date and a time too, in the same container.


There is a date widget, from mattkruse lib. It's a very useful one, but there is a lack of time support to select a schedule.

There are other solutions :

So, I added time support to the mattkruse calendar widget to have an easy to use UI and binding.

I use date and time formats used by SimpleDateFormat


The date time widget may be customized a little :

It looks like this :


The CP_tmpReturnFunction(y,m,d) function has been redesigned in function CP_tmpReturnFunction(y,m,d,hh,mm,ss) to manage time information.

2 functions have been written :

A few lines have been added too to manage initialization.


The patch is available there there for the moment.

I asked to Matt Kruse if he agrees to patch its work. Finally, after 2 attempts, I had no answer from him. So I don't think the patch will be applied on the original work. But, SylvainWallez did it in the one used in Cocoon, it's ok :-)


In form definition, a date field is declared, and the display format wanted too.

<fd:field id="dtstart">
    <fd:datatype base="date">
            <fd:pattern>dd/MM/yyyy HH:mm:ss</fd:pattern>

To avoid problem while manipulating dates between different applications, I use standart date time formats for storage. So, in the binding file, I have the following convertor :

<fb:value id="dtstart" path="dtstart">
    <fd:convertor datatype="date" type="formatting" variant="datetime">

To conclude, the mattkruse lib is initialized :

<script type="text/javascript" src="resources/forms/mattkruse-lib/mattkruse-lib.js"></script>
<script type="text/javascript" src="resources/forms/mattkruse-lib/CalendarPopup.js"></script>
<script type="text/javascript">
    // Setup calendar
    var forms_calendar = CalendarPopup(175,180);
    // New definition to display DateTimeDropdowns
<link rel="stylesheet" type="text/css" href="resources/forms/css/forms-calendar.css"/>

It's up to you now :-)

More information

This web page is available in html format on You may have help on cocoon or bluexml mailing lists.


Repository/DateTime (last edited 2009-09-20 23:41:16 by localhost)