mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-12-03 21:32:22 +03:00
#1611 Breaks bug when Time Format is set to regular
Change-Id: I20004227c27353d6f237aefbe4eb8db0eefe5142
This commit is contained in:
parent
855a7e841a
commit
71a7b7fc2d
1 changed files with 4 additions and 3 deletions
|
@ -529,20 +529,21 @@ App.Utils.WorkingPlan = (function () {
|
||||||
* @param {jQuery.Event} event
|
* @param {jQuery.Event} event
|
||||||
*/
|
*/
|
||||||
$(document).on('click', '.save-break', (event) => {
|
$(document).on('click', '.save-break', (event) => {
|
||||||
|
const timeFormat = vars('time_format') === 'regular' ? 'h:mm a' : 'HH:mm';
|
||||||
// Break's start time must always be prior to break's end.
|
// Break's start time must always be prior to break's end.
|
||||||
const element = event.target;
|
const element = event.target;
|
||||||
|
|
||||||
const $modifiedRow = $(element).closest('tr');
|
const $modifiedRow = $(element).closest('tr');
|
||||||
|
|
||||||
const startMoment = moment($modifiedRow.find('.break-start input').val(), 'HH:mm');
|
const startMoment = moment($modifiedRow.find('.break-start input').val(), timeFormat);
|
||||||
|
|
||||||
const endMoment = moment($modifiedRow.find('.break-end input').val(), 'HH:mm');
|
const endMoment = moment($modifiedRow.find('.break-end input').val(), timeFormat);
|
||||||
|
|
||||||
if (startMoment.isAfter(endMoment)) {
|
if (startMoment.isAfter(endMoment)) {
|
||||||
$modifiedRow.find('.break-end input').val(
|
$modifiedRow.find('.break-end input').val(
|
||||||
startMoment
|
startMoment
|
||||||
.add(1, 'hour')
|
.add(1, 'hour')
|
||||||
.format(vars('time_format') === 'regular' ? 'h:mm a' : 'HH:mm')
|
.format(timeFormat)
|
||||||
.toLowerCase(),
|
.toLowerCase(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue