engineer9090909090909090 / jquery-datepicker

Automatically exported from code.google.com/p/jquery-datepicker
0 stars 0 forks source link

Feature request: Date validation of manual entry on blur #276

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I LOVE this plugin, but it would be nice if the datepicker library would do 
date validation upon blur (at the same time it is closing the picker), if the 
user has chosen to type in a date instead of using the picker. 

Original issue reported on code.google.com by rpierce%...@gtempaccount.com on 28 Apr 2011 at 6:34

GoogleCodeExporter commented 8 years ago
I am thinking like a default onClose method, like:

onClose: function (dateText, inst) {
  var thisObj = jQuery(this);
  var minYear = thisObj.hasClass('2kDate') ? 2000 : 1900;
  try {
    var newDate = jQuery.datepicker.parseDate( 'mm/dd/yy', dateText );
    while (newDate.getFullYear()<minYear)
      newDate.setFullYear(newDate.getFullYear()+100);
    newDate = jQuery.datepicker.formatDate( 'mm/dd/yy', newDate );
    thisObj.val(newDate);
  } 
  catch (e) { thisObj.val(""); }
}});

Original comment by rpierce%...@gtempaccount.com on 28 Apr 2011 at 8:24

GoogleCodeExporter commented 8 years ago
http://code.google.com/p/jquery-datepicker/wiki/NotTheUIDatePicker

Original comment by kelvin.l...@gmail.com on 2 May 2011 at 9:37