[Coworker] asked me to check his date-parsing algorithm for some of the FileMaker damage. FM apparently gives out a data as a string of digits, month day year, in the American style, with no delimiter. We had some fun examining the edge cases of this amazing brain-damage. Of a range from 112006 to 12312006 say, some are easy, like 112006 (and the other 6 digit cases). Drop the year and both of the remaining numerals run 1-9, so it's in the first ten days of the first ten months, easy enough. The eight digit ones (12122006) are still pretty easy. Drop the year and test the last two and first two remaining digits. It might require some ugly case switch blocks, or a flurry of if else, but no big deal. The seven digit ones are bastards. As part of the execise I made up some examples to test the developing algorithm on. I wrote 112006 and 12122006, easy dismissed. then I wrote the following samples:
which well and truly broke us. We laughed and laughed, and then he dug back into the FileMunger API to find a way to get just the month into a variable. Armed with this, the problem is soluble again, if still painful.Edit 2008: This logic bug is the source of my Bug icon, and so it now wears it.