mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-23 08:22:31 +03:00
Merged pull request #221 - Fixed/Improved sort breaks increasingly by hour within day
This commit is contained in:
parent
84afca8b26
commit
62e28d381d
1 changed files with 9 additions and 8 deletions
|
@ -48,7 +48,7 @@
|
|||
$.each(workingPlan, function (index, workingDay) {
|
||||
if (workingDay != null) {
|
||||
$('#' + index).prop('checked', true);
|
||||
$('#' + index + '-start').val(Date.parse(workingDay.start).toString(GlobalVariables.timeFormat === 'regular' ? 'h:mm tt' : 'HH:mm').toUpperCase());
|
||||
$('#' + index + '-start').val(Date.parse(workingDay.start).toString(GlobalVariables.timeFormat === 'regular' ? 'h:mm tt' : 'HH:mm').toUpperCase());
|
||||
$('#' + index + '-end').val(Date.parse(workingDay.end).toString(GlobalVariables.timeFormat === 'regular' ? 'h:mm tt' : 'HH:mm').toUpperCase());
|
||||
|
||||
// Add the day's breaks on the breaks table.
|
||||
|
@ -294,7 +294,7 @@
|
|||
start = Date.parse($modifiedRow.find('.break-start input').val()),
|
||||
end = Date.parse($modifiedRow.find('.break-end input').val());
|
||||
|
||||
if (start > end) {
|
||||
if (start >= end) {
|
||||
$modifiedRow.find('.break-end input').val(start.addHours(1).toString(GlobalVariables.timeFormat === 'regular' ? 'h:mm tt' : 'HH:mm'));
|
||||
}
|
||||
|
||||
|
@ -336,12 +336,13 @@
|
|||
end: Date.parse(end).toString('HH:mm')
|
||||
});
|
||||
}
|
||||
|
||||
workingPlan[id].breaks.sort(function (break1, break2) {
|
||||
// We can do a direct string comparison since we have time based on 24 hours clock.
|
||||
return break1.start - break2.start;
|
||||
});
|
||||
}.bind(this));
|
||||
|
||||
// Sort breaks increasingly by hour within day
|
||||
workingPlan[id].breaks.sort(function (break1, break2) {
|
||||
// We can do a direct string comparison since we have time based on 24 hours clock
|
||||
return break1.start > break2.start;
|
||||
});
|
||||
} else {
|
||||
workingPlan[id] = null;
|
||||
}
|
||||
|
@ -374,7 +375,7 @@
|
|||
var start = Date.parse($(this).parent().parent().find('.work-start').val()),
|
||||
end = Date.parse($(this).parent().parent().find('.work-end').val());
|
||||
|
||||
if (start > end) {
|
||||
if (start >= end) {
|
||||
$(this).parent().parent().find('.work-end').val(start.addHours(1).toString(GlobalVariables.timeFormat === 'regular' ? 'h:mm tt' : 'HH:mm'));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue