I have the following date generated in AngularJS: 2015-09-14T18:38:03.637Z
when I try to give a POST the following error occurs in the backend:
Caused by: java.text.ParseException: Unparseable date: "2015-09-14T18: 38: 03.637Z" at java.text.DateFormat.parse (Unknown Source) at br.com.caelum.vraptor.serialization.gson.DateGsonConverter.deserialize (DateGsonConverter.java:59) ... 56 more
In angular I do this: contato.data = new Date();
the attribute that will receive that date in backend
is of type Java.util.Date
. I've tried it this way:
contato.data = $filter('date')(new Date(), 'yyyy-MM-dd');
But it did not work. How can I convert this date?
Method that does POST:
@Post
@Path(value = "/salvar")
@Consumes(value = "application/json", options = WithoutRoot.class)
public void salvar(Contato contato) {
System.out.println("Empresa: " + contato.getNome());
contatoDAO.salvar(contato);
}