fix order of variable evaluation in min/maxDate functions