Skip to content

webmonks/bootstrap-daterangepicker-rails

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Date Range Picker for Twitter Bootstrap

Description from DateRangePicker for Twitter Bootstrap

This date range picker component for Twitter Bootstrap creates a dropdown menu from which a user can select a range of dates. It was created for the reporting UI at Improvely.

If invoked with no options, it will present two calendars to choose a start and end date from. Optionally, you can provide a list of date ranges the user can select from instead of choosing dates from the calendars. If attached to a text input, the selected dates will be inserted into the text box. Otherwise, you can provide a custom callback function to receive the selection.

Live demo & option usage examples

Usage

This component relies on Twitter Bootstrap, Moment.js and jQuery.

Basic usage:


# Gemfile
gem 'jquery-rails'
gem 'bootstrap-daterangepicker-rails'
gem 'coffee-rails'


# application.js

//= require moment
//= require daterangepicker


# application.css

/*
 *= require bootstrap
 *= require daterangepicker
 */


<script type="text/javascript">
$(document).ready(function() {
  $('input[name="daterange"]').daterangepicker();
});
</script>

Additional options allow:

  • Custom callback handler called when the date range selection is made
  • Setting initial start and end dates for the calendars
  • Bounding the minimum and maximum selectable dates
  • Overriding all labels in the interface with localized text
  • Starting the calendar week on any day of week
  • Overriding the direction the dropdown expands (left/right of element it's attached to)
  • Setting the date format string for parsing string inputs

Syntax for all the options can be found in the examples.html file.

License

This code is made available under the Apache License v2.0, the same as Twitter Bootstrap.

Date.js is included in this repository for convenience. It is available under the MIT license.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%