Reset the date shortcut checkbox on value changes when it's not the shortcut value

This commit is contained in:
Bernd Bestel 2018-08-18 08:14:26 +02:00
parent c5b8893008
commit 931dc9d243
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300

View File

@ -14,6 +14,14 @@ Grocy.Components.DateTimePicker.SetValue = function(value)
{ {
Grocy.Components.DateTimePicker.GetInputElement().val(value); Grocy.Components.DateTimePicker.GetInputElement().val(value);
Grocy.Components.DateTimePicker.GetInputElement().trigger('change'); Grocy.Components.DateTimePicker.GetInputElement().trigger('change');
// "Click" the shortcut checkbox when the desired value is
// not the shortcut value and it is currently set
var shortcutValue = $("#datetimepicker-shortcut").data("datetimepicker-shortcut-value");
if (value != shortcutValue && $("#datetimepicker-shortcut").is(":checked"))
{
$("#datetimepicker-shortcut").click();
}
} }
var startDate = null; var startDate = null;