Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes an issue where day ranges were being counted incorrectly #311

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/jquery.daterangepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -1863,7 +1863,7 @@

function countDays(start,end)
{
return Math.abs( daysFrom1970(start) - daysFrom1970(end) ) + 1;
return moment(start).diff(moment(end), 'd') + 1;
}

function setDateRange(date1,date2,silent)
Expand Down Expand Up @@ -2021,7 +2021,7 @@
updateSelectableRange();
bindDayEvents();
}

function bindDayEvents()
{
box.find('.day').unbind("click").click(function (evt) {
Expand Down Expand Up @@ -2184,7 +2184,7 @@

var arrowPrev = '<';
if(opt.customArrowPrevSymbol) arrowPrev = opt.customArrowPrevSymbol;

var arrowNext = '>';
if(opt.customArrowNextSymbol) arrowNext = opt.customArrowNextSymbol;

Expand All @@ -2199,11 +2199,11 @@
' </th>'+
' <th colspan="' + _colspan + '" class="month-name">'+
' </th>'+
' <th style="width:27px;">' +
(opt.singleDate || !opt.stickyMonths ? '<span class="next">' + arrowNext + '</span>' : '') +
' <th style="width:27px;">' +
(opt.singleDate || !opt.stickyMonths ? '<span class="next">' + arrowNext + '</span>' : '') +
' </th>'+
' </tr>'+
' <tr class="week-name">' + getWeekHead() +
' <tr class="week-name">' + getWeekHead() +
' </thead>'+
' <tbody></tbody>'+
' </table>';
Expand All @@ -2214,16 +2214,16 @@
'<table class="month2" cellspacing="0" border="0" cellpadding="0">'+
' <thead>'+
' <tr class="caption">'+
' <th style="width:27px;">' +
(!opt.stickyMonths ? '<span class="prev">' + arrowPrev + '</span>' : '') +
' <th style="width:27px;">' +
(!opt.stickyMonths ? '<span class="prev">' + arrowPrev + '</span>' : '') +
' </th>'+
' <th colspan="' + _colspan + '" class="month-name">'+
' </th>'+
' <th style="width:27px;">'+
' <span class="next">' + arrowNext + '</span>'+
' </th>'+
' </tr>'+
' <tr class="week-name">' + getWeekHead() +
' <tr class="week-name">' + getWeekHead() +
' </thead>'+
' <tbody></tbody>'+
'</table>';
Expand Down