I know what you are saying.  It's not exactly a show stopper, but definitely 
annoying.

Warren

-----Original Message-----
From: CONNER, BRENDAN (SBCSI) [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 04, 2005 3:08 PM
To: MyFaces Discussion
Subject: RE: inputCalendar /> issues


Yes, we've had that issue, too (although it hasn't bubbled up to the top
of our priority list yet!).

Good catch.

- Brendan

-----Original Message-----
From: Zhai, Warren [IT] [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 04, 2005 2:04 PM
To: MyFaces Discussion
Subject: <x:inputCalendar /> 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

Reply via email to