1// parse a date in yyyy-mm-dd format
2function parseDate(input) {
3 var parts = input.match(/(\d+)/g);
4 // new Date(year, month [, date [, hours[, minutes[, seconds[, ms]]]]])
5 return new Date(parts[0], parts[1]-1, parts[2]); // months are 0-based
6}
7