if (constraint != null) {
int duration = node.getDuration();
GanttDate date = GanttDate.createFrom(initDate.plusDays(latestFinish - duration));
date = constraint.applyTo(date);
int daysBetween = Days.daysBetween(initDate,
LocalDate.fromDateFields(date.toDayRoundedDate()))
.getDays();
latestFinish = daysBetween + duration;
}
node.setLatestFinish(latestFinish);
}