GithubHelp home page GithubHelp logo

isabella232 / ng-bs-daterangepicker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from channelmeter/ng-bs-daterangepicker

0.0 0.0 0.0 1.91 MB

AngularJS directive for bootstrap-daterangepicker

Home Page: http://luisfarzati.github.io/ng-bs-daterangepicker/

License: MIT License

JavaScript 100.00%

ng-bs-daterangepicker's Introduction

ng-bs-daterangepicker

Angular directive for Dan Grossman's bootstrap-daterangepicker.

This is a fork of original Luis Farzati's version with a couple of incompatible fixes and localization feature.

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

Installation

Using bower:

bower install ng-bs-daterangepicker-plus

Using npm:

npm install ng-bs-daterangepicker-plus

How to use it

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

<link rel="stylesheet" type="text/css" href="bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="daterangepicker-bs3.css">
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="bootstrap.min.js"></script>
<script type="text/javascript" src="moment.min.js"></script>
<script type="text/javascript" src="daterangepicker.js"></script>
<script type="text/javascript" src="angular.min.js"></script>

to the list above, you should add:

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

Then, inject ngBootstrap.dateRangePicker in your application module:

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

and then just add any element of type daterange:

<input ng-daterange 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.
  • ranges: mapped from ranges attribute. Can be a JSON string or scoped object. (check daterangepicker for formatting)
  • locale: mapped from locale attribute. Can be a JSON string or scoped object. (check daterangepicker for formatting)

Example with all above features:

<input
    ng-daterange 
	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:

  • 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

ng-bs-daterangepicker's People

Contributors

destos avatar kojoru avatar l3l0 avatar luisfarzati avatar nemosupremo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.