throw error on date/startOf if period is invalid