Do not use the "getDate" method of the datepicker as it changes the timezone for dates between the 30nth of October and the 25th of March.

This commit is contained in:
alextselegidis 2016-10-20 23:39:25 +02:00
parent e6082ab2e0
commit 81b3eb9bd3
2 changed files with 6 additions and 8 deletions

View File

@ -49,10 +49,8 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
// ID must exist on the object in order for the model to update the record and not to perform
// an insert operation.
var startDatetime = $dialog.find('#start-datetime')
.datepicker('getDate').toString('yyyy-MM-dd HH:mm:ss');
var endDatetime = $dialog.find('#end-datetime')
.datepicker('getDate').toString('yyyy-MM-dd HH:mm:ss');
var startDatetime = Date.parse($dialog.find('#start-datetime').val()).toString('yyyy-MM-dd HH:mm:ss');
var endDatetime = Date.parse($dialog.find('#end-datetime').val()).toString('yyyy-MM-dd HH:mm:ss');
var appointment = {
id_services: $dialog.find('#select-service').val(),
@ -483,8 +481,8 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
}
// Check appointment start and end time.
var start = $('#start-datetime').datepicker('getDate');
var end = $('#end-datetime').datepicker('getDate');
var start = Date.parse($('#start-datetime').val());
var end = Date.parse($('#end-datetime').val());
if (start > end) {
$dialog.find('#start-datetime').parents('.form-group').addClass('has-error');
$dialog.find('#end-datetime').parents('.form-group').addClass('has-error');

View File

@ -30,8 +30,8 @@ window.BackendCalendarUnavailabilitiesModal = window.BackendCalendarUnavailabili
*/
$('#manage-unavailable #save-unavailable').click(function() {
var $dialog = $('#manage-unavailable');
var start = $dialog.find('#unavailable-start').datetimepicker('getDate');
var end = $dialog.find('#unavailable-end').datetimepicker('getDate');
var start = Date.parse($dialog.find('#unavailable-start').val());
var end = Date.parse($dialog.find('#unavailable-end').val());
if (start > end) {
// Start time is after end time - display message to user.