Hi,
following snippet:
<h:form>
<h:messages/>
<h:inputText value="#{input.date}" immediate="true">
<f:convertDateTime type="both" timeStyle="full"
timeZone="America/New_York"
pattern="dd.MM.yyyy HH:mm' Uhr '"
locale="de"
/>
</h:inputText>
<h:commandButton value="Submit" type="submit"/>
</h:form>
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,
Locale.GERMAN);
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
--
Matthias Wessendorf
blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf