BUG: DateTimeConverter or some flaky JDK stuff ?

From: Matthias Wessendorf <>
Date: Wed, 1 Jul 2009 07:43:49 +0200


following snippet:
         <h:inputText value="#{}" immediate="true">
           <f:convertDateTime type="both" timeStyle="full"
           pattern="dd.MM.yyyy HH:mm' Uhr '"
         <h:commandButton value="Submit" type="submit"/>

and now, enter this (in your mind remove the |):
|30.06.2009 13:10 Uhr |

the underlying parse() on (Simple)DateFormat strips the empty space away.
And it fails.

On rendering (getAsString) the rendered result is this:
|30.06.2009 13:10 Uhr |

again, notice the last empty string.

Now, doing this, with vanilla Java:

     DateFormat df =
DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.FULL,
     df.setTimeZone(TimeZone.getTimeZone ("America/New_York"));
         SimpleDateFormat sdf = (SimpleDateFormat)df;
         sdf.applyPattern("dd.MM.yyyy HH:mm' Uhr '");
     System.out.println(df.format(new Date()));
             sdf.parse("30.06.09 11:43 Uhr");

The PARSE fails, as there is no " " after the German word Uhr.
The String, returned by this line: df.format(new Date()) actually
has one " " at the very end...

any ideas ?

Sure I f**k our Trinidad converter by checking for endsWith("Uhr"),
but that is a little bit sucky... :-)


Matthias Wessendorf