Am doing a script in which have need of know if the store is open or closed, depending on the time local. Currently, I get the data of an api, which I keep in my database and call it via an Ajax request. The data that return are (equal that which I get):
["Mo-Sa 11:00-14:30", "Mo-Th 17:00-21:30", "Fr-Sa 17:00-22:00"]
I have been assessing the possibility of converting it as well (I still have to see how to do it):
{
"monday": ["11:00-14:30", "17:00-21:30"],
"tuesday": ["11:00-14:30", "17:00-21:30"],
"wednesday": ["11:00-14:30", "17:00-21:30"],
"thursday": ["11:00-14:30", "17:00-21:30"],
"friday": ["11:00-14:30", "17:00-22:00"],
"saturday": ["11:00-14:30", "17:00-22:00"],
"sunday": null
}
I've seen examples in these questions:
Create a function to check if a business is open and write text to html
Determine If Business Is Open/Closed Based On Business Hours (php)
Before programming code with any routine for this, I want to know if anyone knows any way to make it simple or has seen some portion of code on the web; to not reinvent the wheel. Thanks a lot.
Best regards