I'm facing the following problem, I have a play application with angular and java. In one page the client selects in a calendar some date and time for example 2015-04-03 15:00 this data is put in a JavaScript object as a Date and later this data is submit to my server but it seems the server is converting this date/time to his timezone saving 2015-04-03 16:00 instead of 15:00 as the client side sent.
After I submit the data to the server where it is persisted in the database when I reload the page shows the date with 1 hour less
Sending data to server. Notice that there is a console.info() that prints the date time. It's printing the correct date/time. The date/time selected by user.
$scope.confirmCallback = function () {
$scope.schedule.client = $scope.client;
$scope.schedule.type = 'CONTACT';
console.info($scope.schedule.date); //PRINTS OK DATE/TIME
ScheduleRepository.create($scope.schedule).then(function () {
Alert.success('views.schedule.message.successSaved');
$scope.schedule = {};
$scope.tableSchedules.reload();
}, function () {
});
}
Here is on my server side on a controller that receives the request. The moment the request gets on the server if I inspect the json I can see that the date time value is different from the one I sent. I guess is something related to timezone on client side and server side.
@Dynamic("CREATE_SCHEDULE, EDIT_SCHEDULE")
public static Result save() {
try {
JsonNode request = request().body().asJson();//SHOWS DIFFERENT DATE/TIME
ScheduleClient scheduleClient = JSONUtils.fromJson(request, ScheduleClient.class);
Any suggestions how to solve this problem? Thanks in advance