Skip to content

Future Visit Booking Validation #2337

@marcosgdz03

Description

@marcosgdz03

🐛 Problem

Currently, visits can be created with any date (past, present, or future).
There is no validation to prevent booking visits in the past.

✅ Expected Behavior

  • New visits should only be allowed from tomorrow onwards.
  • Past dates should trigger validation errors.
  • Validation should be applied in both:
    • Frontend (<input type="date" min="...">)
    • Backend (in VisitController.processNewVisitForm).

📍 Affected Areas

  • pets/createOrUpdateVisitForm.html: add min attribute to date input.
  • VisitController.java: add check
if (visit.getDate() != null && !visit.getDate().isAfter(LocalDate.now())) {
    result.rejectValue("date", "invalid", "Visit date must be in the future");
} 

🧪 Testing

  • ❌ Past date → error
  • ✅ Future date → allowed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions