Skip to content

Commit

Permalink
Better handle partially typed dates
Browse files Browse the repository at this point in the history
  • Loading branch information
dangrossman committed Oct 17, 2015
1 parent b8175fe commit 188e582
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions daterangepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -1432,6 +1432,7 @@
elementChanged: function() {
if (!this.element.is('input')) return;
if (!this.element.val().length) return;
if (this.element.val().length < this.locale.format.length) return;

var dateString = this.element.val().split(this.locale.separator),
start = null,
Expand All @@ -1447,6 +1448,8 @@
end = start;
}

if (!start.isValid() || !end.isValid()) return;

this.setStartDate(start);
this.setEndDate(end);
this.updateView();
Expand Down

0 comments on commit 188e582

Please sign in to comment.