bower install angular-date-range-picker
// require dateRangePicker module as dependency
angular.module('myApp', ['dateRangePicker']);
// specify default date range in controller
$scope.dates = moment().range("2012-11-05", "2013-01-25")
<!-- use 'date-range-picker' directive in view -->
<input type="text" date-range-picker ng-model="dates"/>
You can also select only one date:
<!-- use 'date-range-picker' directive in view -->
<input type="text" date-range-picker ranged="false"/>
$scope.rangeSelectOptions = [
{
label: "This year",
range: moment().range(
moment().startOf("year").startOf("day"),
moment().endOf("year").startOf("day")
)
},
{
label: "Last year",
range: moment().range(
moment().startOf("year").add(-1, "year").startOf("day"),
moment().add(-1, "year").endOf("year").startOf("day")
)
}
]
<input type="text" date-range-picker ng-model="dates" custom-select-options="rangeSelectOptions" />
Due to usage of track by $index
it is impossible to provide one version for both angular < 1.2
and >= 1.2
.
Angular version | date-range-picker version |
---|---|
1.2.x | 0.3.x |
1.1.x | 0.2.x |
1.0.x | 0.2.x |
npm install
bower install
grunt watch
open test/index.html
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request