Quick refactor of the date parse code.