You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Zhai, Warren [IT]" <wa...@citigroup.com> on 2005/08/04 21:03:39 UTC
issues
I am looking through the <x:inputCalendar /> issues to see if anyone else has reported the left1.gif and right1.gif not loading on startup problem I am facing and came across the following I already resolved on my local copy.
MYFACES-65
Only ' ' (space), '.' (dot), '/' slash and (of course) patterns indicaiong date fields are valid. All date formats that are recognized by Java should be valid. For example, You can use 'yyyy-MM-dd' as date format in Java classes, but You cannot use this in inputCalendar - '-' (dash) mark is invalid.
The problem was not with the underlying .js file. It is with the calendar renderer in the following method:
/**
* @param string
* @return
*/
private String createJSPopupFormat() {
SimpleDateFormat defaultDateFormat = getDefaultDateFormat();
popupDateFormat = defaultDateFormat.toPattern();
StringBuffer jsPopupDateFormat = new StringBuffer();
for (int i = 0; i < popupDateFormat.length(); i++) {
char c = popupDateFormat.charAt(i);
if (c == 'M')
jsPopupDateFormat.append('M');
else if (c == 'd')
jsPopupDateFormat.append('d');
else if (c == 'y')
jsPopupDateFormat.append('y');
else if (c == ' ')
jsPopupDateFormat.append(' ');
else if (c == '.')
jsPopupDateFormat.append('.');
else if (c == '/')
jsPopupDateFormat.append('/');
}
return jsPopupDateFormat.toString().trim();
}
The .js file is in fact passed over a date format of 'yyyyMMdd' when the user specifies the date format as 'yyyy-MM-dd' since the '-' character is not preserved.
Simply append the
else if (c == '-')
jsPopupDateFormat.append('-');
line shown above solves the problem and would allow formats such as 'yyyy-MM-dd' etc.
BTW. doesn't anyone else have the problem with the left1.gif/right1.gif not displaying correctly on startup?
Warren
Re: issues
Posted by Bruno Aranda <br...@gmail.com>.
Looking at the current code I see that the dash ('-') is already
accepted, so I think that MYFACES-65 will be working ok...
if(c=='M' || c=='d' || c=='y' || c==' ' || c=='.' || c=='/' || c=='-')
jsPopupDateFormat.append(c);
On the other hand, the problem with left1/right1 at startup is a IE
problem. I promiss a beer for the one who finds the reason! ;-)
Regards,
Bruno
2005/8/4, Zhai, Warren [IT] <wa...@citigroup.com>:
> I am looking through the <x:inputCalendar /> issues to see if anyone else has reported the left1.gif and right1.gif not loading on startup problem I am facing and came across the following I already resolved on my local copy.
>
> MYFACES-65
> Only ' ' (space), '.' (dot), '/' slash and (of course) patterns indicaiong date fields are valid. All date formats that are recognized by Java should be valid. For example, You can use 'yyyy-MM-dd' as date format in Java classes, but You cannot use this in inputCalendar - '-' (dash) mark is invalid.
>
> The problem was not with the underlying .js file. It is with the calendar renderer in the following method:
>
> /**
> * @param string
> * @return
> */
> private String createJSPopupFormat() {
>
> SimpleDateFormat defaultDateFormat = getDefaultDateFormat();
> popupDateFormat = defaultDateFormat.toPattern();
>
> StringBuffer jsPopupDateFormat = new StringBuffer();
>
> for (int i = 0; i < popupDateFormat.length(); i++) {
> char c = popupDateFormat.charAt(i);
>
> if (c == 'M')
> jsPopupDateFormat.append('M');
> else if (c == 'd')
> jsPopupDateFormat.append('d');
> else if (c == 'y')
> jsPopupDateFormat.append('y');
> else if (c == ' ')
> jsPopupDateFormat.append(' ');
> else if (c == '.')
> jsPopupDateFormat.append('.');
> else if (c == '/')
> jsPopupDateFormat.append('/');
> }
> return jsPopupDateFormat.toString().trim();
>
> }
>
> The .js file is in fact passed over a date format of 'yyyyMMdd' when the user specifies the date format as 'yyyy-MM-dd' since the '-' character is not preserved.
>
> Simply append the
> else if (c == '-')
> jsPopupDateFormat.append('-');
> line shown above solves the problem and would allow formats such as 'yyyy-MM-dd' etc.
>
> BTW. doesn't anyone else have the problem with the left1.gif/right1.gif not displaying correctly on startup?
>
> Warren
>