handling invalid dates and displaying errors, added a helper to DRY some data generation code