Corrected time format use in booking page.

This commit is contained in:
alext 2018-03-08 14:59:13 +01:00
parent 632f7539eb
commit 43b9cf678b

View file

@ -71,6 +71,8 @@ window.FrontendBookApi = window.FrontendBookApi || {};
var currColumn = 1; var currColumn = 1;
$('#available-hours').html('<div style="width:80px; float:left;"></div>'); $('#available-hours').html('<div style="width:80px; float:left;"></div>');
var timeFormat = GlobalVariables.timeFormat === 'regular' ? 'h:mm tt' : 'HH:mm';
$.each(response, function (index, availableHour) { $.each(response, function (index, availableHour) {
if ((currColumn * 10) < (index + 1)) { if ((currColumn * 10) < (index + 1)) {
currColumn++; currColumn++;
@ -78,7 +80,7 @@ window.FrontendBookApi = window.FrontendBookApi || {};
} }
$('#available-hours div:eq(' + (currColumn - 1) + ')').append( $('#available-hours div:eq(' + (currColumn - 1) + ')').append(
'<span class="available-hour">' + Date.parse(availableHour).toString(GlobalVariables.timeFormat) + '</span><br/>'); '<span class="available-hour">' + Date.parse(availableHour).toString(timeFormat) + '</span><br/>');
}); });
if (FrontendBook.manageMode) { if (FrontendBook.manageMode) {
@ -87,7 +89,7 @@ window.FrontendBookApi = window.FrontendBookApi || {};
$('.available-hour').filter(function () { $('.available-hour').filter(function () {
return $(this).text() === Date.parseExact( return $(this).text() === Date.parseExact(
GlobalVariables.appointmentData.start_datetime, GlobalVariables.appointmentData.start_datetime,
'yyyy-MM-dd HH:mm:ss').toString(GlobalVariables.timeFormat); 'yyyy-MM-dd HH:mm:ss').toString(timeFormat);
}).addClass('selected-hour'); }).addClass('selected-hour');
} else { } else {
// Set the first available hour as the default selection. // Set the first available hour as the default selection.