SJBroida / Capstone_Restaurant_Reservation_System

GitHub Repository for the final Thinkful capstone: a complete Restaurant Reservation System application
1 stars 0 forks source link

US-02 Create reservation on a future, working date #2

Open SJBroida opened 2 years ago

SJBroida commented 2 years ago

User Story 2:

As a restaurant manager I only want to allow reservations to be created on a day when we are open so that users do not accidentally create a reservation for days when we are closed.

SJBroida commented 2 years ago

Acceptance criteria

  1. The /reservations/new page will display an error message with className="alert alert-danger" if any of the following constraints are violated:
    • The reservation date is a Tuesday as the restaurant is closed on Tuesdays.
    • The reservation date is in the past. Only future reservations are allowed.
  2. The /reservations API will have the same validations as above and will return 400, along with an informative error message, when a validation error happens.
SJBroida commented 2 years ago

Hint There may be more than one validation error on the page at time.

For example, a reservation in the past on a Tuesday violates both rules, so the page should display two errors within a single className="alert alert-danger"

However, the API validation does not need to include multiple validation error messages. You can run the validation in any order and report only one validation error at a time, and the tests will pass.

Also, parsing a date in YYYY-MM-DD format using the built-in Date class assumes the date is a UTC date. UTC is a time standard that is the basis for civil time and time zones worldwide, but it is NOT a timezone. As a result, keep an eye out for how your dates are interpreted by the Date class.

While there is nothing preventing you from using a third party library to handle dates for your project, you are encouraged to use the built-in Date class.