diff --git a/jquery.daterangepicker.js b/jquery.daterangepicker.js index 398c2bb..7802a40 100755 --- a/jquery.daterangepicker.js +++ b/jquery.daterangepicker.js @@ -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(); @@ -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)) {