A small and simple utility built on top of jQuery UI's datepicker that provides "validation" for date ranges.
JavaScript
Latest commit 5514635 Mar 31, 2011 @leonardoborges readme tweaks
Permalink
Failed to load latest commit information.
demo initial commit Mar 31, 2011
dist initial commit Mar 31, 2011
lib initial commit Mar 31, 2011
spec initial commit Mar 31, 2011
src initial commit Mar 31, 2011
.gitignore initial commit Mar 31, 2011
MIT-LICENSE.txt added MIT license Mar 31, 2011
README.textile readme tweaks Mar 31, 2011
Rakefile initial commit Mar 31, 2011
SpecRunner.html initial commit Mar 31, 2011

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