npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

angular-daterangepicker-labworks

v0.2.39

Published

Angular.js wrapper for Dan Grosmann's bootstrap date range picker (https://github.com/dangrossman/bootstrap-daterangepicker).

Downloads

35

Readme

Date Range Picker for Angular and Bootstrap

Dependencies

Angular.js directive for Dan Grossmans's Bootstrap Datepicker.

Maintainer needed!

Hello, as you may noticed, we have troubles maintaining this repo. So if there is somebody willing to help merging PRs, testing and releasing, please contact me at lukas.marek(at)fragaria.cz. Thank you!

DEMO

Beware: Use Bootstrap Datepicker v 2.0.0 and newer! Older version of datepicker are supported with 0.1.17 release

Date Range Picker screenshot

Installation via Bower

The easiest way to install the picker is:

bower install angular-daterangepicker --save

Manual installation

This directive depends on Bootstrap Datepicker, Bootstrap, Moment.js and jQuery. Download dependencies above and then use minified or normal version.

Basic usage

Assuming that bower installation directory is bower_components. In case of other installation directory, please update paths accordingly.

<script src="bower_components/jquery/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/momentjs/moment.js"></script>
<script src="bower_components/bootstrap-daterangepicker/daterangepicker.js"></script>
<script src="bower_components/angular-daterangepicker/js/angular-daterangepicker.js"></script>

<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css"/>
<link rel="stylesheet" href="bower_components/bootstrap-daterangepicker/daterangepicker-bs3.css"/>

Declare dependency:

App = angular.module('app', ['daterangepicker']);

Prepare model in your controller. The model must have startDate and endDate attributes:

exampleApp.controller('TestCtrl', function ($scope) {
	$scope.datePicker.date = {startDate: null, endDate: null};
}

Then in your HTML just add attribute date-range-picker to any input and bind it to model.

<div ng-controller="TestCtrl">
<input date-range-picker class="form-control date-picker" type="text" ng-model="datePicker.date" />
</div>

See example.html for working demo.

Mind the dot!

Do not forget to add a dot (.) in your model object to avoid issues with scope inheritance. E.g. use $scope.datePicker.date instead of $scope.date.

Advanced usage

Min and max value can be set via additional attributes:

<input date-range-picker class="form-control date-picker" type="text" ng-model="date" min="'2014-02-23'" max="'2015-02-25'"/>

The date picker can be further customized by passing in the options attribute.

<input date-range-picker class="form-control date-picker" type="text" ng-model="date"
min="'2014-02-23'" max="'2015-02-25'" options="{locale: {separator: ":"}}"/>

Example options

$scope.options = {
      applyClass: 'btn-green',
      locale: {
        applyLabel: "Apply",
        fromLabel: "From",
        format: "YYYY-MM-DD", //will give you 2017-01-06
	//format: "D-MMM-YY", //will give you 6-Jan-17
	//format: "D-MMMM-YY", //will give you 6-January-17
        toLabel: "To",
        cancelLabel: 'Cancel',
        customRangeLabel: 'Custom range'
      },
      ranges: {
        'Last 7 Days': [moment().subtract(6, 'days'), moment()],
        'Last 30 Days': [moment().subtract(29, 'days'), moment()]
      }
    }

Optionally, event handlers can be passed in through the eventHandlers attribute of options.

<input date-range-picker class="form-control date-picker" type="text" ng-model="date"
options="{eventHandlers: {'show.daterangepicker': function(ev, picker) { ... }}}"/>

All event handlers from the Bootstrap daterangepicker are supported. For reference, the complete list is below:

show.daterangepicker: Triggered when the picker is shown

hide.daterangepicker: Triggered when the picker is hidden

showCalendar.daterangepicker: Triggered when the calendar is shown

hideCalendar.daterangepicker: Triggered when the calendar is hidden

apply.daterangepicker: Triggered when the apply button is clicked

cancel.daterangepicker: Triggered when the cancel button is clicked

Compatibility

Version > 0.2.0 requires Bootstrap Datepicker 2.0.0 and newer. Version > 0.1.1 requires Bootstrap Datepicker 1.3.3 and newer.

Links

See original documentation.

Issues and Pull Requests

The PRs are more than welcome – thank you for those.

Please send me PRs only for *.coffee code. Please, do not include Javascript and minified Javascript into PRs. Javascript and minified Javascript will be generated later with grunt dist command just before the release.

Throughput Graph

Contributors

See CONTRIBUTORS.md for all the great folks who contributed to this repo! Thank you, guys!