You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Eric Price (JIRA)" <de...@myfaces.apache.org> on 2009/08/05 04:08:15 UTC

[jira] Created: (MYFACES-2305) Inconsistent behavior in convertDateTime between MyFaces 1.1 and 1.2

Inconsistent behavior in convertDateTime between MyFaces 1.1 and 1.2
--------------------------------------------------------------------

                 Key: MYFACES-2305
                 URL: https://issues.apache.org/jira/browse/MYFACES-2305
             Project: MyFaces Core
          Issue Type: Bug
    Affects Versions: 1.2.6
         Environment: Java 1.5, MyFaces 1.2.6, tomahawk12-1.1.8, linux
            Reporter: Eric Price
            Priority: Minor


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">
<f: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">
<f:convertDateTime type="time" pattern="HH:mm:ss"/>
</t:inputText>

I have the appropriate backing bean ReportMgrBean with the associated HtmlInputText binding objects.
When I submit the page, I see different values for the date and time depending on which JSF version I'm using.

When the page loads 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( c.getTime() );
startTimeInput.setValue( c.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 when the page is submitted, 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. 


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.