We use:

<s:datetimepicker name="incomingAnswer" displayFormat="h:mm a"
                 type="time"
                 value="%{defaultAnswerTime}"
                 required="true"/>

where incomingAnswer and defaultAnswerTime are Strings in the hh:mm format. The string's components can then be applied to your Calendar object within the action.

As discussed in recent threads, this version of the datetimepicker has a few issues that can avoided if you use String instead of Dates.

An alternative you could try is to use javascript to combine/separate the value of the two datetimepickers to/from a single RFC3339 string, in which case the standard Date converter should work.

eskape wrote:
This problem does not concern initial values. It is about being able to edit the time part of the given Date object into the DateTimePicker component.
When we want to edit the given Date ONLY, the DateTimePicker works fine.
When using the DateTimePicker as a "TimePicker (<s:datetimepicker
type="time" />)" there seems to be a problem setting the time part of the
given date, resulting the "00:00" on the page.

When we look at the rendered code we see that value of the DateTimePicker
(currentTimePart) is "2007-06-28T00:00:00+02:00"


Musachy Barroso wrote:
You need to set the initial value with the "value" attribute (or I'm
missing
something obvious here :) )

regards
musachy

On 6/28/07, Kishen Simbhoedatpanday <[EMAIL PROTECTED]> wrote:
Hello,

We have a problem using the <s:datepicker> tag when it comes to modifying
a
date and time.
It seems there is no solution in struts2 to edit a date + time with the
datepicker tag, so we use them separately.

In our Action class we have a attribute called "currentTimePart":

private Date currentDatePart;
private Date currentTimePart;
(getter and setter are available).

In our Action method we use the following code :

public String modify() throws Exception {
        log.debug("view method called");

        Date now = new Date();
        this.setCurrentDatePart(now);
        Calendar cal = Calendar.getInstance();
        cal.setTime(now);
        cal.set(Calendar.HOUR, 10);
        cal.set(Calendar.MINUTE, 15);
        this.setCurrentTimePart(cal.getTime());

        return SUCCESS;
    }

As you can see, the current date is set in a Calendar instance.
The HOUR and MINUTE are overriden and the currentTimePart is set.

We use the following tag in the JSP page:
<s:datetimepicker name="currentDatePart" displayFormat="dd-MM-yyyy"
theme="simple" />
<br />
<s:datetimepicker name="currentTimePart" displayFormat="HH:mm"
theme="simple" type="time"/>
(Notice the type="time" attribute.)

The page successfully shows a datePicker with the correct value, but the
timePicker shows the value "00:00".

It seems that the DateTimePicker component, in struts2 or dojo framework,
does not handle the time part of the given Date object correctly.

Can anyone help us out?

Thank you!

Greetz
Kishen (and co-workers)


--
"Hey you! Would you help me to carry the stone?" Pink Floyd





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to