Skip to content
This repository was archived by the owner on Feb 18, 2022. It is now read-only.

Commit 1142689

Browse files
committed
Merge pull request #80 from palsingh/issue-79
[issue-79] Added an option to not set default value in input field an…
2 parents db73d02 + 486842d commit 1142689

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,15 @@ You can set date to be displayed by default with `date-set=""` attribute data (
104104
</datepicker>
105105
```
106106

107+
####Default date not to be visible in input
108+
You can set default date only to be set in calendar, not in input field. To be used with `date-set=""` option.
109+
110+
```html
111+
<datepicker date-set="2018/07/14" hide-default-date="true">
112+
<input ng-model="date" type="text"/>
113+
</datepicker>
114+
```
115+
107116
####Date disabled
108117
You can disable specific dates using the **date-disabled-dates=""** attribute and an _Array_ of dates you want to disable.
109118

src/js/angular-datepicker.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
'dateYearTitle': '@',
2020
'buttonNextTitle': '@',
2121
'buttonPrevTitle': '@',
22-
'dateDisabledDates': '@'
22+
'dateDisabledDates': '@',
23+
'hideDefaultDate': '@'
2324
},
2425
'link': function linkingFunction($scope, element, attr) {
2526
//get child input
@@ -112,8 +113,10 @@
112113
$scope.monthNumber = Number($filter('date')(date, 'MM')); // 01-12 like
113114
$scope.day = Number($filter('date')(date, 'dd')); //01-31 like
114115
$scope.year = Number($filter('date')(date, 'yyyy'));//2014 like
115-
$scope.setDaysInMonth($scope.monthNumber, $scope.year);
116-
$scope.setInputValue();
116+
$scope.setDaysInMonth($scope.monthNumber, $scope.year);
117+
if ($scope.hideDefaultDate !== 'true') {
118+
$scope.setInputValue();
119+
}
117120
}
118121
});
119122

0 commit comments

Comments
 (0)