mirror of
https://github.com/prymitive/karma
synced 2026-05-05 03:16:51 +00:00
Correctly update min date of the silence end time
Move it to the right place, having it in silenceFormCalculateDuration means that we can trigger recursive updates
This commit is contained in:
@@ -150,9 +150,6 @@ var UI = (function(params) {
|
||||
endsAtDesc = endsAtDesc.replace("in a few seconds", "now");
|
||||
endsAtDesc = endsAtDesc.replace("a few seconds ago", "now");
|
||||
$("#silence-end-description").html(endsAtDesc);
|
||||
|
||||
// fix endsAt min date, it cannot be < startsAt
|
||||
$("#endsAt").data('DateTimePicker').minDate(startsAt);
|
||||
};
|
||||
|
||||
|
||||
@@ -270,8 +267,18 @@ var UI = (function(params) {
|
||||
select.selectpicker('selectAll');
|
||||
}
|
||||
});
|
||||
// set endsAt time to +1hour
|
||||
// set endsAt minDate to now + 1 minute
|
||||
$("#endsAt").data('DateTimePicker').minDate(moment().add(1, 'minute'));
|
||||
// set endsAt time to +1 hour
|
||||
$("#endsAt").data('DateTimePicker').date(moment().add(1, 'hours'));
|
||||
// whenever startsAt changes set it as the minDate for endsAt
|
||||
// we can't have endsAt < startsAt
|
||||
modal.on("dp.change", "#startsAt", function(){
|
||||
var startsAt = $("#startsAt").data('DateTimePicker').date();
|
||||
// endsAt needs to be at least 1 minute after startsAt
|
||||
startsAt.add(1, "minute");
|
||||
$("#endsAt").data('DateTimePicker').minDate(startsAt);
|
||||
});
|
||||
modal.on("click", "a.silence-duration-btn", silenceFormUpdateDuration);
|
||||
modal.on("mousedown", "a.silence-duration-btn", false);
|
||||
silenceFormCalculateDuration();
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user