myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From emp26 <empric...@comcast.net>
Subject Re: changes to convertDateTime behavior?
Date Tue, 04 Aug 2009 19:02:29 GMT

Please note in the code sample below that:

Calendar c = Calendar.getInstance( TimeZone.getTimeZone( "GMT" ) );

     startDateInput.setValue( calendar.getTime() );
     startTimeInput.setValue( calendar.getTime() );


should really read:

Calendar c = Calendar.getInstance( TimeZone.getTimeZone( "GMT" ) );

     startDateInput.setValue( c.getTime() );
     startTimeInput.setValue( c.getTime() );



emp26 wrote:
> 
> I've recently switched from JSF 1.1 to JSF 1.2 and am running into some
> apparent differences in the implementation of the convertDateTime
> component.
> 
> Here is the code snipit from the jsp:
> 
>     <t:inputText binding="#{reportMgrBean.timeUpStartDateInput}" size="10"
> maxlength="10"
>          immediate="true" value="#{reportMgrBean.timeUpStartDate}"
> title="yyyy-MM-dd"
>          forceId="true" id="timeUpStartDateInput">
>             <h:convertDateTime type="date" pattern="yyyy-MM-dd"/>
>    </t:inputText>
> 
>    <t:inputText binding="#{reportMgrBean.timeUpStartTimeInput}" size="8"
> maxlength="8"
>          immediate="true" value="#{reportMgrBean.timeUpStartTime}"
> title="HH:mm:ss"
>          forceId="true" id="timeUpStartTimeInput">
>             <h:convertDateTime type="time" pattern="HH:mm:ss"/>
>    </t:inputText>
> 
> I have the appropriate backing bean ReportMgrBean with the associated
> HtmlInput binding objects.
> When I submit the page, I see different values for the date and time
> depending on which JSF version I'm using.
> 
> The date and time fields are set in the bean using the same java.util.Date
> instance as follows:
> 
> 
>      Calendar c = Calendar.getInstance( TimeZone.getTimeZone( "GMT" ) );
> 
>      startDateInput.setValue( calendar.getTime() );
>      startTimeInput.setValue( calendar.getTime() );
> 
> 
> Under MyFaces 1.1.4, Java 1.4, tomahawk 1.1.3 and assuming the date was
> 12:20:32 on Aug 4th 2009, I get:
> 
> date = '2009-08-04 00:00:00'
> time= '1970-01-01 12:20:32'
> 
> So if I combine the two values, I end up with '2009-08-04 12:20:32', which
> is the correct submit date/time.
> 
> Under MyFaces 1.2.6, Java 1.5, tomahawk12-1.1.8, and assuming the same
> date/time values are set, I get:
> 
> date= '2009-08-04 12:20:32'
> time= '1970-01-01 12:20:32'
> 
> So for some reason the converter on the "date" part is no longer zero-ing
> out the time fields, but the "time" converter IS zero-ing out the date
> fields.  Can anyone else verify or have any ideas as to why this might be
> happening?
> 
> TIA.
> 
> 

-- 
View this message in context: http://www.nabble.com/changes-to-convertDateTime-behavior--tp24814299p24814333.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Mime
View raw message