You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Yee-Wah Lee (JIRA)" <de...@myfaces.apache.org> on 2010/12/02 22:24:11 UTC

[jira] Created: (TRINIDAD-1967) DateTimeRangeValidator gives false failure if server specifies timezone attribute or timezone specified in trinidad-config.xml

DateTimeRangeValidator gives false failure if server specifies timezone attribute or timezone specified in trinidad-config.xml
------------------------------------------------------------------------------------------------------------------------------

                 Key: TRINIDAD-1967
                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1967
             Project: MyFaces Trinidad
          Issue Type: Bug
          Components: Components
    Affects Versions: 1.2.13-core 
            Reporter: Yee-Wah Lee


This is a regression caused by Trinidad-1920.  In that fix, an ISO-Date format was used to create minISO/maxISO strings on the validator so the min/maxDate could be sent down without loss of information. However the DateFormat was not created with the timezone of the component converter, so it would send down strings that specified different values causing false validation. 

1. Modify the following example in trinidad-demo/clientConvert.jspx and run it (this example uses Europe/Stockholm timezone, any TZ different from server JDK timezone will suffice).
              <tr:inputText id="mdf5" value="#{date.date2}"
                                    label="date converter and a validator that sets a maximum date of tonight">
                <f:facet name="help">
                  <tr:outputText value="examples of values that will fail validation: any date later than tonight 11:59 PM"/>
                </f:facet>
                <tr:convertDateTime type="both" timezone="Europe/Stockholm"/>
                <tr:validateDateTimeRange maximum="#{date.tonightNearMidnight}"/>
              </tr:inputText>

2. In the input box, type in the max (tonight 11:59pm),e.g. 12/2/2010 11:59pm and Submit. 

3. Get an error about failing validation although it is within bounds. 

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


[jira] Commented: (TRINIDAD-1967) DateTimeRangeValidator gives false failure if server specifies timezone attribute or timezone specified in trinidad-config.xml

Posted by "Yee-Wah Lee (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TRINIDAD-1967?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12966298#action_12966298 ] 

Yee-Wah Lee commented on TRINIDAD-1967:
---------------------------------------

Debugging notes.
Assume 
- Server is running PST so maxDate = #{date.tonightNearMidnight} returns 2010-12-2 11:59pm PST
- The component converter, or trinidad-config.xml, specifies timezone=Europe/Stockholm

1. trinidad-impl/DateTimeConverter.java#getClientValidation() returns
- maxStr = 12/3/2010 8:59am
- maxISOStr = 2010-12-2 11:59pm

2. CoreFormat.js, TrDateTimeRangeValidator.prototype.validate() does:
    maxDate = isoConverter.getAsObject (this._maxISODate);

which returns the date of "2010-12-2 11:59pm". Comparing against what the user enters (2010-12-3 8:59am),  it gives a validation error that the value entered is greater than the maximum, so the client is being stricter than the server which would accept up to 2010-12-3 8:5am (GMT+1). 

> DateTimeRangeValidator gives false failure if server specifies timezone attribute or timezone specified in trinidad-config.xml
> ------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TRINIDAD-1967
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1967
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>          Components: Components
>    Affects Versions: 1.2.13-core 
>            Reporter: Yee-Wah Lee
>
> This is a regression caused by Trinidad-1920.  In that fix, an ISO-Date format was used to create minISO/maxISO strings on the validator so the min/maxDate could be sent down without loss of information. However the DateFormat was not created with the timezone of the component converter, so it would send down strings that specified different values causing false validation. 
> 1. Modify the following example in trinidad-demo/clientConvert.jspx and run it (this example uses Europe/Stockholm timezone, any TZ different from server JDK timezone will suffice).
>               <tr:inputText id="mdf5" value="#{date.date2}"
>                                     label="date converter and a validator that sets a maximum date of tonight">
>                 <tr:convertDateTime type="both" timezone="Europe/Stockholm"/>
>                 <tr:validateDateTimeRange maximum="#{date.tonightNearMidnight}"/>
>               </tr:inputText>
> 2. If you have a hint on the validator, it would display max with the timezone of the converter. For example, if server is PST, and I'm running on 2010-12-2, the maxDate created is 2010-12-2 11:59 pm PST which converts to 2010-12-3 8:59am  (GMT+1).  So the maximum I can enter on the client is 12/3/2010 8:59am. 
> 3. In the input box, type in the max  and Submit.   Get an error about failing validation although it is within bounds. 

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


[jira] Resolved: (TRINIDAD-1967) DateTimeRangeValidator gives false failure if server specifies timezone attribute or timezone specified in trinidad-config.xml

Posted by "Gabrielle Crawford (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/TRINIDAD-1967?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gabrielle Crawford resolved TRINIDAD-1967.
------------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.0.4-core 

> DateTimeRangeValidator gives false failure if server specifies timezone attribute or timezone specified in trinidad-config.xml
> ------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TRINIDAD-1967
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1967
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>          Components: Components
>    Affects Versions: 1.2.13-core 
>            Reporter: Yee-Wah Lee
>             Fix For: 2.0.0.4-core 
>
>         Attachments: 12123_1967.diff, trunk_1967.diff
>
>
> This is a regression caused by Trinidad-1920.  In that fix, an ISO-Date format was used to create minISO/maxISO strings on the validator so the min/maxDate could be sent down without loss of information. However the DateFormat was not created with the timezone of the component converter, so it would send down strings that specified different values causing false validation. 
> 1. Modify the following example in trinidad-demo/clientConvert.jspx and run it (this example uses Europe/Stockholm timezone, any TZ different from server JDK timezone will suffice).
>               <tr:inputText id="mdf5" value="#{date.date2}"
>                                     label="date converter and a validator that sets a maximum date of tonight">
>                 <tr:convertDateTime type="both" timezone="Europe/Stockholm"/>
>                 <tr:validateDateTimeRange maximum="#{date.tonightNearMidnight}"/>
>               </tr:inputText>
> 2. If you have a hint on the validator, it would display max with the timezone of the converter. For example, if server is PST, and I'm running on 2010-12-2, the maxDate created is 2010-12-2 11:59 pm PST which converts to 2010-12-3 8:59am  (GMT+1).  So the maximum I can enter on the client is 12/3/2010 8:59am. 
> 3. In the input box, type in the max  and Submit.   Get an error about failing validation although it is within bounds. 

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