smalot / bootstrap-datetimepicker

Both Date and Time picker widget based on twitter bootstrap (supports Bootstrap v2 and v3)
http://www.malot.fr/bootstrap-datetimepicker/
Apache License 2.0
3.49k stars 1.65k forks source link

Bug with year overflow. #249

Open Dotfan opened 10 years ago

Dotfan commented 10 years ago

When I enter more than 6 digits in the year part web-page hangs. I tried in Google Chrome. http://www.youtube.com/watch?v=0HAH3DexxsA&feature=youtu.be

tanasiciuc commented 10 years ago

i also have the same problem, in chrome, but also in IE 11

tanasiciuc commented 10 years ago

i made a quick fix for this problem. In boostrap-datetimepicker.js at: while (d.getUTCMonth() != v) d.setUTCDate(d.getUTCDate() - 1); replace with:

while (d.getUTCMonth() != v) if (isNaN(d.getUTCMonth())) return d; else d.setUTCDate(d.getUTCDate() - 1);

smalot commented 10 years ago

can you fork the project and make a pull request ? many thanks

tanasiciuc commented 10 years ago

done