Skip to content

Commit

Permalink
issue #136 fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
longbill committed Aug 29, 2015
1 parent d064f37 commit 421b2e5
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions jquery.daterangepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -552,12 +552,11 @@
if (opt.isTouchDevice) opt.hoveringTooltip = false;

//show one month on mobile devices
if (opt.singleMonth == 'auto')
{
opt.singleMonth = $(window).width() < 480;
}
if (opt.singleMonth == 'auto') opt.singleMonth = $(window).width() < 480;
if (opt.singleMonth) opt.stickyMonths = false;

if (opt.singleDate) opt.singleMonth = true;

if (!opt.showTopbar) opt.autoClose = true;

if (opt.startDate && typeof opt.startDate == 'string') opt.startDate = moment(opt.startDate,opt.format).toDate();
Expand Down Expand Up @@ -683,6 +682,14 @@
showMonth(nextMonth(defaultTime),'month2');
}

if (opt.singleDate)
{
if (opt.startDate && compare_month(defaultTime,opt.startDate) < 0 ) defaultTime = moment(opt.startDate).toDate();
if (opt.endDate && compare_month(defaultTime,opt.endDate) > 0 ) defaultTime = moment(opt.endDate).toDate();

showMonth(defaultTime,'month1');
}

if (opt.time.enabled)
{
if ((opt.startDate && opt.endDate) || (opt.start && opt.end)) {
Expand Down

0 comments on commit 421b2e5

Please sign in to comment.