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 2007/08/15 00:59:30 UTC
[jira] Commented: (TRINIDAD-61) tr:validateDateTimeRange validation
fails on last day of valid range
[ https://issues.apache.org/jira/browse/TRINIDAD-61?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12519813 ]
Yee-Wah Lee commented on TRINIDAD-61:
-------------------------------------
I can repro the issue (without Facelets, convertDateTime or InputDate), using the online demo:
http://www.irian.at/trinidad-demo/faces/convertValidate/clientConvert.jspx
<tr:inputText value="#{clientValidation.date}">
<tr:validateDateTimeRange minimum="2007-01-01"
maximum="2007-12-31"/>
</tr:inputText>
1. Look for the input with "examples of values that will fail validation: any date which is not in 2007".
2. Enter 12/31/2007 and press Submit.
3. The client validator returns error "Enter a date on or between 12/31/2006
and 12/30/2007."
I believe the problem is the following code in DateFormat.js
TrDateTimeConverter.prototype._simpleDateParseImpl = function(..)
{
var parsedTime = new Date(0);
}
- new Date(0) corresponds to the Date (milliseconds) constructor, returning a date with 0 milliseconds since 1 January 1970 00:00:00 UTC, which is converted with timezone offset locally. E.g. in my timezone the Date is Dec 31 1969 16:00:00 PDT
- The code then goes to parse the submittedValue for MM/DD/YYYY and sets those on parsedTime. So, calling setFullYear(),setMonth(),setDate() gives parsedTime a value of Dec 31 2007 16:00:00 PDT
- As you notice, the hours, minutes, seconds components are still present. This value is then used in comparison against the maxValue from the server which was generated using 0 as default values for the hh:mm:ss, i.e. Dec 31 2007 00:00:00 PDT.
> tr:validateDateTimeRange validation fails on last day of valid range
> --------------------------------------------------------------------
>
> Key: TRINIDAD-61
> URL: https://issues.apache.org/jira/browse/TRINIDAD-61
> Project: MyFaces Trinidad
> Issue Type: Bug
> Components: Components
> Reporter: Thorsten Guenther
> Attachments: screenshot-1.jpg
>
>
> When used without an given converter (tr:convertDateTime), a tr:validateDateTimeRange's javaScript-validation fails (when used with facelets? not tested.) if the last day of the valid date-range was choosen in the tr:inputDate. (see screenshot). Debugging the javaScript shows that the select date was converted into for example "20.09.2007 01:00:00" (depending on timeZone) and is checked against "20.09.2007 00:00:00". So the choosen date is bigger then the max date and the validation fails.
> Using a ValueBinding and setting the maxdate to "20.09.2007 23:59:59" does not solve the problem since the time component seems to be cut of from maxDate for javaScript validation.
> A <tr:convertDateTime pattern="dd.MM.yyyy"/> is a workaround.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.