From cfaafc2674934aa3bc2da838f01ea0bc59cde807 Mon Sep 17 00:00:00 2001 From: alext Date: Thu, 19 Apr 2018 16:50:28 +0200 Subject: [PATCH] Corrected start and end datetime parsing when editing unavailabilities. --- src/assets/js/backend_calendar_default_view.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/assets/js/backend_calendar_default_view.js b/src/assets/js/backend_calendar_default_view.js index 294cb596..e3fad39f 100755 --- a/src/assets/js/backend_calendar_default_view.js +++ b/src/assets/js/backend_calendar_default_view.js @@ -97,17 +97,19 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {}; // Replace string date values with actual date objects. unavailable.start_datetime = lastFocusedEventData.start.format('YYYY-MM-DD HH:mm:ss'); + var startDatetime = Date.parseExact(unavailable.start_datetime, 'yyyy-MM-dd HH:mm:ss'); unavailable.end_datetime = lastFocusedEventData.end.format('YYYY-MM-DD HH:mm:ss'); + var endDatetime = Date.parseExact(unavailable.end_datetime, 'yyyy-MM-dd HH:mm:ss'); $dialog = $('#manage-unavailable'); BackendCalendarUnavailabilitiesModal.resetUnavailableDialog(); // Apply unavailable data to dialog. $dialog.find('.modal-header h3').text('Edit Unavailable Period'); - $dialog.find('#unavailable-start').datetimepicker('setDate', unavailable.start_datetime); + $dialog.find('#unavailable-start').datetimepicker('setDate', startDatetime); $dialog.find('#unavailable-id').val(unavailable.id); $dialog.find('#unavailable-provider').val(unavailable.id_users_provider); - $dialog.find('#unavailable-end').datetimepicker('setDate', unavailable.end_datetime); + $dialog.find('#unavailable-end').datetimepicker('setDate', endDatetime); $dialog.find('#unavailable-notes').val(unavailable.notes); }