diff --git a/src/datepicker/datepicker.js b/src/datepicker/datepicker.js
index 7cf87593ed..834b9d6a4c 100644
--- a/src/datepicker/datepicker.js
+++ b/src/datepicker/datepicker.js
@@ -541,7 +541,7 @@ function(scope, element, attrs, $compile, $parse, $document, $rootScope, $positi
dateFormat = datepickerPopupConfig.html5Types[attrs.type];
isHtml5DateInput = true;
} else {
- dateFormat = attrs.datepickerPopup || attrs.uibDatepickerPopup || datepickerPopupConfig.datepickerPopup;
+ 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
@@ -860,327 +860,3 @@ function(scope, element, attrs, $compile, $parse, $document, $rootScope, $positi
}
};
});
-
-/* Deprecated datepicker below */
-
-angular.module('ui.bootstrap.datepicker')
-
-.value('$datepickerSuppressWarning', false)
-
-.controller('DatepickerController', ['$scope', '$attrs', '$parse', '$interpolate', '$log', 'dateFilter', 'uibDatepickerConfig', '$datepickerSuppressError', '$datepickerSuppressWarning', function($scope, $attrs, $parse, $interpolate, $log, dateFilter, datepickerConfig, $datepickerSuppressError, $datepickerSuppressWarning) {
- if (!$datepickerSuppressWarning) {
- $log.warn('DatepickerController is now deprecated. Use UibDatepickerController instead.');
- }
-
- var self = this,
- ngModelCtrl = { $setViewValue: angular.noop }; // nullModelCtrl;
-
- this.modes = ['day', 'month', 'year'];
-
- angular.forEach(['formatDay', 'formatMonth', 'formatYear', 'formatDayHeader', 'formatDayTitle', 'formatMonthTitle',
- 'showWeeks', 'startingDay', 'yearRange', 'shortcutPropagation'], function(key, index) {
- self[key] = angular.isDefined($attrs[key]) ? (index < 6 ? $interpolate($attrs[key])($scope.$parent) : $scope.$parent.$eval($attrs[key])) : datepickerConfig[key];
- });
-
- angular.forEach(['minDate', 'maxDate'], function(key) {
- if ($attrs[key]) {
- $scope.$parent.$watch($parse($attrs[key]), function(value) {
- self[key] = value ? new Date(value) : null;
- self.refreshView();
- });
- } else {
- self[key] = datepickerConfig[key] ? new Date(datepickerConfig[key]) : null;
- }
- });
-
- angular.forEach(['minMode', 'maxMode'], function(key) {
- if ($attrs[key]) {
- $scope.$parent.$watch($parse($attrs[key]), function(value) {
- self[key] = angular.isDefined(value) ? value : $attrs[key];
- $scope[key] = self[key];
- if ((key == 'minMode' && self.modes.indexOf($scope.datepickerMode) < self.modes.indexOf(self[key])) || (key == 'maxMode' && self.modes.indexOf($scope.datepickerMode) > self.modes.indexOf(self[key]))) {
- $scope.datepickerMode = self[key];
- }
- });
- } else {
- self[key] = datepickerConfig[key] || null;
- $scope[key] = self[key];
- }
- });
-
- $scope.datepickerMode = $scope.datepickerMode || datepickerConfig.datepickerMode;
- $scope.uniqueId = 'datepicker-' + $scope.$id + '-' + Math.floor(Math.random() * 10000);
-
- if (angular.isDefined($attrs.initDate)) {
- this.activeDate = $scope.$parent.$eval($attrs.initDate) || new Date();
- $scope.$parent.$watch($attrs.initDate, function(initDate) {
- if (initDate && (ngModelCtrl.$isEmpty(ngModelCtrl.$modelValue) || ngModelCtrl.$invalid)) {
- self.activeDate = initDate;
- self.refreshView();
- }
- });
- } else {
- this.activeDate = new Date();
- }
-
- $scope.isActive = function(dateObject) {
- if (self.compare(dateObject.date, self.activeDate) === 0) {
- $scope.activeDateId = dateObject.uid;
- return true;
- }
- return false;
- };
-
- this.init = function(ngModelCtrl_) {
- ngModelCtrl = ngModelCtrl_;
-
- ngModelCtrl.$render = function() {
- self.render();
- };
- };
-
- this.render = function() {
- if (ngModelCtrl.$viewValue) {
- var date = new Date(ngModelCtrl.$viewValue),
- isValid = !isNaN(date);
-
- if (isValid) {
- this.activeDate = date;
- } else if (!$datepickerSuppressError) {
- $log.error('Datepicker directive: "ng-model" value must be a Date object, a number of milliseconds since 01.01.1970 or a string representing an RFC2822 or ISO 8601 date.');
- }
- }
- this.refreshView();
- };
-
- this.refreshView = function() {
- if (this.element) {
- this._refreshView();
-
- var date = ngModelCtrl.$viewValue ? new Date(ngModelCtrl.$viewValue) : null;
- ngModelCtrl.$setValidity('dateDisabled', !date || (this.element && !this.isDisabled(date)));
- }
- };
-
- this.createDateObject = function(date, format) {
- var model = ngModelCtrl.$viewValue ? new Date(ngModelCtrl.$viewValue) : null;
- return {
- date: date,
- label: dateFilter(date, format),
- selected: model && this.compare(date, model) === 0,
- disabled: this.isDisabled(date),
- current: this.compare(date, new Date()) === 0,
- customClass: this.customClass(date)
- };
- };
-
- this.isDisabled = function(date) {
- return ((this.minDate && this.compare(date, this.minDate) < 0) || (this.maxDate && this.compare(date, this.maxDate) > 0) || ($attrs.dateDisabled && $scope.dateDisabled({date: date, mode: $scope.datepickerMode})));
- };
-
- this.customClass = function(date) {
- return $scope.customClass({date: date, mode: $scope.datepickerMode});
- };
-
- // Split array into smaller arrays
- this.split = function(arr, size) {
- var arrays = [];
- while (arr.length > 0) {
- arrays.push(arr.splice(0, size));
- }
- return arrays;
- };
-
- this.fixTimeZone = function(date) {
- var hours = date.getHours();
- date.setHours(hours === 23 ? hours + 2 : 0);
- };
-
- $scope.select = function(date) {
- if ($scope.datepickerMode === self.minMode) {
- var dt = ngModelCtrl.$viewValue ? new Date(ngModelCtrl.$viewValue) : new Date(0, 0, 0, 0, 0, 0, 0);
- dt.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());
- ngModelCtrl.$setViewValue(dt);
- ngModelCtrl.$render();
- } else {
- self.activeDate = date;
- $scope.datepickerMode = self.modes[self.modes.indexOf($scope.datepickerMode) - 1];
- }
- };
-
- $scope.move = function(direction) {
- var year = self.activeDate.getFullYear() + direction * (self.step.years || 0),
- month = self.activeDate.getMonth() + direction * (self.step.months || 0);
- self.activeDate.setFullYear(year, month, 1);
- self.refreshView();
- };
-
- $scope.toggleMode = function(direction) {
- direction = direction || 1;
-
- if (($scope.datepickerMode === self.maxMode && direction === 1) || ($scope.datepickerMode === self.minMode && direction === -1)) {
- return;
- }
-
- $scope.datepickerMode = self.modes[self.modes.indexOf($scope.datepickerMode) + direction];
- };
-
- // Key event mapper
- $scope.keys = { 13: 'enter', 32: 'space', 33: 'pageup', 34: 'pagedown', 35: 'end', 36: 'home', 37: 'left', 38: 'up', 39: 'right', 40: 'down' };
-
- var focusElement = function() {
- self.element[0].focus();
- };
-
- $scope.$on('uib:datepicker.focus', focusElement);
-
- $scope.keydown = function(evt) {
- var key = $scope.keys[evt.which];
-
- if (!key || evt.shiftKey || evt.altKey) {
- return;
- }
-
- evt.preventDefault();
- if (!self.shortcutPropagation) {
- evt.stopPropagation();
- }
-
- if (key === 'enter' || key === 'space') {
- if (self.isDisabled(self.activeDate)) {
- return; // do nothing
- }
- $scope.select(self.activeDate);
- } else if (evt.ctrlKey && (key === 'up' || key === 'down')) {
- $scope.toggleMode(key === 'up' ? 1 : -1);
- } else {
- self.handleKeyDown(key, evt);
- self.refreshView();
- }
- };
-}])
-
-.directive('datepicker', ['$log', '$datepickerSuppressWarning', function($log, $datepickerSuppressWarning) {
- return {
- replace: true,
- templateUrl: function(element, attrs) {
- return attrs.templateUrl || 'template/datepicker/datepicker.html';
- },
- scope: {
- datepickerMode: '=?',
- dateDisabled: '&',
- customClass: '&',
- shortcutPropagation: '&?'
- },
- require: ['datepicker', '^ngModel'],
- controller: 'DatepickerController',
- controllerAs: 'datepicker',
- link: function(scope, element, attrs, ctrls) {
- if (!$datepickerSuppressWarning) {
- $log.warn('datepicker is now deprecated. Use uib-datepicker instead.');
- }
-
- var datepickerCtrl = ctrls[0], ngModelCtrl = ctrls[1];
-
- datepickerCtrl.init(ngModelCtrl);
- }
- };
-}])
-
-.directive('daypicker', ['$log', '$datepickerSuppressWarning', function($log, $datepickerSuppressWarning) {
- return {
- replace: true,
- templateUrl: 'template/datepicker/day.html',
- require: ['^datepicker', 'daypicker'],
- controller: 'UibDaypickerController',
- link: function(scope, element, attrs, ctrls) {
- if (!$datepickerSuppressWarning) {
- $log.warn('daypicker is now deprecated. Use uib-daypicker instead.');
- }
-
- var datepickerCtrl = ctrls[0],
- daypickerCtrl = ctrls[1];
-
- daypickerCtrl.init(datepickerCtrl);
- }
- };
-}])
-
-.directive('monthpicker', ['$log', '$datepickerSuppressWarning', function($log, $datepickerSuppressWarning) {
- return {
- replace: true,
- templateUrl: 'template/datepicker/month.html',
- require: ['^datepicker', 'monthpicker'],
- controller: 'UibMonthpickerController',
- link: function(scope, element, attrs, ctrls) {
- if (!$datepickerSuppressWarning) {
- $log.warn('monthpicker is now deprecated. Use uib-monthpicker instead.');
- }
-
- var datepickerCtrl = ctrls[0],
- monthpickerCtrl = ctrls[1];
-
- monthpickerCtrl.init(datepickerCtrl);
- }
- };
-}])
-
-.directive('yearpicker', ['$log', '$datepickerSuppressWarning', function($log, $datepickerSuppressWarning) {
- return {
- replace: true,
- templateUrl: 'template/datepicker/year.html',
- require: ['^datepicker', 'yearpicker'],
- controller: 'UibYearpickerController',
- link: function(scope, element, attrs, ctrls) {
- if (!$datepickerSuppressWarning) {
- $log.warn('yearpicker is now deprecated. Use uib-yearpicker instead.');
- }
-
- var ctrl = ctrls[0];
- angular.extend(ctrl, ctrls[1]);
- ctrl.yearpickerInit();
-
- ctrl.refreshView();
- }
- };
-}])
-
-.directive('datepickerPopup', ['$log', '$datepickerSuppressWarning', function($log, $datepickerSuppressWarning) {
- return {
- require: ['ngModel', 'datepickerPopup'],
- controller: 'UibDatepickerPopupController',
- scope: {
- isOpen: '=?',
- currentText: '@',
- clearText: '@',
- closeText: '@',
- dateDisabled: '&',
- customClass: '&'
- },
- link: function(scope, element, attrs, ctrls) {
- if (!$datepickerSuppressWarning) {
- $log.warn('datepicker-popup is now deprecated. Use uib-datepicker-popup instead.');
- }
-
- var ngModel = ctrls[0],
- ctrl = ctrls[1];
-
- ctrl.init(ngModel);
- }
- };
-}])
-
-.directive('datepickerPopupWrap', ['$log', '$datepickerSuppressWarning', function($log, $datepickerSuppressWarning) {
- return {
- replace: true,
- transclude: true,
- templateUrl: function(element, attrs) {
- return attrs.templateUrl || 'template/datepicker/popup.html';
- },
- link: function() {
- if (!$datepickerSuppressWarning) {
- $log.warn('datepicker-popup-wrap is now deprecated. Use uib-datepicker-popup-wrap instead.');
- }
- }
- };
-}]);
diff --git a/src/datepicker/test/datepicker.spec.js b/src/datepicker/test/datepicker.spec.js
index 6ab0ce8596..1c4f4243e8 100644
--- a/src/datepicker/test/datepicker.spec.js
+++ b/src/datepicker/test/datepicker.spec.js
@@ -2438,78 +2438,3 @@ describe('datepicker directive', function() {
});
});
});
-
-/* deprecation tests below */
-
-describe('datepicker deprecation', function() {
- beforeEach(module('ui.bootstrap.datepicker'));
- beforeEach(module('template/datepicker/datepicker.html'));
- beforeEach(module('template/datepicker/day.html'));
- beforeEach(module('template/datepicker/month.html'));
- beforeEach(module('template/datepicker/year.html'));
- beforeEach(module('template/datepicker/popup.html'));
-
- it('should suppress warning', function() {
- module(function($provide) {
- $provide.value('$datepickerSuppressWarning', true);
- });
-
- inject(function($compile, $log, $rootScope) {
- spyOn($log, 'warn');
-
- var element = $compile('