mirror of
https://github.com/prymitive/karma
synced 2026-05-07 03:26:52 +00:00
Make decr button reset duration to minimun if needed
With this the user is able to reset duration to minimum by clickin on the day button when only 1 hour duration is set
This commit is contained in:
@@ -166,6 +166,7 @@ var UI = (function(params) {
|
||||
if (!$("#endsAt").data('DateTimePicker')) return false;
|
||||
|
||||
var endsAt = $("#endsAt").data('DateTimePicker').date();
|
||||
var endsAtMinDate = $("#endsAt").data('DateTimePicker').minDate();
|
||||
var action = $(event.target).data("duration-action");
|
||||
var unit = $(event.target).data("duration-unit");
|
||||
var step = parseInt($(event.target).data("duration-step"));
|
||||
@@ -173,6 +174,11 @@ var UI = (function(params) {
|
||||
endsAt.add(step, unit);
|
||||
} else {
|
||||
endsAt.subtract(step, unit);
|
||||
if (endsAt < endsAtMinDate) {
|
||||
// if decrement would result in a timestamp lower than allowed minimum
|
||||
// then just reset it to the minimum
|
||||
endsAt = endsAtMinDate;
|
||||
}
|
||||
}
|
||||
$("#endsAt").data('DateTimePicker').date(endsAt);
|
||||
silenceFormCalculateDuration();
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user