ItEr40S05ValidacionEProbasFuncionaisItEr39S05: datePosteriorOrEqualToStartDate constraint uses local dates for comparison.

This commit is contained in:
Óscar González Fernández 2009-12-21 14:37:15 +01:00
parent 00d85c3d10
commit dc32e27e25
2 changed files with 6 additions and 7 deletions

View file

@ -264,12 +264,12 @@ public class AllocationRowsHandler {
}
public Date getEnd() {
LocalDate start = new LocalDate(getStartDate());
LocalDate start = getStartDate();
return toDate(start.plusDays(getDaysDuration()));
}
public Date getStartDate() {
return task.getStartDate();
public LocalDate getStartDate() {
return new LocalDate(task.getStartDate());
}
private Date toDate(LocalDate date) {

View file

@ -286,8 +286,8 @@ class FormBinder {
public void validate(Component comp, Object value)
throws WrongValueException {
Date date = (Date) value;
Date startDate = allocationRowsHandler.getStartDate();
if (date.before(startDate)) {
LocalDate startDate = allocationRowsHandler.getStartDate();
if (new LocalDate(date).isBefore(startDate)) {
throw new WrongValueException(comp, _(
"{0} must not be before {1}", date, startDate));
}
@ -463,8 +463,7 @@ class FormBinder {
public void markEndDateMustBeAfterStartDate() {
DateTimeFormatter formatter = ISODateTimeFormat.basicDate().withLocale(
Locales.getCurrent());
LocalDate start = new LocalDate(allocationRowsHandler
.getStartDate());
LocalDate start = allocationRowsHandler.getStartDate();
throw new WrongValueException(endDate, _(
"end date: {0} must be after start date: {1}",
getAllocationEnd().toString(formatter), start