|
1 | | -import React from "react"; |
2 | | - |
3 | | -const Hours = () => { |
4 | | - // create an array called shelterHours with objects for the shop hours |
5 | | - // the shelter is open Mon-Fri 10am-4pm and Sat-Sun 9am-8pm |
6 | | - const shelterHours = [ |
7 | | - { day: "Monday", open: "10am", close: "4pm" }, |
8 | | - { day: "Tuesday", open: "10am", close: "4pm" }, |
9 | | - { day: "Wednesday", open: "10am", close: "4pm" }, |
10 | | - { day: "Thursday", open: "10am", close: "4pm" }, |
11 | | - { day: "Friday", open: "10am", close: "4pm" }, |
12 | | - { day: "Saturday", open: "9am", close: "8pm" }, |
13 | | - { day: "Sunday", open: "9am", close: "8pm" } |
14 | | - ]; |
15 | | - |
16 | | - // determine the current day of the week as a string |
17 | | - const today = new Date().toLocaleString("en-US", { weekday: "long" }); |
18 | | - // get today's hours from the shelterHours array |
19 | | - const hours = shelterHours.find(day => day.day === today); |
20 | | - |
21 | | - // display the hours for today |
22 | | - return ( |
23 | | - <div> |
24 | | - <h2>Hours</h2> |
25 | | - <p> |
26 | | - Today's we are open from {hours.open} to {hours.close}. |
27 | | - </p> |
28 | | - </div> |
29 | | - ); |
30 | | -}; |
31 | | - |
32 | | -export default Hours; |
| 1 | +// Placeholder to host a component |
0 commit comments