Register the non-timezoned time in the database.

This commit is contained in:
Alex Tselegidis 2020-10-21 21:35:40 +03:00
parent 3371a8e0a2
commit 69a0c2a48f
2 changed files with 6 additions and 3 deletions

View file

@ -632,7 +632,7 @@ window.FrontendBook = window.FrontendBook || {};
data.appointment = { data.appointment = {
start_datetime: $('#select-date').datepicker('getDate').toString('yyyy-MM-dd') start_datetime: $('#select-date').datepicker('getDate').toString('yyyy-MM-dd')
+ ' ' + Date.parse($('.selected-hour').text()).toString('HH:mm') + ':00', + ' ' + Date.parse($('.selected-hour').data('value') || '').toString('HH:mm') + ':00',
end_datetime: calculateEndDatetime(), end_datetime: calculateEndDatetime(),
notes: $('#notes').val(), notes: $('#notes').val(),
is_unavailable: false, is_unavailable: false,
@ -666,7 +666,7 @@ window.FrontendBook = window.FrontendBook || {};
// Add the duration to the start datetime. // Add the duration to the start datetime.
var startDatetime = $('#select-date').datepicker('getDate').toString('dd-MM-yyyy') var startDatetime = $('#select-date').datepicker('getDate').toString('dd-MM-yyyy')
+ ' ' + Date.parse($('.selected-hour').text()).toString('HH:mm'); + ' ' + Date.parse($('.selected-hour').data('value') || '').toString('HH:mm');
startDatetime = Date.parseExact(startDatetime, 'dd-MM-yyyy HH:mm'); startDatetime = Date.parseExact(startDatetime, 'dd-MM-yyyy HH:mm');
var endDatetime; var endDatetime;

View file

@ -90,7 +90,7 @@ window.FrontendBookApi = window.FrontendBookApi || {};
var selectedTimezone = $('#select-timezone').val(); var selectedTimezone = $('#select-timezone').val();
var timeFormat = GlobalVariables.timeFormat === 'regular' ? 'h:mm a' : 'HH:mm'; var timeFormat = GlobalVariables.timeFormat === 'regular' ? 'h:mm a' : 'HH:mm';
response.forEach(function (availableHour, index) { response.forEach(function (availableHour) {
var availableHourMoment = moment var availableHourMoment = moment
.tz(selectedDate + ' ' + availableHour + ':00', providerTimezone) .tz(selectedDate + ' ' + availableHour + ':00', providerTimezone)
.tz(selectedTimezone); .tz(selectedTimezone);
@ -98,6 +98,9 @@ window.FrontendBookApi = window.FrontendBookApi || {};
$('#available-hours').append( $('#available-hours').append(
$('<button/>', { $('<button/>', {
'class': 'btn btn-outline-secondary btn-block shadow-none available-hour', 'class': 'btn btn-outline-secondary btn-block shadow-none available-hour',
'data': {
'value': availableHour
},
'text': availableHourMoment.format(timeFormat) 'text': availableHourMoment.format(timeFormat)
}) })
); );