Reputation: 3417
I have problem with f:convertDateTime, that it seems to use the error message javax.faces.converter.DateTimeConverter.DATE_detail when I convert time (i.e. it should use javax.faces.converter.DateTimeConverter.TIME_detail).
The issue, I'm guessing, is that I use a pattern, and thus it does not know if it's a date or a time that it is tying to convert. This is what I'm trying ("timePattern" is "hh.mm"):
<f:convertDateTime type="time" pattern="#{timePattern}" />
Even though type="time" is specified, it still uses the DATE_detail error message. Is this an bug or is my assumption that it should use the TIME_detail error message wrong, and I have to create my own converter?
Upvotes: 0
Views: 2373
Reputation: 1108632
Unfortunately, that's also what the DateTimeConverter
javadoc is telling. Here's an extract of relevance:
If a
pattern
has been specified, its syntax must conform the rules specified byjava.text.SimpleDateFormat
. Such a pattern will be used to parse, and thetype
,dateStyle
, andtimeStyle
properties will be ignored.
I must however admit that the JSF boys had to specify it explicitly in the f:convertDateTime
pdldoc as well. It's not obvious from there. I'd report an issue to the JSF boys to get them to clarify this part.
To get it to work, your best bet is either not relying on the pattern, but on type
, dateStyle
and timeStyle
(and the locale) instead, or create a custom date time converter which extends DateTimeConverter
and overrides the methods accordingly.
Upvotes: 3
Reputation: 15770
You have also to define javax.faces.converter.DateTimeConverter.TIME in your messages.
Look here: http://www.icefaces.org/JForum/posts/list/16119.page One post before last one.
Upvotes: -1