[ 
https://issues.apache.org/jira/browse/MYFACES-1836?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12582436#action_12582436
 ] 

Leonardo Uribe commented on MYFACES-1836:
-----------------------------------------

testing several combinations for type, dateStyle and timeStyle comes the 
conclusion that the part:

            else
            {
                if (_dateStyle != null) {
                    type = TYPE_BOTH;
                } else {
                    type = TYPE_TIME;
                }
           } 

Should be removed. If dateStyle and timeStyle are null, it is not reason to set 
a type. Other side effect is that you can put what you want on type, anyway 
this code does not allow types.

It's better do this:

            if (type == null)
            {
                type = DEFAULT_TYPE;
            }
            if (!TYPE_DATE.equals(type) && 
                    !TYPE_TIME.equals(type) &&
                    !TYPE_BOTH.equals(type))
            {
                type = DEFAULT_TYPE;
            }

in this way there is checking and if some invalid type set, set the default

> f:convertDateTime type=date is ignored
> --------------------------------------
>
>                 Key: MYFACES-1836
>                 URL: https://issues.apache.org/jira/browse/MYFACES-1836
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 1.2.2
>         Environment: myFaces 1.2.2
>            Reporter: Christian Küppers
>             Fix For: 1.2.3-SNAPSHOT
>
>
> Using
> <f:convertDateTime type="date" timeZone="CET"/>
> type=date is ignored and type=time is used, because of setConvertType in 
> org.apache.myfaces.taglib.core.ConvertDateTimeTag
> private void setConverterType(ELContext elContext,
>                                              DateTimeConverter converter,
>                                              ValueExpression value)
>         {
>             if (value == null) return;
>             String type = (String) 
> UIComponentELTagUtils.evaluateValueExpression(elContext, value);
>             if (type == null)
>             {
>                 type = DEFAULT_TYPE;
>             }
>             else
>             {
>                 if (_dateStyle != null) {
>                     type = TYPE_BOTH;
>                 } else {
>                     type = TYPE_TIME;
>                 }
>            }
>             converter.setType(type);
>         }

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

Reply via email to