Browse files

ensure valid date for time picker

  • Loading branch information...
1 parent dc88525 commit e28efadadb8b2dc003412f2d920b630cf3ce7e86 @jcarrig jcarrig committed Nov 14, 2012
Showing with 3 additions and 0 deletions.
  1. +3 −0 src/js/time_picker.js
View
3 src/js/time_picker.js
@@ -133,6 +133,8 @@
if(!!this.model && this.options.content) {
var boundDate = this.resolveContent();
var updatedDate = new Date(boundDate);
+ // Ensure we are updating a valid Date object
+ updatedDate = isNaN(updatedDate.getTime()) ? new Date() : updatedDate;
updatedDate.setHours(newDate.hours());
updatedDate.setMinutes(newDate.minutes());
_(this.model).setProperty(this.options.content, updatedDate);
@@ -143,5 +145,6 @@
}
}
}
+
});
}());

0 comments on commit e28efad

Please sign in to comment.