jsr372-experts@javaserverfaces-spec-public.java.net

[jsr372-experts] (JAVASERVERFACES_SPEC_PUBLIC-1370) Provide Converters for Java 8 Date and Time API (JSR 310)

From: Edward Burns <edward.burns_at_oracle.com>
Date: Thu, 1 Oct 2015 09:59:02 -0700

>>>>> On Wed, 30 Sep 2015 13:41:34 +0200, Michael Müller <michael.mueller_at_mueller-bruehl.de> said:

MM> The pattern only would not fit our requirement.

MM> Need to display date with century (e.g. German format 30.09.2015),
MM> but allow input both with and without century.

MM> 30.09.2015
MM> 30.09.15

None of our converters support an "or" concept for getAsObject(String).

If this feature is to be added, it must be requested as a separate
feature request.

MM> And vice versa: input both, output without century.

MM> Would this be possible?

>>>>> On Wed, 30 Sep 2015 13:46:04 +0200, Michael Müller <michael.mueller_at_mueller-bruehl.de> said:

MM> Something like
MM> pattern="MM/dd/yyyy" additionalInputPattern="MM/dd/yy"

>>>>> On Wed, 30 Sep 2015 07:06:38 -0500, Josh Juneau <juneau001_at_gmail.com> said:

JJ> Hi Michael-
JJ> Yes, I believe we should be able to include a new pattern into the
JJ> converter. We'll need to pass the pattern to the DateTimeFormatter (
JJ> https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html),
JJ> which appears to be capable of returning only the year without the century.

Let's label Michael's story "input conversion differs from output
conversion". I'm dropping the "input both with and without century"
from the story as it is a separate feature request. We already support
this story: use two different components, each with a differently
configured <f:convertDateTime>.

I just verified this works with the prototype I have in topic branch
JAVASERVERFACES-4070:

<input type="text" jsf:id="localDate" value="#{backingBean.localDate}">
    <f:convertDateTime type="localDate" pattern="dd.MM.uuuu" />
</input>
            
<h:outputText id="localDateValue" value="#{backingBean.localDate}">
    <f:convertDateTime type="localDate" pattern="dd.MM.uu" />
</h:outputText>

Josh, considering the timing of this, please use my work in the topic
branch as your starting point. I'm getting very close to cutting the
EDR and we may have to just stick with that for now.

Thanks,

Ed

-- 
| edward.burns_at_oracle.com | office: +1 407 458 0017
| 25 Business days til JavaOne 2015
| 40 Business days til DOAG 2015