Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A small and simple utility built on top of jQuery UI's datepicker that provides "validation" for date ranges.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 demo
Octocat-spinner-32 dist
Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 src
Octocat-spinner-32 .gitignore
Octocat-spinner-32 MIT-LICENSE.txt
Octocat-spinner-32 README.textile
Octocat-spinner-32 Rakefile
Octocat-spinner-32 SpecRunner.html
README.textile

jquery-daterange-picker

A small and simple utility built on top of jQuery UI’s datepicker that provides “validation” for date ranges.

The quotes were used because the validation here means that once you select a ‘from’ date from the datepicker, all dates before that will
be disabled in the ‘to’ datepicker, thus removing the need to actually present javascript validation errors.

Usage

Given a HTML snippet like the following:


<label for="fromDate">From:</label> <input id="fromDate" type="text"/> <label for="toDate">To:</label> <input id="toDate" type="text"/>

Initialize jquery-daterange-picker like so:


$(function(){ $.daterangepicker({ fromSelector: "#fromDate", toSelector: "#toDate", readOnly:true //avoids manual user input }); });

You can pass all options jQuery UI’s datepicker provides to jquery-daterange-picker.
It will take care of passing them along.

It is sometimes useful to run callbacks after you have selected the dates. There are two special properties for that purpose, demonstrated below:


$(function(){ $.daterangepicker({ fromSelector: "#fromDate", toSelector: "#toDate", onSelectFrom: function() {}, //These will be called after onSelectTo: function() {} //each date has been selected }); });

Check examples in the demo directory or on the project page

Build

A Rakefile is provided for generating the release into the dist directory. It includes a minified version.

Dependencies

Contributing

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet
  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it
  • Fork the project
  • Start a feature/bugfix branch
  • Commit and push until you are happy with your contribution
  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright

Copyright © 2011- Leonardo Borges , released under the MIT license

Something went wrong with that request. Please try again.