shirenekboyd / final-capstone-project

Restaurant Reservation System
0 stars 0 forks source link

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

Open shirenekboyd opened 2 years ago

shirenekboyd commented 2 years ago

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.

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:
    • [x] The reservation date is a Tuesday as the restaurant is closed on Tuesdays.
    • [x] The reservation date is in the past. Only future reservations are allowed.
shirenekboyd 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.