It is advisable not to rely on the datetime
type in this scenario, as it corresponds to a specific time on a particular day, whereas your business hours repeat weekly.
If your database supports a time
data type, that would be more suitable. Otherwise, consider using a numerical value (representing minutes since midnight) or a string along with a separate field for the timezone. The stored time should reflect the local time of the restaurant and not be converted to UTC to prevent complications during daylight saving time transitions.
One potential issue you might encounter later on is handling closing times that extend past midnight, which are typically attributed to the previous day from a scheduling and operational standpoint. Therefore, it could be simplified by storing the opening time plus the duration the restaurant remains open to avoid confusion.
After reviewing the documentation at Xata docs, it appears that there is no native support for a time
type. In such a case, my suggestion would involve creating a table with columns for day_of_the_week
, opening_time
, and opening_duration
specified as integers denoting minutes elapsed since midnight and minutes of operation, respectively.
Source: I have previously been a member of the internet calendaring standards organization known as CalConnect.