var date = new Date('2012-10-05');
After dropping the app into test, one of our testers pointed out that a particular view wasn't working properly. Instead of filtering a list of events by date, it was showing everything!
As it turned out, iOS5 was returning the string
for the above piece of code. Instead of parsing the date string and returning a date object it was failing.
To fix this, I had to split the date string on the hyphen then build the date object using the alternative syntax
var parts = '2012-10-05'.split('-'); var date = new Date(parts, parts-1, parts);