A simple and fluid inline datepicker for AngularJS with no extra dependencies.
- Add the
pickadate
module to your dependencies
angular.module('myApp', ['pickadate']);
- Use the
pickadate
directive in any element
<div pickadate ng-model="date"></div>
Pickadate is fluid, so it will take the width of the parent container.
<div pickadate ng-model="date" min-date="minDate" max-date="maxDate"></div>
function MyAppController($scope) {
$scope.minDate = '2013-11-10';
$scope.maxDate = '2013-12-31';
}
min-date
and max-date
take angular expressions, so if you want to specify the values inline, don't forget the quotes!
<div pickadate ng-model="date" min-date="'2013-11-10'" max-date="'2013-12-31'"></div>
<div pickadate ng-model="date" disabled-dates="disabledDates"></div>
function MyAppController($scope) {
$scope.disabledDates = ['2013-11-10', '2013-11-15', '2013-11-19'];
}
Allows you to preset the calendar to a particular month without setting the chosen date.
<div pickadate default-date="presetDate"></div>
function MyAppController($scope) {
$scope.presetDate = '2013-12-01';
}
Sets the first day of the week. The default is 0 for Sunday.
<div pickadate week-starts-on="1"></div>
The calendar will have between 4 and 6 rows if this attribute is present. By default it will always have 6 rows.
<div pickadate no-extra-rows></div>
Pickadate uses angular $locale
module for the date translations. If you want to have the calendar in any other language, please include the corresponding AngularJS i18n files. You can get them here: http://code.angularjs.org/1.2.0-rc.2/i18n/.
For the remaining translations you can configure the pickadateI18nProvider
.
angular.module('testApp', ['pickadate'])
.config(function(pickadateI18nProvider) {
pickadateI18nProvider.translations = {
prev: 'ant',
next: 'sig'
}
});
Currently pickadate
only works as an inline datepicker, but would like it to make it work in any text input as an overlay like the jquery-ui
one. Will be happy to merge your pull requests.
Copyright (c) 2013 Restorando
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.