PLEASE READ THE PROJECT STATUS BELOW. Native AngularJS (Angular) directives for Bootstrap. Smaller footprint (20kB gzipped), no 3rd party JS dependencies (jQuery, bootstrap JS) required. Please read the README.md file before submitting an issue!
uib-datepicker settings via uib-datepicker-popup attributes are deprecated and will be removed in UI Bootstrap 1.3, use datepicker-options attribute instead #6476
This warning has been in my application for a while now, since I couldn't get it to dissappear the last time I migrated to a new version of angular and a new version of this library.
The warning appears because I'm initializing the directive as following.
<input ... uib-datepicker-popup="dd-MM-yyyy" />
Instead it wants me to not assign a value to the uib-datepicker-popup and use the datepicker-options attribute instead. At least, thats how I'm reading the warning.
The docs however don't say anything about this attribute being depricated and how to set it instead. It sayd the config equivalent of this attribute is datepickerConfig, but that doesn't do anything if I pass that to the datepicker-options, or globally to the uibDatepickerPopupConfig.
I've been doing some digging around in the code of the library (2.5.0) and found the following lines, where the datepicker format is being set.
if (datepickerPopupConfig.html5Types[$attrs.type]) {
dateFormat = datepickerPopupConfig.html5Types[$attrs.type];
isHtml5DateInput = true;
} else {
dateFormat = $attrs.uibDatepickerPopup || datepickerPopupConfig.datepickerPopup;
$attrs.$observe('uibDatepickerPopup', function(value, oldValue) {
var newDateFormat = value || datepickerPopupConfig.datepickerPopup;
// Invalidate the $modelValue to ensure that formatters re-run
// FIXME: Refactor when PR is merged: https://github.com/angular/angular.js/pull/10764
if (newDateFormat !== dateFormat) {
dateFormat = newDateFormat;
ngModel.$modelValue = null;
if (!dateFormat) {
throw new Error('uibDatepickerPopup must have a date format specified.');
}
}
});
}
The input I put the directive on is a regular text field, so the code in the else branch is being executed.
It appears the format is either being pulled from the attribute uibDatepickerPopup, eventhough this was supposed to be deprecated since UI Bootstrap 1.3, or from the global configuration datepickerPopupConfig.datepickerPopup, eventhough the docs specify this can be set globally via the datepickerConfig configuration.
I'm pretty sure it is not a coincidence that setting the format via the uib-datepicker-popup works again, but there is a mismatch between the docs and the workings of the directive.
The docs now say...
uib-datepicker-popup C (Default: yyyy-MM-dd, Config: datepickerConfig)
It should say
uib-datepicker-popup C (Default: yyyy-MM-dd, Config: datepickerPopup)
Link to minimally-working plunker that reproduces the issue:
I'll make one if its really necessary, since this basically is a docs issue.
Steps to reproduce the issue:
Try to set the format using datepicker-options or globally via uibDatepickerPopup.datepickerConfig
Fail
Try to set it via the uib-datepicker-popup attribute or globally via uibDatepickerPopup.datepickerPopup instead
Bug description:
This warning has been in my application for a while now, since I couldn't get it to dissappear the last time I migrated to a new version of angular and a new version of this library.
The warning appears because I'm initializing the directive as following.
Instead it wants me to not assign a value to the uib-datepicker-popup and use the datepicker-options attribute instead. At least, thats how I'm reading the warning.
The docs however don't say anything about this attribute being depricated and how to set it instead. It sayd the config equivalent of this attribute is datepickerConfig, but that doesn't do anything if I pass that to the datepicker-options, or globally to the uibDatepickerPopupConfig.
I've been doing some digging around in the code of the library (2.5.0) and found the following lines, where the datepicker format is being set.
The input I put the directive on is a regular text field, so the code in the else branch is being executed. It appears the format is either being pulled from the attribute uibDatepickerPopup, eventhough this was supposed to be deprecated since UI Bootstrap 1.3, or from the global configuration datepickerPopupConfig.datepickerPopup, eventhough the docs specify this can be set globally via the datepickerConfig configuration.
I'm pretty sure it is not a coincidence that setting the format via the uib-datepicker-popup works again, but there is a mismatch between the docs and the workings of the directive.
The docs now say...
It should say
Link to minimally-working plunker that reproduces the issue:
I'll make one if its really necessary, since this basically is a docs issue.
Steps to reproduce the issue:
Version of Angular, UIBS, and Bootstrap
Angular: 1.6.2
UIBS: 2.5.0
Bootstrap: 3.3.7