From 81b3eb9bd3e2c8a13e75deeca42d46c5e0b55b59 Mon Sep 17 00:00:00 2001 From: alextselegidis Date: Thu, 20 Oct 2016 23:39:25 +0200 Subject: [PATCH] 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. --- src/assets/js/backend_calendar_appointments_modal.js | 10 ++++------ .../js/backend_calendar_unavailabilities_modal.js | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/assets/js/backend_calendar_appointments_modal.js b/src/assets/js/backend_calendar_appointments_modal.js index da81e650..d479415c 100644 --- a/src/assets/js/backend_calendar_appointments_modal.js +++ b/src/assets/js/backend_calendar_appointments_modal.js @@ -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'); diff --git a/src/assets/js/backend_calendar_unavailabilities_modal.js b/src/assets/js/backend_calendar_unavailabilities_modal.js index 6c992980..127caf3c 100644 --- a/src/assets/js/backend_calendar_unavailabilities_modal.js +++ b/src/assets/js/backend_calendar_unavailabilities_modal.js @@ -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.