• This repository has been archived on 16/Dec/2019
  • Stars
    star
    246
  • Rank 164,726 (Top 4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 11 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

AngularJS directive for bootstrap-daterangepicker

ng-bs-daterangepicker

Angular directive for Dan Grossman's bootstrap-daterangepicker.

Demo: http://luisfarzati.github.io/ng-bs-daterangepicker

Installation

Using bower:

bower install ng-bs-daterangepicker

Using npm:

npm install ng-bs-daterangepicker

How to use it

You should already have a bunch of scripts and CSS required for bootstrap-daterangepicker:

CSS:

<link rel="stylesheet" type="text/css" href="bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="daterangepicker-bs3.css">

JavaScript:

<script src="jquery.min.js"></script>
<script src="bootstrap.min.js"></script>
<script src="moment.min.js"></script>
<script src="daterangepicker.js"></script>
<script src="angular.min.js"></script>

to the list above, you should add:

<script src="ng-bs-daterangepicker.js"></script>

Then, inject ngBootstrap in your application module:

angular.module('myApp', ['ngBootstrap']);

and then just add an input of type daterange:

<input type="daterange" ng-model="myDateRange" />

The result object $scope.myDateRange has a startDate and endDate properties, which are instances of moment().

Implemented features so far:

  • startDate, endDate: are taken from the ng-model object;
  • minDate, maxDate: mapped from min-date and max-date attributes;
  • dateLimit: mapped from limit attribute;
  • format: mapped from format attribute;
  • separator: mapped from separator attribute.
  • enableTimePicker: mapped from timePicker attribute.
  • ranges: mapped from ranges attribute. Can be a JSON string or scoped object. (check daterangepicker for formatting)
  • opens: mapped from open attribute. Can be right or left.

Example with all above features:

<input
	type="daterange"
	ng-model="dates"
	min-date="2013-09-10"
	max-date="2013-09-25"
	limit="3 days"
	format="L"
	separator="/"
	ranges="{'Special Range':{'startDate': '2013-09-2', 'endDate': '2013-09-5'}}">

The limit attribute lets you specify a number and unit similarly as you would invoke moment.duration().

Features to be implemented:

  • Some timePicker*
  • show*
  • other formatting options like *Class and stuff

Build

You can run the tests by running:

npm install
bower install
grunt

assuming you already have grunt installed, otherwise you also need to do:

npm install -g grunt-cli

Bitdeli Badge

More Repositories

1

localdots

HTTPS domains for localhost. 🏠
Dockerfile
521
star
2

chromda

λ 🖼️ Chromda is an AWS Lambda function for capturing screenshots of websites.
JavaScript
509
star
3

moment-interval

Time intervals for Moment.js
JavaScript
48
star
4

docker-lambda-api-server

AWS Lambda API server for docker-lambda
JavaScript
24
star
5

express-babelify-middleware

Start developing ES6 in the browser right away, without any build setup
JavaScript
24
star
6

json-chance

Create random JSON objects using json-spawn and Chance.js
JavaScript
21
star
7

rnbw-aws-cdk

AWS CDK Construct libraries
JavaScript
16
star
8

smart-identity-resolver-widget

Experimental login/signup widget as an alternative attempt to deal with the "Open ID NASCAR" problem.
JavaScript
13
star
9

elaine

Elaine is a TypeScript library designed for crafting chatbots and conversational interfaces on Node and Edge runtimes, leveraging the OpenAI Chat Completion API.
TypeScript
4
star
10

moss

My macOS Setup
Shell
3
star
11

thrift-archetype-quickstart

Thrift Quickstart Archetype
2
star
12

cryptoplay

Simple crypto playground based on CryptoJS and Angular
HTML
2
star
13

ngstart

Kickstart script that creates a skeleton AngularJS project with Gulp, livereload and automated tests
JavaScript
1
star
14

devbox-node

Node development sandbox with Docker
Shell
1
star
15

muito

A collection of React components based on Material-UI.
TypeScript
1
star
16

localtunnel-es6-promise

Simple ES6 Promise wrapper for localtunnel.
JavaScript
1
star
17

crypto-pipeline

JavaScript
1
star
18

fbanalytics

JavaScript
1
star
19

docker-mmdc

Easy rendering of Mermaid diagrams.
1
star