Moving all parsing logic into the parseDate function