The problem I am having is with the PrimesFaces 3.4.1 calendar. When using the popup date picker activated either through the button or on input field focus you can only sel
In faces-config.xml add this
localDateConverter
com.utility.LocalDateConverter
In the above class i.e LocaldateConverter add this below code
/**
* @param facesContext .
* @param uiComponent .
* @param input .
* @return Object .
*/
@Override
public Object getAsObject(final FacesContext facesContext, final UIComponent uiComponent, final String input) {
if (StringUtils.isBlank(input)) {
return null;
}
final String componentPattern = (String) uiComponent.getAttributes().get("datePattern");
final String patternToUse = componentPattern != null ? componentPattern : CommonConstants.OUTPUT_DATE_FORMAT;
try {
final DateFormat fmt = new SimpleDateFormat(patternToUse);
Date convertedDate = new java.sql.Date(fmt.parse(input).getTime());
return convertedDate;
} catch (Exception e) {
throw new ConverterException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Invalid Date Format", null));
}
}
/**
* @param facesContext .
* @param uiComponent .
* @param obj .
* @return String .
*/
@Override
public String getAsString(final FacesContext facesContext, final UIComponent uiComponent, final Object obj) {
if (obj==null) {
return null;
}
final Date date = (Date) obj;
return date.toString();
}