Joda-Time complaining that my input is malformed but i am using the same format option:
'd-M-y'
in both the input and the Joda-Time formatter.
DateTimeFormatter formatter = DateTimeFormat.forPattern("d-M-y");
DateTime dtFrom = formatter.parseDateTime(dateFrom);
The date is grabbed from a jquery datepicker field setup like this:
$( "#from" ).datepicker({
dateFormat: 'd-M-y',
defaultDate: null,
changeMonth: true,
minDate: 0,
numberOfMonths: 1,
onClose: function( selectedDate ) {
$( "#to" ).datepicker( "option", "minDate", selectedDate );
}
});
The console is outputting this and you can also see the input there too, which i believe is correct
WARNING: StandardWrapperValve[SearchServlet]: PWC1406: Servlet.service() for servlet SearchServlet threw exception
java.lang.IllegalArgumentException: Invalid format: "26-Jan-13" is malformed at "Jan-13"
Similar to the
SimpleDateFormatclass, a singleMis used to parse a numeric month value. You can useMMMto parse text-based months:From DateTimeFormat: