DRY up date parsing