f:converDateTime pattern="MM/dd/yy".
When i use f:converDateTime with pattern MM/dd/yy and if user enters
date as '01/01/07', converter is converting it to 01/01/0007. While expected behaviour is '01/01/2007'.
Can some body please give solution on it?
Thanks.
Vipul Dave.
Cignex Tech Inc,
San Jose, CA
Hi...BaluC,
On the other hand,
if the pattern is "MM/dd/YYYY" & the user enters 7/7/07, the date is re-renderd as 07/07/0007.
Which JSF version & implementation work or has this issue fixed?
Regards,
Praveen
Looking to the SimpleDateFormat API [1] this is expected behaviour. Best way is to change the required input to MM/dd/yyyy and let the user enter exact that value, with 4 year digits.
[1] http://java.sun.com/j2se/1.5.0/docs/api/java/text/SimpleDateFormat.html
Thanks for the reply everybody.
Before validator , Converer is getting invoked and it is converting 'yy' to 'yyyy'.
Is there anyway to enforce user to enter 'yyyy', i mean 'MM/dd/yyyy' ?
Vipul Dave,
Cignex Tech. Inc,
San Jose, CA.
Message was edited by:
tbehkfhke
Message was edited by:
tbehkfhke
Thanks Balu C.
I am writting a custom converter by extending javax.faces.convert.DateTimeConverter class.
Can you please tell me which are the method i need to override to make it work ?
Vipul Dave.
Cignex Tech Inc,
San Jose, CA.
You need to override getAsObject() and getAsString(). The getAsObject() will be invoked when a value needs to be converted from the view (String in input field, clientside) to the controller (Object in backing bean, serverside). The getAsString() will be invoked when a value needs to be converted from the controller to the view.
This article might be of interest: http://balusc.xs4all.nl/srv/dev-jep-djl.html