Ashwin Prabhu created TRINIDAD-2485:
---------------------------------------
Summary: Some attribute behaviors in tr:validateDateRestriction
donot match their documentation
Key: TRINIDAD-2485
URL: https://issues.apache.org/jira/browse/TRINIDAD-2485
Project: MyFaces Trinidad
Issue Type: Bug
Components: Components
Affects Versions: 2.1.0-core
Reporter: Ashwin Prabhu
There are several issues in tr:validateDateRestriction. Here's a attribute-wise
list of problems which need to be fixed:
Attribute: invalidDays
The start and end dates passed into the method getDateList of DateListProvider
needs to be 24 hour wide. Currently the same date is passed for start and end
range, defeating the purpose of haveing 2 parameters. The current arrangement
works only if DateListProvider strictly goes by the date part and ignores the
time component in the start and end range.
The documentation of DateListProvider has this:
rangeStart - The start of the range for which dates are being requested.
rangeEnd - The end of the range for which dates are being requested.
Although not literallly mentioned, the implicit messaging of the parmater
description suggests the time part of the date range cannot be ignored.
Attribute: messageDetailInvalidDaysOfWeek
The documentation of message parameters states this:
{0} the label that identifies the component
{1} value entered by the user
{2} the invalid weekday
Currently the values passed as 3rd parameter ({2}) on the client contains a
list of all the days of the week, but for the user selected week. This behavior
is wrong as per the documentation. To see this behavior in acion please visit
http://example.irian.at/trinidad-demo/faces/convertValidate/dateRestrictionValidate.jspx
and select any monday in the 3rd input Date. You will see a error message
"Enter a date that is on one of the following days: Tuesday, Wednesday,
Thursday, Friday, Saturday, Sunday". Here both the message and the week-day
parameters are worng. On the server however this is done as per the
documentation, but the passed in weekday is not localized, but picked up from
the internal _dayMap map containing the week days as "sun", "mon"...."sat" .
To summarize,
The client validator needs to pass in parameters as per the documentation.
The server validator needs to localize the substituted week days.
THe message bundle string is currently "Enter a date that falls on one of the
following days: {0}" also needs to be changed to match the intention in the tag
document.
Attribute: messageDetailInvalidMonths
The documentation of message parameters states this:
{0} the label that identifies the component
{1} value entered by the user
{2} the invalid month
Currently the values passed as 3rd parameter ({2}) on the client contains a
list of all the months of the year, but for the user selected month. This
behavior is wrong as per the documentation. To see this behavior in acion
please visit
http://example.irian.at/trinidad-demo/faces/convertValidate/dateRestrictionValidate.jspx
and select any day in November in the 2rd input Date. You will see a error
message "November/December dates are not allowed here!
Enter a date in one of the following months: January, February, March, April,
May, June, July, August, September, October". Here both the message and the
month parameters are worng. On the server however this is done as per the
documentation, but the passed in month is not localized, but picked up from the
internal _monthMap map containing the months as "jan", "feb"...."dec" .
--
This message was sent by Atlassian JIRA
(v6.2#6252)