Skip to content

Commit

Permalink
Add a stylesheet for Bootstrap 3, make the apply/cancel button functi…
Browse files Browse the repository at this point in the history
…onality less complex
  • Loading branch information
dangrossman committed Jul 30, 2013
1 parent fc6fdd1 commit 4729b69
Show file tree
Hide file tree
Showing 5 changed files with 303 additions and 75 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

![Improvely.com](http://i.imgur.com/LbAMf3D.png)

This date range picker component for Twitter Bootstrap 2.x creates a dropdown menu from which a user can
This date range picker component for Twitter Bootstrap creates a dropdown menu from which a user can
select a range of dates. I created it while building the UI for [Improvely](http://www.improvely.com),
which needed a way to select date ranges for reports.

Expand All @@ -15,17 +15,19 @@ into the text box. Otherwise, you can provide a custom callback function to rece

## Usage

This component relies on [Twitter Bootstrap 2.x](http://twitter.github.com/bootstrap/),
This component relies on [Twitter Bootstrap](http://twitter.github.com/bootstrap/),
[Moment.js](http://momentjs.com/) and [jQuery](http://jquery.com/).

Separate stylesheets are included for use with Bootstrap 2 or Bootstrap 3.

Basic usage:

```
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="moment.js"></script>
<script type="text/javascript" src="daterangepicker.js"></script>
<link rel="stylesheet" type="text/css" href="bootstrap.css" />
<link rel="stylesheet" type="text/css" href="daterangepicker.css" />
<link rel="stylesheet" type="text/css" href="daterangepicker-bs3.css" />
<script type="text/javascript">
$(document).ready(function() {
Expand Down Expand Up @@ -79,9 +81,9 @@ $('input[name="daterange"]').daterangepicker(

`buttonClasses`: (array) CSS class names that will be added to all buttons in the picker

`applyClass`: (string) CSS class name that will be added to the apply button
`applyClass`: (string) CSS class string that will be added to the apply button

`clearClass`: (string) CSS class name that will be added to the clear button
`cancelClass`: (string) CSS class string that will be added to the cancel button

`format`: (string) Date/time format string used by moment when parsing or displaying the selected dates

Expand Down
10 changes: 10 additions & 0 deletions daterangepicker.css → daterangepicker-bs2.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
/*!
* Stylesheet for the Date Range Picker, for use with Bootstrap 2.x
*
* Copyright 2013 Dan Grossman ( http://www.dangrossman.info )
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Built for http://www.improvely.com
*/

.daterangepicker.dropdown-menu {
max-width: none;
}
Expand Down
244 changes: 244 additions & 0 deletions daterangepicker-bs3.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
/*!
* Stylesheet for the Date Range Picker, for use with Bootstrap 3.x
*
* Copyright 2013 Dan Grossman ( http://www.dangrossman.info )
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Built for http://www.improvely.com
*/

.daterangepicker.dropdown-menu {
max-width: none;
}

.daterangepicker.opensleft .ranges, .daterangepicker.opensleft .calendar {
float: left;
margin: 4px;
}

.daterangepicker.opensright .ranges, .daterangepicker.opensright .calendar {
float: right;
margin: 4px;
}

.daterangepicker .ranges {
width: 160px;
text-align: left;
}

.daterangepicker .ranges .range_inputs>div {
float: left;
}

.daterangepicker .ranges .range_inputs>div:nth-child(2) {
padding-left: 11px;
}

.daterangepicker .calendar {
display: none;
max-width: 270px;
}

.daterangepicker .calendar th, .daterangepicker .calendar td {
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
white-space: nowrap;
text-align: center;
min-width: 32px;
}

.daterangepicker .ranges label {
color: #333;
display: block;
font-size: 11px;
font-weight: normal;
height: 20px;
line-height: 20px;
margin-bottom: 2px;
text-shadow: #fff 1px 1px 0px;
text-transform: uppercase;
width: 74px;
}

.daterangepicker .ranges input {
font-size: 11px;
}

.daterangepicker .ranges .input-mini {
background-color: #eee;
border: 1px solid #ccc;
border-radius: 4px;
color: #555;
display: block;
font-size: 11px;
height: 30px;
line-height: 30px;
vertical-align: middle;
margin: 0 0 10px 0;
padding: 0 6px;
width: 74px;
}

.daterangepicker .ranges ul {
list-style: none;
margin: 0;
padding: 0;
}

.daterangepicker .ranges li {
font-size: 13px;
background: #f5f5f5;
border: 1px solid #f5f5f5;
color: #08c;
padding: 3px 12px;
margin-bottom: 8px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
cursor: pointer;
}

.daterangepicker .ranges li.active, .daterangepicker .ranges li:hover {
background: #08c;
border: 1px solid #08c;
color: #fff;
}

.daterangepicker .calendar-date {
border: 1px solid #ddd;
padding: 4px;
border-radius: 4px;
background: #fff;
}

.daterangepicker .calendar-time {
text-align: center;
margin: 8px auto 0 auto;
line-height: 30px;
}

.daterangepicker {
position: absolute;
background: #fff;
top: 100px;
left: 20px;
padding: 4px;
margin-top: 1px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}

.daterangepicker.opensleft:before {
position: absolute;
top: -7px;
right: 9px;
display: inline-block;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
border-left: 7px solid transparent;
border-bottom-color: rgba(0, 0, 0, 0.2);
content: '';
}

.daterangepicker.opensleft:after {
position: absolute;
top: -6px;
right: 10px;
display: inline-block;
border-right: 6px solid transparent;
border-bottom: 6px solid #fff;
border-left: 6px solid transparent;
content: '';
}

.daterangepicker.opensright:before {
position: absolute;
top: -7px;
left: 9px;
display: inline-block;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
border-left: 7px solid transparent;
border-bottom-color: rgba(0, 0, 0, 0.2);
content: '';
}

.daterangepicker.opensright:after {
position: absolute;
top: -6px;
left: 10px;
display: inline-block;
border-right: 6px solid transparent;
border-bottom: 6px solid #fff;
border-left: 6px solid transparent;
content: '';
}

.daterangepicker table {
width: 100%;
margin: 0;
}

.daterangepicker td, .daterangepicker th {
text-align: center;
width: 20px;
height: 20px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
cursor: pointer;
white-space: nowrap;
}

.daterangepicker td.off {
color: #999;
}

.daterangepicker td.disabled {
color: #999;
}

.daterangepicker td.available:hover, .daterangepicker th.available:hover {
background: #eee;
}

.daterangepicker td.in-range {
background: #ebf4f8;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
}

.daterangepicker td.active, .daterangepicker td.active:hover {
background-color: #357ebd;
border-color: #3071a9;
color: #fff;
}

.daterangepicker td.week, .daterangepicker th.week {
font-size: 80%;
color: #ccc;
}

.daterangepicker select.monthselect, .daterangepicker select.yearselect {
font-size: 12px;
padding: 1px;
height: auto;
margin: 0;
cursor: default;
}

.daterangepicker select.monthselect {
margin-right: 2%;
width: 56%;
}

.daterangepicker select.yearselect {
width: 40%;
}

.daterangepicker select.hourselect, .daterangepicker select.minuteselect, .daterangepicker select.ampmselect {
width: 50px;
margin-bottom: 0;
}
Loading

0 comments on commit 4729b69

Please sign in to comment.