changed min-date calculation