Use the following script as a workflow transition validator. It allows a transition only if the date field value is within 180 days from today.
interval range = "180d"; date maxDate = currentDate() + range; string errorMsg = "Due date must be within 180 days of today"; if(isNull(due) || due > maxDate) { return false, "error", errorMsg; }