forked from mirrors/easyappointments
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
|
@ -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