Updated timepicker addon extension which fixes timezone issues (fixes #220).

This commit is contained in:
alextselegidis 2016-10-23 23:12:19 +02:00
parent 457e59b502
commit e6015c253d
3 changed files with 814 additions and 609 deletions

View file

@ -186,16 +186,33 @@ li.language:hover {
/* JQUERY UI DATETIME PICKER ADDON /* JQUERY UI DATETIME PICKER ADDON
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; padding: 6px; } .ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
.ui-timepicker-div dl { text-align: left; padding: 0 15px; color: #575757; } .ui-timepicker-div dl { text-align: left; }
/*.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }*/ .ui-timepicker-div dl dt { float: left; clear:left; padding: 0 0 0 5px; }
/*.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }*/ .ui-timepicker-div dl dd { margin: 0 10px 10px 40%; }
.ui-timepicker-div td { font-size: 90%; } .ui-timepicker-div td { font-size: 90%; }
.ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; } .ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
.ui-timepicker-div .ui_tpicker_unit_hide{ display: none; }
.ui-timepicker-div .ui_tpicker_time .ui_tpicker_time_input { background: none; color: inherit; border: none; outline: none; border-bottom: solid 1px #555; width: 95%; }
.ui-timepicker-div .ui_tpicker_time .ui_tpicker_time_input:focus { border-bottom-color: #aaa; }
.ui-timepicker-rtl{ direction: rtl; } .ui-timepicker-rtl{ direction: rtl; }
.ui-timepicker-rtl dl { text-align: right; } .ui-timepicker-rtl dl { text-align: right; padding: 0 5px 0 0; }
.ui-timepicker-rtl dl dd { margin: 0 65px 10px 10px; } .ui-timepicker-rtl dl dt{ float: right; clear: right; }
.ui-timepicker-rtl dl dd { margin: 0 40% 10px 10px; }
.ui-timepicker-div .ui-datepicker .ui-datepicker-buttonpane { border: none; margin: 0; } /* Shortened version style */
.ui-datepicker .ui-datepicker-buttonpane button { padding: .2em .6em 0.2em .6em; font-size: 12px; } .ui-timepicker-div.ui-timepicker-oneLine { padding-right: 2px; }
.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_time,
.ui-timepicker-div.ui-timepicker-oneLine dt { display: none; }
.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_time_label { display: block; padding-top: 2px; }
.ui-timepicker-div.ui-timepicker-oneLine dl { text-align: right; }
.ui-timepicker-div.ui-timepicker-oneLine dl dd,
.ui-timepicker-div.ui-timepicker-oneLine dl dd > div { display:inline-block; margin:0; }
.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_minute:before,
.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_second:before { content:':'; display:inline-block; }
.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_millisec:before,
.ui-timepicker-div.ui-timepicker-oneLine dl dd.ui_tpicker_microsec:before { content:'.'; display:inline-block; }
.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_unit_hide,
.ui-timepicker-div.ui-timepicker-oneLine .ui_tpicker_unit_hide:before{ display: none; }

File diff suppressed because it is too large Load diff

View file

@ -49,8 +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 // ID must exist on the object in order for the model to update the record and not to perform
// an insert operation. // an insert operation.
var startDatetime = Date.parse($dialog.find('#start-datetime').val()).toString('yyyy-MM-dd HH:mm:ss'); var startDatetime = $dialog.find('#start-datetime').datetimepicker('getDate').toString('yyyy-MM-dd HH:mm:ss');
var endDatetime = Date.parse($dialog.find('#end-datetime').val()).toString('yyyy-MM-dd HH:mm:ss'); var endDatetime = $dialog.find('#end-datetime').datetimepicker('getDate').toString('yyyy-MM-dd HH:mm:ss');
var appointment = { var appointment = {
id_services: $dialog.find('#select-service').val(), id_services: $dialog.find('#select-service').val(),
@ -288,8 +288,8 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
// Automatically update the service duration. // Automatically update the service duration.
$.each(GlobalVariables.availableServices, function(indexService, service) { $.each(GlobalVariables.availableServices, function(indexService, service) {
if (service.id == sid) { if (service.id == sid) {
var start = Date.parse($('#start-datetime').val()); var start = $('#start-datetime').datetimepicker('getDate');
$('#end-datetime').datepicker('setDate', new Date(start.getTime() + service.duration * 60000)); $('#end-datetime').datetimepicker('setDate', new Date(start.getTime() + service.duration * 60000));
return false; // break loop return false; // break loop
} }
}); });
@ -414,7 +414,7 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
minuteText: EALang['minutes'], minuteText: EALang['minutes'],
firstDay: 1 firstDay: 1
}); });
$dialog.find('#start-datetime').datepicker('setDate', startDatetime); $dialog.find('#start-datetime').datetimepicker('setDate', startDatetime);
$dialog.find('#end-datetime').datetimepicker({ $dialog.find('#end-datetime').datetimepicker({
dateFormat: dateFormat, dateFormat: dateFormat,
@ -443,8 +443,8 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
minuteText: EALang['minutes'], minuteText: EALang['minutes'],
firstDay: 1 firstDay: 1
}); });
$dialog.find('#end-datetime').datepicker('setDate', endDatetime); $dialog.find('#end-datetime').datetimepicker('setDate', endDatetime);
} };
/** /**
* Validate the manage appointment dialog data. Validation checks need to * Validate the manage appointment dialog data. Validation checks need to
@ -481,8 +481,8 @@ window.BackendCalendarAppointmentsModal = window.BackendCalendarAppointmentsModa
} }
// Check appointment start and end time. // Check appointment start and end time.
var start = Date.parse($('#start-datetime').val()); var start = $('#start-datetime').datetimepicker('getDate');
var end = Date.parse($('#end-datetime').val()); var end = $('#end-datetime').datetimepicker('getDate');
if (start > end) { if (start > end) {
$dialog.find('#start-datetime').parents('.form-group').addClass('has-error'); $dialog.find('#start-datetime').parents('.form-group').addClass('has-error');
$dialog.find('#end-datetime').parents('.form-group').addClass('has-error'); $dialog.find('#end-datetime').parents('.form-group').addClass('has-error');