Skip to content

Commit

Permalink
Fix range picker
Browse files Browse the repository at this point in the history
  • Loading branch information
robertcasanova committed Aug 20, 2015
1 parent 2147cdf commit 7a2433b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/js/bootstrap-datetimepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,8 @@
clsName += ' weekend';
}
if (startRange && endRange) {
if (currentDate.isAfter(startRange.subtract(1, 'm')) && currentDate.isBefore(endRange.add(1, 'm'))) {

if (currentDate.isSame(startRange.startOf('day')) || currentDate.isAfter(startRange.startOf('day')) && currentDate.isBefore(endRange.endOf('day'))) {
clsName += ' range';
}
}
Expand Down Expand Up @@ -1156,11 +1157,11 @@

//when range option is enable highlight range
highlight: function (e, $el, widget) {

if (endRange !== null) {
return;
}

var currentDate = moment($el.data('day'), ['L']),
var currentDate = moment($el.data('day'),['MM/DD/YYYY']),
$days = widget.find('.day[data-action]'),
$startRange = $days.filter('.day.active');

Expand All @@ -1169,7 +1170,7 @@
$startRange = $days.eq(0);
}

if (startRange && startRange < currentDate) {
if (startRange && startRange.isBefore(currentDate)) {
$days.removeClass('highlight');
$days.slice($days.index($startRange), $days.index($el)).addClass('highlight');
}
Expand Down

0 comments on commit 7a2433b

Please sign in to comment.