Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Commit

Permalink
feat(datepicker): allow suppression of log error
Browse files Browse the repository at this point in the history
- Add `$datepickerSuppressError` injectable to allow suppressing of error message

Closes #3836
Closes #4115
  • Loading branch information
Blackbaud-PatrickOFriel authored and wesleycho committed Aug 7, 2015
1 parent 87fc242 commit bab1d37
Show file tree
Hide file tree
Showing 2 changed files with 1,674 additions and 1,603 deletions.
6 changes: 4 additions & 2 deletions src/datepicker/datepicker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootstrap.position'])

.value('$datepickerSuppressError', false)

.constant('datepickerConfig', {
formatDay: 'dd',
formatMonth: 'MMMM',
Expand All @@ -18,7 +20,7 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst
shortcutPropagation: false
})

.controller('DatepickerController', ['$scope', '$attrs', '$parse', '$interpolate', '$log', 'dateFilter', 'datepickerConfig', function($scope, $attrs, $parse, $interpolate, $log, dateFilter, datepickerConfig) {
.controller('DatepickerController', ['$scope', '$attrs', '$parse', '$interpolate', '$log', 'dateFilter', 'datepickerConfig', '$datepickerSuppressError', function($scope, $attrs, $parse, $interpolate, $log, dateFilter, datepickerConfig, $datepickerSuppressError) {
var self = this,
ngModelCtrl = { $setViewValue: angular.noop }; // nullModelCtrl;

Expand Down Expand Up @@ -82,7 +84,7 @@ angular.module('ui.bootstrap.datepicker', ['ui.bootstrap.dateparser', 'ui.bootst

if ( isValid ) {
this.activeDate = date;
} else {
} 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.');
}
}
Expand Down
Loading

0 comments on commit bab1d37

Please sign in to comment.