在我的角度js代码中,我将日期作为字符串:
self.submit = function () {
console.log("in voice prompt component - submit");
console.log(self.voice);
self.fromDate = new Date(self.fromDate);
$http.put('http://localhost:8082/api/Voices/updateVoice', self.fromDate).then(
function successCallback(response) {
self.voices = response.data;
}, function errorCallback(response) {
// called asynchronously if an error occurs
// or server returns response with an error status.
console.log(response);
});
}
我想将它发送到我的服务器:来自Java 8的LocalDate
@Path("/updateVoice")
@PUT
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public void updateVoice(LocalDate fromDate) throws Exception {
但是我收到了错误:
Can not construct instance of java.time.LocalDate: no String-argument constructor/factory method to deserialize from String value ('2017-04-04T21:00:00.000Z')