mirror of https://github.com/snachodog/mybuddy.git
Set default date during picker initialization
This commit is contained in:
parent
c816726960
commit
d397d169f9
|
@ -47,6 +47,18 @@ BabyBuddy.DatetimePicker = function ($, moment) {
|
|||
},
|
||||
viewMode: 'times',
|
||||
};
|
||||
|
||||
// Provide the initial date value from the form, if available. This is not
|
||||
// strictly necessary but acts as a workaround for a bug with certain
|
||||
// locales e.g., Portuguese (pt), that causes the default value to be lost
|
||||
// in the form.
|
||||
// @see https://github.com/tempusdominus/bootstrap-4/issues/189#issuecomment-590791416
|
||||
var id = element.attr('id');
|
||||
var input = element.find(`input[data-target="#${id}"]`)
|
||||
if (input.length === 1) {
|
||||
defaultOptions.date = input.val()
|
||||
}
|
||||
|
||||
element.datetimepicker($.extend(defaultOptions, options));
|
||||
}
|
||||
};
|
||||
|
|
Binary file not shown.
|
@ -47,6 +47,18 @@ BabyBuddy.DatetimePicker = function ($, moment) {
|
|||
},
|
||||
viewMode: 'times',
|
||||
};
|
||||
|
||||
// Provide the initial date value from the form, if available. This is not
|
||||
// strictly necessary but acts as a workaround for a bug with certain
|
||||
// locales e.g., Portuguese (pt), that causes the default value to be lost
|
||||
// in the form.
|
||||
// @see https://github.com/tempusdominus/bootstrap-4/issues/189#issuecomment-590791416
|
||||
var id = element.attr('id');
|
||||
var input = element.find(`input[data-target="#${id}"]`)
|
||||
if (input.length === 1) {
|
||||
defaultOptions.date = input.val()
|
||||
}
|
||||
|
||||
element.datetimepicker($.extend(defaultOptions, options));
|
||||
}
|
||||
};
|
Binary file not shown.
|
@ -47,6 +47,18 @@ BabyBuddy.DatetimePicker = function ($, moment) {
|
|||
},
|
||||
viewMode: 'times',
|
||||
};
|
||||
|
||||
// Provide the initial date value from the form, if available. This is not
|
||||
// strictly necessary but acts as a workaround for a bug with certain
|
||||
// locales e.g., Portuguese (pt), that causes the default value to be lost
|
||||
// in the form.
|
||||
// @see https://github.com/tempusdominus/bootstrap-4/issues/189#issuecomment-590791416
|
||||
var id = element.attr('id');
|
||||
var input = element.find(`input[data-target="#${id}"]`)
|
||||
if (input.length === 1) {
|
||||
defaultOptions.date = input.val()
|
||||
}
|
||||
|
||||
element.datetimepicker($.extend(defaultOptions, options));
|
||||
}
|
||||
};
|
||||
|
|
Binary file not shown.
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue